/** * MCP server transport type. * - 'stdio' — spawn a child process (command + args) * - 'sse' — connect to an SSE endpoint (url) * - 'streamable-http' — connect via streamable HTTP transport (url) */ export type LTMcpTransportType = 'stdio' | 'sse' | 'streamable-http'; /** * MCP server registration as stored in the database (snake_case). */ export interface LTMcpServerRecord { id: string; name: string; description: string | null; transport_type: LTMcpTransportType; transport_config: { /** For stdio: the command to spawn */ command?: string; /** For stdio: arguments to the command */ args?: string[]; /** For stdio: environment variables to set */ env?: Record; /** For sse: the URL to connect to */ url?: string; }; /** Whether to auto-connect on startup */ auto_connect: boolean; /** Cached tool manifest from last listTools() */ tool_manifest: LTMcpToolManifest[] | null; metadata: Record | null; /** Categorization tags for efficient tool discovery (e.g., ['database', 'analytics']) */ tags: string[]; /** Per-server hints injected into the YAML compilation prompt when this server's tools are used */ compile_hints: string | null; /** Credential providers required by this server's tools (e.g., ['anthropic']) */ credential_providers: string[]; /** Capability category for grouping (e.g., 'Communication', 'Analysis', 'Data') */ category: string | null; status: LTMcpServerStatus; last_connected_at: Date | null; created_at: Date; updated_at: Date; } export type LTMcpServerStatus = 'registered' | 'connected' | 'error' | 'disconnected'; /** * Cached tool manifest entry from listTools(). */ export interface LTMcpToolManifest { name: string; description: string; inputSchema: Record; } /** * MCP adapter interface. Follows the same pattern as * LTTelemetryAdapter (single-adapter, connect/disconnect). * * The adapter manages: * - One MCP server (human queue) exposing Long Tail escalations * - Multiple MCP client connections to external servers */ export interface LTMcpAdapter { /** Start the MCP server and connect all auto-connect clients */ connect(): Promise; /** Disconnect all clients and stop the server */ disconnect(): Promise; /** Connect to a registered MCP server by name or ID */ connectClient(serverId: string): Promise; /** Disconnect a specific client */ disconnectClient(serverId: string): Promise; /** List tools from a connected server */ listTools(serverId: string): Promise; /** Call a tool on a connected server */ callTool(serverId: string, toolName: string, args: Record, authContext?: { userId?: string; delegationToken?: string; }): Promise; /** * Return an object of tool functions suitable for * Durable.workflow.proxyActivities(). Each key is a tool name * and each value is an async function wrapping callTool(). */ toolActivities(serverId: string): Promise Promise>>; }