feat(mcp): Support stateless SDK v2 handlers#1165
Open
sentry-junior[bot] wants to merge 6 commits into
Open
Conversation
Co-Authored-By: OpenAI Codex <noreply@openai.com> Co-Authored-By: David Cramer <david@sentry.io>
Co-Authored-By: OpenAI Codex <codex@openai.com> Co-Authored-By: David Cramer <david@sentry.io>
dcramer
marked this pull request as ready for review
July 17, 2026 23:58
Co-Authored-By: OpenAI Codex <codex@openai.com> Co-Authored-By: David Cramer <david@sentry.io>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com> Co-Authored-By: David Cramer <david@sentry.io>
Co-Authored-By: OpenAI Codex <noreply@openai.com> Co-Authored-By: David Cramer <david@sentry.io>
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.
Upgrade the hosted MCP endpoint to Cloudflare Agents' new stateless SDK v2 handler while preserving the existing SDK v1 server path for stdio and other consumers.
Dual SDK server construction
buildServernow defaults to the existing@modelcontextprotocol/sdkv1 server and can explicitly construct an@modelcontextprotocol/serverv2 server for draft-protocol handlers. The Cloudflare endpoint passes a server factory tocreateMcpHandler, giving every request a fresh server instance as required by the new handler contract.Pinned beta dependency set
Pins
agents@canva,@modelcontextprotocol/server@2.0.0-beta.4, and@modelcontextprotocol/sdk@1.29.0. Supporting React and AI SDK peers are updated to versions accepted by the canva build. The endpoint also restricts browser Origins to its serving hostname.The v2 SDK and draft MCP protocol remain beta; these pins should be revisited when Cloudflare publishes the stable Agents release.
Requested by David Cramer via Junior.
--
View Junior Session