Repository navigation
[Docs][Server] Document and test that initialize negotiates from th… - #739
Open
nbullorini wants to merge 1 commit into
Open
nbullorini wants to merge 1 commit into
nbullorini wants to merge 1 commit into
Conversation
…e body, not the version header The MCP-Protocol-Version header sent with `initialize` plays no part in negotiation and is not compared with `params.protocolVersion`. Closes modelcontextprotocol#309
nbullorini
requested review from
CodeWithKyrian,
Nyholm,
chr-hertel and
soyuka
as code owners
November 11, 2026 16:26
This branch has not been deployed
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.
On
initializethe body is authoritative: theMCP-Protocol-Versionheader plays no part in negotiation and is not compared withparams.protocolVersion. This corrects the "Protocol Version Validation" section indocs/run/http.mdand adds transport tests for both mismatch directions and a missing header, with and without sessions.Closes #309
Motivation and Context
As agreed in #309: the docs said the header check happens after the handshake, and nothing pinned down that the header has no effect on
initialize, so it could quietly regress to the originally reported behaviour.How Has This Been Tested?
New transport-level test in
StreamableHttpTransportTestcovering an older header, a newer header and no header, each with and without sessions, asserting the negotiated version in both the response and the stored session.Breaking Changes
None. No runtime behaviour changes.
Types of changes
Checklist
Additional context
The
ProtocolVersionMiddlewaredocblock repeated the same inaccurate claim thatinitializedoesn't carry the header, so it's corrected too.