Skip to content

Support stable MCP SDK v2 and Cloudflare stateless handlers #22878

Description

@sergical

The MCP server instrumentation supports the v2 registerTool / registerResource / registerPrompt API structurally, but our coverage is still pinned to 2.0.0-alpha.2 and the Cloudflare MCP E2E app still exercises the SDK v1, session-oriented handler path.

Cloudflare Agents 0.20.x now uses the split MCP SDK v2 packages and recommends stateless server factories passed to createMcpHandler. The modern MCP 2026-07-28 protocol also carries protocol and implementation metadata per request instead of through the legacy initialize exchange.

Current gaps

  • The Node MCP v2 E2E app uses alpha MCP packages.
  • The Cloudflare MCP E2E app uses agents@0.3.10, @modelcontextprotocol/sdk v1, and passes a server instance to createMcpHandler.
  • Modern requests do not populate mcp.protocol.version or mcp.client.* because extraction only reads legacy initialize messages.
  • Modern responses do not populate mcp.server.* because server identity moved to result _meta.
  • The modern stateless factory path is not covered end to end.

Proposed work

  • Update MCP v2 E2E coverage to exact stable @modelcontextprotocol/server, @modelcontextprotocol/client, and @modelcontextprotocol/node 2.0.0 packages.
  • Migrate the Cloudflare MCP E2E app to the Agents 0.20.x stateless factory API.
  • Extract modern protocol, client, and server metadata from the v2 request classification and result metadata.
  • Verify tool-call spans and output capture on the 2026-07-28 protocol.
  • Preserve and test legacy-compatible request behavior.

Cloudflare migration guide: https://developers.cloudflare.com/agents/model-context-protocol/guides/migrate-to-mcp-sdk-v2/

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions