import type { MCPContentBlock, MCPResource, MCPServerConfig, MCPServerState, MCPToolDefinition, MCPToolResult, MCPTransport } from '../../../types/connector/index.js'; import type { MCPPromptDefinition, MCPPromptMessage } from '../../../types/connector/index.js'; import type { MCPServerId } from '../../../types/ids/index.js'; import { type Logger } from '../../../utils/logger.js'; /** * A method this server does not implement. * * Carried as its own error so the dispatcher can answer with the protocol's * own code instead of a generic internal error. `-32603` tells a client the * server broke; `-32601` tells it the server does not do this — and only the * second lets a client stop asking rather than retry. */ export declare class MCPMethodNotFound extends Error { readonly method: string; constructor(method: string); } export interface MCPServerToolProvider { listTools(): MCPToolDefinition[]; callTool(name: string, args?: Record): Promise; } export interface MCPServerResourceProvider { listResources(): MCPResource[]; readResource(uri: string): Promise; } /** * Prompts this server publishes. * * Injected as an interface like the other two, so the server owns dispatch * and the host owns content. `MCPPromptDefinition` existed in the types * from the start with no way to serve one. */ export interface MCPServerPromptProvider { listPrompts(): MCPPromptDefinition[]; getPrompt(name: string, args?: Record): Promise<{ description?: string; messages: MCPPromptMessage[]; }>; } export declare class MCPServer { readonly id: MCPServerId; private config; private toolProvider; private resourceProvider?; private promptProvider?; private transport; private running; private connectedClients; private startedAt?; private log; constructor(config: MCPServerConfig, toolProvider: MCPServerToolProvider, resourceProvider?: MCPServerResourceProvider, promptProvider?: MCPServerPromptProvider, log?: Logger); start(transport: MCPTransport): Promise; stop(): Promise; isRunning(): boolean; getState(): MCPServerState; private handleRequest; private dispatch; private handleInitialize; private handleToolsList; private handleToolsCall; /** * An empty list is what a server with NO resources returns. A server * that cannot serve resources at all has to say so differently. * * This used to answer `{ resources: [] }` when no provider was * configured, for a capability `initialize` never advertised — so a * client that asked anyway was told, in the protocol's own vocabulary, * that the answer is "none" rather than "not here". The two send a * client in opposite directions: one stops asking, the other looks for * the resource somewhere else. */ private handleResourcesList; private handlePromptsList; private handlePromptsGet; private handleResourcesRead; private respond; private respondError; } //# sourceMappingURL=server.d.ts.map