@nextscope/mcp
Version:
MCP bridge and shared tools for NextScope.
66 lines (65 loc) • 2.53 kB
TypeScript
import type { IncomingMessage, ServerResponse } from 'node:http';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
export type ResponseFormat = 'markdown' | 'json';
export interface OutputOptions {
format?: ResponseFormat;
writeToFile?: string;
overwrite?: boolean;
}
export type NextScopeToolName = 'nextscope_status' | 'nextscope_list_servers' | 'nextscope_list_traces' | 'nextscope_get_trace' | 'nextscope_list_spans' | 'nextscope_get_spans' | 'nextscope_search_spans' | 'nextscope_export_trace' | 'nextscope_clear_traces';
export interface PaginatedResult<T> {
items: T[];
nextCursor?: string;
total: number;
}
export interface NextScopeServerInfo {
serverId: string;
projectRoot: string;
packageName?: string;
route?: string;
devOrigin?: string;
inspectorUrl?: string;
mcpUrl?: string;
traceCount?: number;
lastIngestAt?: string;
lastError?: string;
}
export interface ServerSelection {
serverId?: string;
}
export interface NextScopeMcpAdapter {
getStatus(args: OutputOptions & ServerSelection): unknown | Promise<unknown>;
listServers(args: OutputOptions): unknown | Promise<unknown>;
listTraces(args: OutputOptions & ServerSelection & {
limit: number;
cursor?: string;
sort: TraceSummarySort;
}): unknown | Promise<unknown>;
getTrace(args: OutputOptions & ServerSelection & {
traceId: string;
}): unknown | Promise<unknown>;
listSpans(args: OutputOptions & ServerSelection & {
traceId: string;
limit: number;
cursor?: string;
}): unknown | Promise<unknown>;
getSpans(args: OutputOptions & ServerSelection & {
traceId: string;
spanIds: string[];
}): unknown | Promise<unknown>;
searchSpans(args: OutputOptions & ServerSelection & {
query: string;
traceId?: string;
limit: number;
cursor?: string;
}): unknown | Promise<unknown>;
exportTrace(args: OutputOptions & ServerSelection & {
traceId: string;
}): unknown | Promise<unknown>;
clearTraces(args: OutputOptions & ServerSelection & {
confirm: boolean;
}): unknown | Promise<unknown>;
}
export type TraceSummarySort = 'newest' | 'slowest' | 'errors-first';
export declare function handleNextScopeMcpRequest(request: IncomingMessage, response: ServerResponse, adapter: NextScopeMcpAdapter): Promise<void>;
export declare function createNextScopeMcpServer(adapter: NextScopeMcpAdapter): McpServer;