/** * HTTP routes for user- and org-scope remote MCP server management. * * Mounted under `/_agent-native/mcp/servers` by `agent-chat-plugin` — * requires a reference to the running `McpClientManager` so mutations can * hot-reload the configured server set. * * GET /_agent-native/mcp/servers list user + org servers * GET /_agent-native/mcp/servers/runtime-config * reserved; returns 410 until a * desktop capability broker exists * POST /_agent-native/mcp/servers add a server * DELETE /_agent-native/mcp/servers/:id remove a server (scope via ?scope=) * POST /_agent-native/mcp/servers/:id/test dry-run connect (no persist) * POST /_agent-native/mcp/servers/:id/reconnect retry connect + refresh * POST /_agent-native/mcp/servers/test dry-run a URL before persisting * GET /_agent-native/mcp/builtin list built-in capability toggles * POST /_agent-native/mcp/builtin update built-in capability toggles * POST /_agent-native/mcp/apps/call-tool mediated same-server app tool call * POST /_agent-native/mcp/apps/list-tools list tools visible to an app iframe * POST /_agent-native/mcp/apps/read-resource read a ui:// app resource */ import { type BuiltinMcpCapability, type BuiltinMcpCapabilityId } from "./builtin-capabilities.js"; import type { McpConfig } from "./config.js"; import { type McpClientManager } from "./manager.js"; import { type McpPrincipal } from "./principal.js"; import { type RemoteMcpScope } from "./remote-store.js"; export { formatMcpConnectError } from "./errors.js"; export declare class McpConfigUnreadableError extends Error { constructor(cause: unknown); } export interface ClientServer { id: string; scope: RemoteMcpScope; name: string; url: string; headers?: Record; authMode: "none" | "headers" | "oauth"; description?: string; firstParty?: boolean; createdAt: number; mergedId: string; status: ServerStatus; } export interface ClientBuiltinCapability { id: BuiltinMcpCapabilityId; serverId: string; name: string; description: string; command: string; args: string[]; exclusiveGroup?: string; available: boolean; unavailableReason?: string; notes?: string; enabled: { user: boolean; org: boolean; }; mergedIds: { user?: string; org?: string; }; status: { user?: ServerStatus; org?: ServerStatus; }; } type ServerStatus = { state: "connected"; toolCount: number; error?: string; } | { state: "error"; error: string; } | { state: "unknown"; }; export declare function builtinMergedConfigKey(scope: RemoteMcpScope, capability: BuiltinMcpCapability, ownerId: string): string; /** * Build only the configuration visible to this authenticated principal. */ export declare function buildMergedConfig(rawPrincipal: McpPrincipal): Promise; export declare function mountMcpServersRoutes(nitroApp: any, manager: McpClientManager | null, options?: { waitUntilReady?: () => Promise; resolveManager?: (principal: McpPrincipal) => Promise; invalidateScope?: (scope: RemoteMcpScope, scopeId: string, keep: McpClientManager) => Promise; }): void;