feat: MCP v2 (draft) (decomposed by #4475) - #4452
Conversation
|
Two things landed after this PR was last updated (2026-07-07) that move the roadmap forward. 1. v2 is stable. 2. The last roadmap box — "enabling Modern stateless MCP will need maintainers support" — may be a smaller decision than it reads. I migrated a published stdio server end to end this week, and the thing that surprised me is that the installed SDK version does not select the era. The entry point does. The v2 migration guide says it outright: "Nothing in v2 puts a 2026-07-28 byte on the wire by default." A The whole change is at the entry point: // 2025 era only, whatever the installed SDK version is
const server = new Server(/* ... */);
await server.connect(new StdioServerTransport());
// both eras; era pinned per connection from the opening message
serveStdio(() => buildServer(), { legacy: 'serve' });
Measured on a real published package with raw JSON-RPC frames, deliberately not the client SDK, so the evidence does not depend on the library under test. One process per arm, because the era is pinned per connection and you cannot exercise two eras down one pipe:
Row 2 is not a regression, and this is the part I would flag for whoever writes the test expectations in #4475: the spec classifies a message carrying no version claim in One side effect that may matter for reference servers specifically: dropping the monolithic v1 SDK took that package from 117 production dependencies to 26, because the v1 bundle pulls an HTTP and OAuth stack into a server that only speaks stdio. Probe script, if it is useful for the decomposition's test expectations: https://github.com/igorsaevets/page2ai-mcp/blob/main/scripts/probe-protocol.mjs — Happy to pick up one of the scoped sub-issues once #4475 is decomposed, if that is useful. |
Don' merge this, decompose it into individual, testable issues via #4475
Migrate the TypeScript reference servers (
everything,filesystem,sequentialthinking) to the v2 MCP TypeScript SDK.Note
Do not merge this. Goal of PR is to remain open and be updated through
beta,stable. SeeRoadmapsection below.Roadmap
alphadraftbeta(legacy era MCP on modern interfaces)stable- backwards compatible with legacy era MCP clients; enabling Modern stateless MCP will need maintainers supportDescription
Migrates the TypeScript reference servers —
everything,filesystem, andsequentialthinking— from the v1 monolithic SDK (@modelcontextprotocol/sdk@^1.29.0) to the v2 scoped packages (@modelcontextprotocol/server,@modelcontextprotocol/node,@modelcontextprotocol/core;2.0.0-alpha.3). The Python servers are untouched.The bulk of the migration was produced automatically by the SDK's
v1-to-v2codemod, then finished by hand for the cases the codemod flags as manual.What the migration covers:
@modelcontextprotocol/sdk/*→ the scoped v2 packages;StreamableHTTPServerTransport→NodeStreamableHTTPServerTransport(from@modelcontextprotocol/node)..tool()/.prompt()/.resource()→.registerTool()/.registerPrompt()/.registerResource()with config objects andz.object(...)(Standard Schema) input schemas.extraparameter → the nested v2ctx(ctx.mcpReq.send,ctx.mcpReq.id,ctx.mcpReq._meta,ctx.sessionId,ctx.http?.authInfo, …).everythingsuites reshaped from the flat v1 shape ({ sendRequest, requestId, _meta }) to the v2 nested shape ({ mcpReq: { send, id, _meta } }).All three transports — stdio, SSE, and Streamable HTTP — are retained (SSE via a legacy-transport dependency).
Server Details
everything(primary),filesystem,sequentialthinkingMotivation and Context
v2 is a redesign of the TypeScript SDK: scoped, runtime-neutral packages (
client/server/core), a restructured request-handler context, Standard-Schema tool inputs, and consolidated error types. Migrating the reference servers keeps them building against the shipping API, exercises the v2 surface end-to-end, and validates the automatedv1-to-v2codemod against a real, non-trivial codebase.How Has This Been Tested?
npm test(vitest) passes for every migrated server — 266 tests green total:everything— 5 files / 105 tests (tools 59, plus prompts, resources, registrations, server)filesystem— 7 files / 147 testssequentialthinking— 1 file / 14 teststsc) and build pass.Breaking Changes
No client-facing configuration change: the servers launch the same way (
stdio|sse|streamableHttp) and expose the same tools / resources / prompts. The requirements inherited from SDK v2 are Node.js ≥ 20 (v1's Node 18 support is dropped) and ESM-only. Anyone importing a server as a library must move to the v2 package names.Types of changes
AGENTS.md/docs/*refreshed for v2)Checklist
docs/*andAGENTS.mdwere updated)prettier/lint over the migrated output before submitting — codemod output can need formatting cleanup)Additional context
src/everything/__tests__/*and the transport wiring undersrc/everything/transports/*.