/** * MCP (Model Context Protocol) types and interfaces */ /** * MCP transport type */ export type MCPTransport = 'stdio' | 'http' | 'sse'; /** * MCP server configuration */ export interface MCPServerConfig { id: string; name?: string; transport: MCPTransport; command?: string; args?: string[]; env?: Record; allowedCommands?: string[]; envAllowlist?: string[]; url?: string; headers?: Record; allowedHosts?: string[]; allowedSchemes?: string[]; enabled?: boolean; timeout?: number; lazy?: boolean; retry?: { maxAttempts?: number; initialDelayMs?: number; maxDelayMs?: number; }; healthCheckIntervalMs?: number; } /** * MCP protocol message types (JSON-RPC 2.0) */ export interface MCPRequest { jsonrpc: '2.0'; id: string | number; method: string; params?: Record; } export interface MCPResponse { jsonrpc: '2.0'; id: string | number; result?: any; error?: { code: number; message: string; data?: any; }; } export interface MCPNotification { jsonrpc: '2.0'; method: string; params?: Record; } /** * MCP initialization request parameters */ export interface MCPInitializeParams { protocolVersion: string; capabilities: { roots?: { listChanged?: boolean; }; sampling?: Record; }; clientInfo: { name: string; version: string; }; } /** * MCP initialization response */ export interface MCPInitializeResult { protocolVersion: string; capabilities: { tools?: { listChanged?: boolean; }; resources?: { subscribe?: boolean; listChanged?: boolean; }; prompts?: { listChanged?: boolean; }; sampling?: Record; }; serverInfo: { name: string; version: string; }; } /** * MCP tool definition */ export interface MCPToolDefinition { name: string; description?: string; inputSchema: { type: 'object'; properties?: Record; required?: string[]; [key: string]: any; }; } /** * MCP resource definition */ export interface MCPResource { uri: string; name: string; description?: string; mimeType?: string; } /** * MCP prompt definition */ export interface MCPPrompt { name: string; description?: string; arguments?: Array<{ name: string; description?: string; required?: boolean; }>; } /** * MCP client interface */ export interface MCPClient { /** * Initialize the MCP session */ initialize(): Promise; /** * List available tools */ listTools(): Promise; /** * Call a tool */ callTool(name: string, args: Record): Promise; /** * List available resources */ listResources(): Promise; /** * Read a resource */ readResource(uri: string): Promise<{ contents: Array<{ uri: string; mimeType?: string; text?: string; blob?: string; }>; }>; /** * List available prompts */ listPrompts(): Promise; /** * Get a prompt template */ getPrompt(name: string, args?: Record): Promise<{ messages: Array<{ role: string; content: any; }>; }>; /** * Close the connection */ close(): Promise; /** * Check if client is connected */ isConnected(): boolean; } /** * MCP transport interface */ export interface MCPTransportInterface { /** * Send a request and wait for response */ sendRequest(request: MCPRequest): Promise; /** * Send a notification (no response expected) */ sendNotification(notification: MCPNotification): Promise; /** * Connect to the transport */ connect(): Promise; /** * Disconnect from the transport */ disconnect(): Promise; /** * Check if transport is connected */ isConnected(): boolean; /** * Set up notification handler */ onNotification(handler: (notification: MCPNotification) => void): void; /** * Set up server request handler (for handling server-initiated requests like roots/list) */ onServerRequest?(method: string, handler: (params?: Record) => Promise): void; } //# sourceMappingURL=types.d.ts.map