import { McpClient } from './client.js'; import type { McpToolSchema } from './client.js'; import { type McpElicitationHandler } from './elicitation.js'; import type { McpConfigRoots, McpConfigScope, McpEffectiveConfig, McpServerConfig } from './config.js'; import type { HookDispatcher } from '../hooks/dispatcher.js'; import type { McpDecisionRecord, QuarantineReason, SchemaFreshness } from '../runtime/mcp/types.js'; import type { RuntimeEventBus } from '../runtime/events/index.js'; import type { ConfigManager } from '../config/manager.js'; import { type SandboxSessionRegistry } from '../runtime/sandbox/session-registry.js'; export interface RegisteredTool { /** Fully-qualified tool name: mcp:: */ qualifiedName: string; serverName: string; toolName: string; description: string; } export interface McpReloadServerResult { readonly name: string; readonly action: 'added' | 'changed' | 'removed' | 'unchanged'; readonly connected: boolean; } export interface McpReloadResult { readonly added: number; readonly changed: number; readonly removed: number; readonly unchanged: number; readonly servers: readonly McpReloadServerResult[]; } export declare class McpRegistry { private clients; private serverConfigs; private permissions; private freshness; private runtimeBus; private sandboxConfigManager; private sandboxSessions; private sandboxSessionByServer; private readonly hookDispatcher; private elicitationHandler; constructor(options: { readonly hookDispatcher: Pick; readonly sandboxSessions: SandboxSessionRegistry; }); setRuntimeBus(runtimeBus: RuntimeEventBus | null): void; /** * Wire the resolver for MCP `elicitation/create` requests. When set, connected * clients advertise the elicitation capability and route incoming elicitation * requests through this handler (the approval broker) instead of rejecting * them. Set once at composition; applies to servers connected afterwards. */ setElicitationHandler(handler: McpElicitationHandler | null): void; setSandboxRuntime(configManager: ConfigManager, sessions: SandboxSessionRegistry): void; /** * connectAll, Load config from .goodvibes/mcp.json and connect to all servers. * Errors on individual servers are logged but do not abort the whole startup. */ connectAll(roots: McpConfigRoots): Promise; /** * connectServer, Connect a single MCP server by config. * Exposed for programmatic use (testing, dynamic registration). */ connectServer(serverConfig: McpServerConfig): Promise; reload(roots: McpConfigRoots): Promise; getEffectiveConfig(roots: McpConfigRoots): McpEffectiveConfig; upsertServerConfig(roots: McpConfigRoots, scope: McpConfigScope, serverConfig: McpServerConfig): Promise<{ readonly path: string; readonly reload: McpReloadResult; }>; removeServerConfig(roots: McpConfigRoots, scope: McpConfigScope, serverName: string): Promise<{ readonly path: string; readonly removed: boolean; readonly reload: McpReloadResult; }>; applyConfig(serverConfigs: readonly McpServerConfig[]): Promise; /** * listAllTools, Return all registered tools (name + description) from all connected servers. * Only loads tool names and descriptions, full schemas are NOT fetched here. */ listAllTools(): Promise; /** * getToolSchema, Fetch full JSON schema for a qualified tool name. * Triggers lazy schema load and caches within McpClient. */ getToolSchema(qualifiedName: string): Promise; /** * callTool, Execute a tool by its qualified name. * Fetches the full schema on first use. */ callTool(qualifiedName: string, args: Record): Promise; /** * disconnectAll, Stop all connected MCP server processes. */ disconnectAll(): Promise; disconnectServer(serverName: string, reason?: string): Promise; /** * getClient, Get the McpClient for a given server name (for advanced use). */ getClient(serverName: string): McpClient | undefined; /** Connected server names. */ get serverNames(): string[]; /** * listServers, Return status info for all known servers (connected or not). * Includes the negotiated protocol (era + version) and transport so * diagnostics surfaces show what each server is actually speaking. */ listServers(): Array<{ name: string; connected: boolean; transport?: 'stdio' | 'http' | undefined; protocolVersion?: string | undefined; protocolEra?: 'modern' | 'legacy' | undefined; }>; listServerSecurity(): Array<{ name: string; connected: boolean; transport?: 'stdio' | 'http' | undefined; protocolVersion?: string | undefined; protocolEra?: 'modern' | 'legacy' | undefined; role: import('../runtime/mcp/types.js').McpServerRole; trustMode: import('../runtime/mcp/types.js').McpTrustMode; allowedPaths: string[]; allowedHosts: string[]; schemaFreshness: SchemaFreshness; quarantineReason?: QuarantineReason | undefined; quarantineDetail?: string | undefined; quarantineApprovedBy?: string | undefined; }>; listServerSandboxBindings(): Array<{ name: string; sessionId?: string | undefined; profileId?: 'mcp-shared' | 'mcp-per-server' | undefined; state?: import('../runtime/sandbox/types.js').SandboxSessionState | undefined; backend?: import('../runtime/sandbox/types.js').SandboxResolvedBackend | import('../runtime/sandbox/types.js').SandboxVmBackend | undefined; startupStatus?: 'verified' | 'planned' | 'failed' | undefined; }>; setServerTrustMode(serverName: string, mode: import('../runtime/mcp/types.js').McpTrustMode): void; setServerRole(serverName: string, role: import('../runtime/mcp/types.js').McpServerRole): void; listRecentSecurityDecisions(limit?: number): McpDecisionRecord[]; quarantineSchema(serverName: string, reason: QuarantineReason, detail?: string): void; approveSchemaQuarantine(serverName: string, operatorId: string): void; private _connectServer; private _resolveSandboxProcessSpec; private _selectSandboxProfile; private _requiresDedicatedMcpSandbox; private _handleClientNotification; private _handleClientServerRequest; private _handleClientUnhandledResponse; /** * Parse mcp:: qualified name. * Returns null if the name doesn't match the expected format. */ private _parseQualifiedName; private _emitPolicyUpdate; } //# sourceMappingURL=registry.d.ts.map