/** * MCP Client Manager Service * * Manages connections to external MCP servers (Playwright, Fetch, etc.) * with lifecycle management, caching, and tool exposure. */ import type { ConnectedMCPServer, ExternalMCPRegistry, ExternalMCPServerConfig, ExternalMCPTool, ExternalMCPToolCallRequest, ExternalMCPToolCallResult } from '../types/mcp-client.types.js'; import type { MCPApprovalCacheService } from './mcp-approval-cache.service.js'; import type { MCPAuditLoggerService } from './mcp-audit-logger.service.js'; /** * Builds the environment a spawned stdio MCP server receives: only the * allowlisted inherited variables, overlaid with whatever the server's own * config explicitly declares (a declared value wins over the allowlisted * default for the same key). */ export declare function buildStdioServerEnv(processEnv: NodeJS.ProcessEnv, declaredEnv: Record | undefined): Record; export declare function registerGlobalPluginMcpServers(servers: ExternalMCPServerConfig[]): void; export declare function resetGlobalPluginMcpServers(): void; /** * MCP Client Manager Service * * Responsibilities: * - Load external MCP configurations from registry * - Manage client connections using @modelcontextprotocol/sdk Client * - Handle connection lifecycle (connect/disconnect) * - Cache connected servers for session reuse * - Expose tools from connected servers */ export declare class MCPClientManagerService { private approvalCache; private auditLogger; private registryPath; private clients; private connectedServers; private registry; private registryLoaded; private transports; constructor(approvalCache: MCPApprovalCacheService, auditLogger: MCPAuditLoggerService, registryPath?: string); /** * Load the external MCP registry from disk */ loadRegistry(): Promise; /** * Get all available servers from the registry */ getAvailableServers(): Promise; /** * Get a specific server configuration by ID */ getServerConfig(serverId: string): Promise; /** * Check if a server is currently connected */ isConnected(serverId: string): boolean; /** * Get a connected server instance */ getConnectedServer(serverId: string): ConnectedMCPServer | null; /** * Get all connected servers */ getConnectedServers(): ConnectedMCPServer[]; /** * Connect to an external MCP server */ connect(serverId: string): Promise; /** * Disconnect from an external MCP server */ disconnect(serverId: string): Promise; /** * Disconnect from all connected servers */ disconnectAll(): Promise; /** * Get all available tools from connected servers */ getAllTools(): ExternalMCPTool[]; /** * Get tools from a specific connected server */ getServerTools(serverId: string): ExternalMCPTool[]; /** * Validate that a tool is allowed by security policy */ private validateToolAccess; /** * Call a tool on a connected external MCP server */ callTool(request: ExternalMCPToolCallRequest): Promise; /** * Check if approval is required for a server */ requiresApproval(serverId: string): Promise; /** * Create MCP client for a server */ private createClient; /** * Discover available tools from a connected MCP server */ private discoverTools; } /** * Get the MCP Client Manager service instance */ export declare function getMCPClientManager(approvalCache: MCPApprovalCacheService, auditLogger: MCPAuditLoggerService, registryPath?: string): MCPClientManagerService; /** * Reset the singleton (for testing) */ export declare function resetMCPClientManager(): void; //# sourceMappingURL=mcp-client-manager.service.d.ts.map