feat: MCP v2 (draft)#4452
Open
KKonstantinov wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/*.