Skip to content

fix: reject initialize protocol version mismatch#964

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/reject-init-version-mismatch
Open

fix: reject initialize protocol version mismatch#964
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/reject-init-version-mismatch

Conversation

@he-yufeng
Copy link
Copy Markdown

Fixes #963.

This rejects an initial Streamable HTTP initialize request when the Mcp-Protocol-Version header is present and disagrees with the JSON-RPC protocolVersion in the body. The response uses the same header mismatch error path as the newer MCP header checks.

To verify:

  • go test ./mcp -run TestStreamableServerTransport -count=1
  • go test ./mcp -count=1
  • go test ./... -count=1

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.

Streamable HTTP server accepts mismatched MCP-Protocol-Version header and body protocolVersion on initialize

1 participant