Stack: SDK V2 + New Spec — 1 of 10 (foundation; do this first).
Migrate the codebase from @modelcontextprotocol/sdk@1.29 to SDK v2, keeping behavior identical against today's (legacy) servers. This is the behavior-neutral base that unblocks every other card in the stack: we're using SDK v2 underneath, with versionNegotiation: 'legacy' so nothing 2026-era goes on the wire yet.
Scope
- Package split:
@modelcontextprotocol/sdk → @modelcontextprotocol/client (Client, transports, OAuth) + @modelcontextprotocol/core (public Zod schemas); stdio transport moves to @modelcontextprotocol/client/stdio (root barrel stays browser-safe). WebSocketClientTransport is removed.
- Run the codemod (
npx @modelcontextprotocol/codemod@beta v1-to-v2 .) per client, then hand-fix the rest.
- Zod 3 → 4 (
^4.2.0).
- Handlers take method strings, not schemas:
client.setRequestHandler('elicitation/create', …). Spec methods drop result schemas from request()/callTool(); the raw "send request" path must pass an explicit ResultSchema from core.
- Error taxonomy rename:
McpError → ProtocolError; new SdkError (string codes: RequestTimeout, ConnectionClosed, EraNegotiationFailed, …); StreamableHTTPError → SdkHttpError (.status). Unknown-tool calls now reject with -32602 instead of resolving isError: true.
- Elicitation
mode discriminant: branch on params.mode === 'url' vs. form; ElicitResult.content values strictly string | number | boolean | string[].
Protocol base class no longer exported; use client.fallbackRequestHandler for arbitrary inbound requests.
- Tasks note: requestor tasks currently ride
client.experimental.tasks.* (inspectorClient.ts:listRequestorTasks). That surface changes under v2 — keep legacy tasks working here; the modern redesign is card 8.
- Set
versionNegotiation: { mode: 'legacy' } explicitly so this card changes no wire behavior.
Key files
core/mcp/inspectorClient.ts, core/mcp/remote/**, core/auth/**, clients/web|cli|tui/package.json, everywhere importing @modelcontextprotocol/sdk/*.
Acceptance
- All three clients behave exactly as today against existing legacy servers.
npm run ci green (format, lint, build, per-file ≥90 coverage, smoke, storybook).
Ref: specification/v2_new_spec_impact.md §8.1, §9.5(1).
Stack: SDK V2 + New Spec — 1 of 10 (foundation; do this first).
Migrate the codebase from
@modelcontextprotocol/sdk@1.29to SDK v2, keeping behavior identical against today's (legacy) servers. This is the behavior-neutral base that unblocks every other card in the stack: we're using SDK v2 underneath, withversionNegotiation: 'legacy'so nothing 2026-era goes on the wire yet.Scope
@modelcontextprotocol/sdk→@modelcontextprotocol/client(Client, transports, OAuth) +@modelcontextprotocol/core(public Zod schemas); stdio transport moves to@modelcontextprotocol/client/stdio(root barrel stays browser-safe).WebSocketClientTransportis removed.npx @modelcontextprotocol/codemod@beta v1-to-v2 .) per client, then hand-fix the rest.^4.2.0).client.setRequestHandler('elicitation/create', …). Spec methods drop result schemas fromrequest()/callTool(); the raw "send request" path must pass an explicitResultSchemafrom core.McpError→ProtocolError; newSdkError(string codes:RequestTimeout,ConnectionClosed,EraNegotiationFailed, …);StreamableHTTPError→SdkHttpError(.status). Unknown-tool calls now reject with-32602instead of resolvingisError: true.modediscriminant: branch onparams.mode === 'url'vs. form;ElicitResult.contentvalues strictlystring | number | boolean | string[].Protocolbase class no longer exported; useclient.fallbackRequestHandlerfor arbitrary inbound requests.client.experimental.tasks.*(inspectorClient.ts:listRequestorTasks). That surface changes under v2 — keep legacy tasks working here; the modern redesign is card 8.versionNegotiation: { mode: 'legacy' }explicitly so this card changes no wire behavior.Key files
core/mcp/inspectorClient.ts,core/mcp/remote/**,core/auth/**,clients/web|cli|tui/package.json, everywhere importing@modelcontextprotocol/sdk/*.Acceptance
npm run cigreen (format, lint, build, per-file ≥90 coverage, smoke, storybook).Ref:
specification/v2_new_spec_impact.md§8.1, §9.5(1).