Skip to content

Research: HTTP MCP v2 protocol migration (2026-07-28 spec) #807

Description

@yoyo-evolve

Context

The MCP specification 2026-07-28 RC (published May 29) rewrites the protocol fundamentals. The TS SDK v2.0.0-alpha.3 and Python SDK v2.0.0a3 both implement the new spec. The final spec date is July 28 — one month away. yopedia has a custom HTTP MCP implementation (src/lib/mcp-http.ts, 33 tools) that needs to migrate independently of the SDK.

Good news: Our HTTP MCP is already stateless POST-only (no sessions, no SSE, no GET endpoint). The hardest v2 changes (session removal, transport rewrite) are already done by our design. The migration is mostly additive.

What Changed in the Spec

  1. Stateless protocolinitialize/initialized removed; every request carries _meta with protocolVersion, clientInfo, clientCapabilities
  2. server/discover RPC — mandatory endpoint replacing the old handshake for capability advertisement
  3. resultType required — every response must include resultType: "complete" (or "input_required" for MRTR)
  4. HTTP headers requiredMCP-Protocol-Version, Mcp-Method, Mcp-Name on every Streamable HTTP POST
  5. CacheableResulttools/list must return ttlMs + cacheScope
  6. ping removed — health checks are transport-level
  7. Error codes renumbered — new standard codes (-32020 through -32022)

Gap Analysis (src/lib/mcp-http.ts)

Requirement Current State Work
initialize handler Present (L779) Remove or keep for v1 compat
server/discover Missing Add (~20 lines)
resultType on responses Missing Add to ok() helper (~2 lines)
_meta validation Missing Add middleware (~30 lines)
MCP-Protocol-Version header Missing Add to route handler (~10 lines)
Mcp-Method header Missing Add to route handler (~5 lines)
CacheableResult on tools/list Missing Add ttlMs/cacheScope (~5 lines)
ping handler Present (L796) Remove or ignore
Sessions / SSE Already absent ✅ None
GET endpoint Already absent ✅ None

Recommended Approach

Dual-version support: accept both v1 (initialize-based) and v2 (_meta-based) clients during transition. Detect version from presence of _meta.io.modelcontextprotocol/protocolVersion:

  • If present → v2 path (validate _meta, require headers, include resultType)
  • If absent → v1 path (existing behavior, deprecated)

This avoids breaking existing stdio MCP clients that connect via the v1 SDK while the alpha stabilizes.

Scope

  • Files: src/lib/mcp-http.ts, src/app/api/mcp/route.ts
  • Tests: src/app/api/__tests__/mcp-route.test.ts
  • Estimate: Medium (~150-200 lines of additive code + tests)

Relationship to #580

Issue #580 (MCP Server Card metadata) is a subset of this work. server/discover IS the Server Card delivery mechanism. When this issue lands, #580 can be closed as superseded.

Acceptance Criteria

  • server/discover returns supported versions, capabilities, server info, instructions
  • Responses include resultType: "complete"
  • _meta validation middleware rejects v2 requests missing required fields
  • MCP-Protocol-Version header validated against _meta value
  • Mcp-Method header parsed and validated
  • tools/list returns CacheableResult with ttlMs and cacheScope
  • v1 clients (initialize flow) still work during transition
  • Tests cover both v1 and v2 protocol flows
  • pnpm build && pnpm test passes

Blocked-By: none (custom implementation, not SDK-dependent)
Blocker-Type: none

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions