Repository navigation
Serve the application MCP server with the official MCP SDK (#846, HTTP) - #852
Merged
Merged
Conversation
… stage 2) packages/mcp now answers each request with @modelcontextprotocol/server's stateless Streamable HTTP handler, built per request around the declared tools, resources and prompts. The SDK owns JSON-RPC parsing, version negotiation, notifications and error codes; the extension keeps Origin admission, the declared argument/output schema checks, trusted handler calls, the generic failure messages and onToolCall/onToolError. Removed with no compatibility layer (#841): Mcp-Session-Id sessions, the GET stream and Last-Event-ID replay (sessions.ts), list pagination, and the streaming object options. `streaming` is a boolean that passes SSE replies through as produced, so progress precedes the result; it now also serves on vercel. packages/mcp/src: 1,058 -> 556 lines. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem and change
Second stage of #846: the application MCP server (
packages/mcp) now uses the official SDK, like the authoring server since #850. Each HTTP request to a mount is answered bycreateMcpHandlerfrom@modelcontextprotocol/server2.1.0. It wraps a fresh SDKServerwhosetools/*,resources/*andprompts/*handlers carry the declared behaviour.The SDK owns: JSON-RPC over Streamable HTTP,
initializenegotiation (currently 2025-11-25 back to 2024-11-05), theMCP-Protocol-Versionheader, notifications, request ids and error codes.The extension keeps:
request.body.schemachecks for tool arguments, tool output and prompt arguments;McpToolErrorsemantics;onToolCall/onToolError;Request/Response, which streams the response when it's SSE andstreamingis on.Owned source:
packages/mcp/srcgoes from 1,058 to 556 lines (−502, −47%).sessions.ts(273 lines) is deleted, along with the envelope parser, negotiation, pagination and session branches inmcp.ts.Behaviour changes (no compatibility kept, per #841)
Mcp-Session-Id, no server-initiated GET stream, noLast-Event-IDreplay; GET and DELETE answer 405. Anotifications/cancelledcan't reach another request's call; a client disconnect still abortscontext.signal.streamingis a boolean.maxSessionsand the rest) are gone.progressdoes nothing.Accept: application/json, text/event-stream, or get 406, as the spec requires.isErrorresult under every revision, not-32602for older ones.-32602(the SDK follows the current spec), not-32002.context.signal; tool handlers always getprogress.Verification
packages/mcp/test/sdk-client.test.tsuses the official@modelcontextprotocol/clientover Streamable HTTP against a served site, with streaming off and on. It covers:structuredContent, a schema-failing call returningisError, an unknown tool returning a protocol error;readResourceandgetPrompt, including missing prompt arguments;onprogressreceiving 1, 2, 3 before the result.streaming.test.tsis rewritten for the stateless model:mcp.test.tsandcontext.test.ts:Acceptheader and read the SSE reply;-32602tests are replaced;npm run verifyexits 0, including core 1,100/1,100, every workspace suite,test:addonsandtest:proof.npm run test:packagepasses.docs/EXTENSIONS.md,docs/FRAMEWORK.md,docs/OPERATIONS.md, regeneratedurlcode.jsonand field reference.Compatibility and security
Breaking for MCP clients of an application server, as listed above. There's no YAML schema change, and project declarations are unchanged.
Authority is unchanged: handlers are still trusted operator-reviewed project code, and mounts are protected by a principal-providing extension as before. Removing sessions removes a bearer-like session id and its memory-bounded table.
New runtime dependency for the add-on:
@modelcontextprotocol/server2.1.0 (MIT; plus@modelcontextprotocol/coreandzod), the same versions core already pins.Changes match the documented portable contract; docs/examples are updated where needed.
Relevant tests and package checks pass, or limitations are explained above.
No credentials, customer data or private project material are included.
Runtime/starter changes remain aligned where applicable.
🤖 Generated with Claude Code