/** * Create and connect to an MCP server using stdio transport. */ export declare function connectStdio(name: string, command: string, args?: string[], env?: Record): Promise; /** * Create and connect to an MCP server using HTTP transport. */ export declare function connectHTTP(name: string, url: string, headers?: Record): Promise; // ============================================================================ // Exports // ============================================================================ export declare const mcp: { MCPClient: typeof MCPClient; MCPManager: typeof MCPManager; connectStdio: typeof connectStdio; connectHTTP: typeof connectHTTP }; /** * MCP (Model Context Protocol) Module * * Implements an MCP client for connecting to MCP servers, discovering tools, * and invoking them through AI providers. This enables AI models to interact * with external services via a standardized protocol. * * @see https://modelcontextprotocol.io */ // ============================================================================ // Types // ============================================================================ export declare interface MCPServerConfig { name: string transport: MCPTransport capabilities?: MCPCapabilities } export declare interface MCPCapabilities { tools?: boolean resources?: boolean prompts?: boolean } export declare interface MCPTool { name: string description: string inputSchema: Record } export declare interface MCPResource { uri: string name: string description?: string mimeType?: string } export declare interface MCPPrompt { name: string description?: string arguments?: Array<{ name: string description?: string required?: boolean }> } export declare interface MCPToolCallResult { content: Array<{ type: 'text' | 'image' | 'resource' text?: string data?: string mimeType?: string }> isError?: boolean } export declare interface MCPResourceContent { uri: string mimeType?: string text?: string blob?: string } export type MCPTransport = | { type: 'stdio'; command: string; args?: string[]; env?: Record } | { type: 'sse'; url: string; headers?: Record } | { type: 'streamable-http'; url: string; headers?: Record } /** * MCP Client for connecting to Model Context Protocol servers. * * Supports stdio and SSE/streamable-http transports. * Provides tool discovery, invocation, resource reading, and prompt listing. */ export declare class MCPClient { constructor(config: MCPServerConfig); connect(): Promise; listTools(): MCPTool[]; listResources(): MCPResource[]; listPrompts(): MCPPrompt[]; callTool(name: string, args?: Record): Promise; readResource(uri: string): Promise; getPrompt(name: string, args?: Record): Promise<{ description?: string messages: Array<{ role: string; content: { type: string; text: string } }> }>; toAnthropicTools(): Array<{ name: string; description: string; input_schema: Record }>; toOpenAITools(): Array<{ type: 'function'; function: { name: string; description: string; parameters: Record } }>; disconnect(): Promise; get isConnected(): boolean; get serverName(): string; } /** * Manages connections to multiple MCP servers. */ export declare class MCPManager { addServer(config: MCPServerConfig): Promise; removeServer(name: string): Promise; getServer(name: string): MCPClient | undefined; listServers(): string[]; getAllTools(): Array; callTool(toolPath: string, args?: Record): Promise; toAnthropicTools(): Array<{ name: string; description: string; input_schema: Record }>; toOpenAITools(): Array<{ type: 'function'; function: { name: string; description: string; parameters: Record } }>; disconnectAll(): Promise; }