UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

44 lines • 3.01 kB
/** * Lazy boundary for `@modelcontextprotocol/sdk`. * * The SDK is 210 files / ~1.16 MB and every CLI start used to parse, compile * and evaluate all of it, because the mcp builtin is statically reachable from * the builtin barrel. Nothing in the SDK is needed until a run actually * connects a transport, builds a client, registers a request handler or drives * the OAuth flow — all of which happen inside already-async code paths — so * each SDK submodule loads on first use instead of at process start. * * Follows the repository's documented lazy-boundary pattern * (`packages/ai/src/api/*.lazy.ts`, `webfetch/webfetch/content.lazy.ts`); * `test/suite/regressions/1781-lazy-mcp-sdk.test.ts` fails if a static edge to * the SDK reappears in `dist/main.js`. */ /** `Client` — the MCP client class, built once per transport connection. */ export declare const loadMcpSdkClient: () => Promise<typeof import("@modelcontextprotocol/sdk/client/index.js")>; /** Compatibility parser for final caller schemas at the modern request boundary. */ export declare const loadMcpSdkZodCompat: () => Promise<typeof import("@modelcontextprotocol/sdk/server/zod-compat.js")>; /** `StdioClientTransport` + `getDefaultEnvironment` — stdio servers and the stdio diagnostic rerun. */ export declare const loadMcpSdkStdioTransport: () => Promise<typeof import("@modelcontextprotocol/sdk/client/stdio.js")>; /** SDK-owned protocol schemas for elicitation and modern request results. */ export declare const loadMcpSdkTypes: () => Promise<typeof import("@modelcontextprotocol/sdk/types.js")>; /** SDK-owned request defaults, loaded only by negotiated modern operations. */ export declare const loadMcpSdkProtocol: () => Promise<typeof import("@modelcontextprotocol/sdk/shared/protocol.js")>; /** OAuth 2.1 discovery, authorization, token exchange and refresh. */ export declare const loadMcpSdkAuth: () => Promise<typeof import("@modelcontextprotocol/sdk/client/auth.js")>; /** * `StreamableHTTPClientTransport`. Loading it also seats the auth module: the * HTTP transport is the only transport that raises the SDK's * `UnauthorizedError`, and {@link isMcpSdkUnauthorizedError} can only recognize * an instance once the class that produced it is cached here. `auth.js` is * already part of `streamableHttp.js`'s own static graph, so this is free. */ export declare const loadMcpSdkStreamableHttpTransport: () => Promise<typeof import("@modelcontextprotocol/sdk/client/streamableHttp.js")>; /** * Whether `error` is the SDK's `UnauthorizedError` (the signal that a server * needs OAuth). Synchronous on purpose — every caller is a plain error * predicate — and exact: an instance can only exist once `auth.js` has been * evaluated, and every path that can produce one awaits a loader above first. * The class carries no distinguishing `name`, so identity is the only check. */ export declare function isMcpSdkUnauthorizedError(error: unknown): boolean; //# sourceMappingURL=sdk.lazy.d.ts.map