Skip to content

mcp: limit SSE discover supportedVersions to SSE-defined revisions - #1121

Open
arimu1 wants to merge 1 commit into
modelcontextprotocol:mainfrom
arimu1:fix/sse-supported-versions-1112
Open

mcp: limit SSE discover supportedVersions to SSE-defined revisions#1121
arimu1 wants to merge 1 commit into
modelcontextprotocol:mainfrom
arimu1:fix/sse-supported-versions-1112

Conversation

@arimu1

@arimu1 arimu1 commented Jul 30, 2026

Copy link
Copy Markdown

Summary

NewSSEHandler sessions were advertising 2026-07-28 in server/discover supportedVersions. That revision only defines stdio and Streamable HTTP, not the deprecated HTTP+SSE binding, so Modern-first clients could negotiate a revision the transport cannot honour.

Changes

  • Implement ProtocolVersionSupporter on SSEServerTransport so filterSupportedVersions excludes >= 2026-07-28 (matching the streamable transport's version gate pattern).
  • In Server.discover, only set session InitializeParams when the requested version is actually supported by the transport. Without this, a discover probe that returns only legacy versions still marked the session initialized, and the client's fallback initialize failed with duplicate "initialize" received.
  • Tests: unit coverage for filtered SSE versions, plus an end-to-end Modern client → SSE fallback-to-initialize path.

Fixes #1112

Test plan

  • go test ./...
  • go test ./mcp/ -run 'TestSSE|TestInMemory_E2E_Discover|TestStreamableStateful_AcceptsDiscover|TestStreamableHTTP_E2E_Discover|TestClientConnectDiscover'

Assistance: human-reviewed AI assistance used for implementation.

HTTP+SSE is only defined by older MCP revisions. SSEServerTransport now
implements ProtocolVersionSupporter so server/discover does not advertise
2026-07-28 (stdio + Streamable HTTP only).

Also avoid marking the session initialized from discover when the
requested version is not transport-supported, so Modern-first clients can
fall back to the legacy initialize handshake over SSE.

Fixes modelcontextprotocol#1112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSE transport advertises 2026-07-28 in server/discover, but that revision only defines stdio and Streamable HTTP

1 participant