/** * Browser stub for `McpClientPool`. The real pool statically imports * `@modelcontextprotocol/sdk/client/stdio.js`, which pulls Node-only * `node:process` + `node:stream` + `child_process` into the import * graph. Bundlers under `--platform=browser` can't resolve those, so * the browser export of `@qodo/sdk` swaps in this stub. * * The stub keeps the same `register` / `ready` / `callTool` / `listTools` * / `removeAndClose` / `resolveMcpForTool` / `dispose` surface so * `QarRegistryClient`'s typing is preserved across both bundles. Every * non-sdk transport register call throws synchronously with a typed * error pointing at the cause; the in-process `'sdk'` config never * reaches the pool (per `QarRegistryClient.registerMcp`), so consumers * wiring only `transport: 'sdk'` in browser are unaffected. * * Browser support for remote MCP transports is a future-work item — * it requires a fetch-based Streamable HTTP transport that doesn't * pull stdio + child_process into the static import graph. */ import type { RemoteSseMcpConfig, RemoteStreamableHttpMcpConfig, StdioMcpConfig } from '../QarRegistryClient.js'; /** * Mirror of the Node-side {@link PoolableMcpConfig} so the typed pool * surface is identical across bundles. Browser register always throws — * the type narrow keeps consumer call sites lined up with the Node * pool's signature. */ export type PoolableMcpConfig = StdioMcpConfig | RemoteStreamableHttpMcpConfig | RemoteSseMcpConfig; /** Mirror of the Node-side `ToolListEntry` so the typed surface lines up. */ export interface ToolListEntry { readonly name: string; readonly description?: string; readonly inputSchema?: { readonly [key: string]: unknown; }; } /** * Mirror of the Node-side {@link PreparedEntry}. Browser `prepareEntry` * never returns one (it throws), but the type is kept for source-level * parity so `QarRegistryClient.registerMcp` typechecks identically * against both pool implementations. */ export interface PreparedEntry { readonly client: never; readonly transport: never; readonly transportLabel: 'remote-streamable-http' | 'remote-sse' | 'stdio'; } export declare class McpClientPool { /** * The Node pool's two-phase commit (`prepareEntry` + `commitEntry`) is * called by `QarRegistryClient.registerMcp` for every non-`sdk` * config. The browser stub MUST mirror that surface or browser-bundle * consumers registering a remote MCP would crash with `prepareEntry * is not a function` before reaching `register`. Both phases throw * the same typed error as the legacy single-call `register` so the * consumer-facing failure shape is identical. */ prepareEntry(name: string, config: PoolableMcpConfig): PreparedEntry; commitEntry(name: string, _prepared: PreparedEntry): void; register(name: string, config: PoolableMcpConfig): void; ready(_name: string): Promise; listTools(_name: string): Promise; callTool(name: string, toolName: string, _args: { readonly [key: string]: unknown; }): Promise<{ readonly [key: string]: unknown; }>; resolveMcpForTool(_toolNameOrPrefixed: string, _opts?: { readonly isBridgeable?: (mcpName: string) => boolean; }): { readonly mcpName: string; readonly toolName: string; } | undefined; removeAndClose(_name: string): void; waitForCatalogsToSettle(_timeoutMs?: number): Promise; dispose(): Promise; _hasEntry(_name: string): boolean; } //# sourceMappingURL=McpClientPool.browser.d.ts.map