Skip to content

mcp: pick the protocol version per request from MCP-Protocol-Version (DEX-79) - #39562

Merged
bobbyiliev merged 2 commits into
MaterializeInc:mainfrom
bobbyiliev:mcp-protocol-version-detect
Oct 9, 2026
Merged

bobbyiliev merged 2 commits into
MaterializeInc:mainfrom
bobbyiliev:mcp-protocol-version-detect

Conversation

@bobbyiliev

@bobbyiliev bobbyiliev commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Picks the MCP protocol version per request from the MCP-Protocol-Version header's value. Only 2026-07-28 with enable_mcp_protocol_2026_07_28 on selects the new revision, since 2025-06-18 and 2025-11-25 clients send the header too. No behavior change yet: the version is only logged, and the next PRs use it. Closes DEX-79.

Tests: a unit test for the version selection.

@bobbyiliev
bobbyiliev force-pushed the mcp-protocol-version-detect branch from eb789a0 to ac53ac0 Compare October 8, 2026 19:53
@bobbyiliev
bobbyiliev force-pushed the mcp-protocol-version-detect branch from ac53ac0 to 1dd25ea Compare October 8, 2026 21:21
@bobbyiliev
bobbyiliev marked this pull request as ready for review October 8, 2026 21:21
@bobbyiliev
bobbyiliev requested a review from a team as a code owner October 8, 2026 21:21
@bobbyiliev
bobbyiliev requested a review from jubrad October 8, 2026 21:21

@jubrad jubrad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good — 1 consideration.

written by claude on behalf of @jubrad

/// Picks the revision from the `MCP-Protocol-Version` header's value, not
/// its presence: 2025-06-18 and 2025-11-25 clients send the header too.
fn select(header: Option<&HeaderValue>, modern_enabled: bool) -> Self {
match header.and_then(|value| value.to_str().ok()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider — The transport spec (2025-06-18 onward) says an invalid or unsupported MCP-Protocol-Version MUST get a 400, but here any unknown value (and 2026-07-28 with the flag off) silently falls back to 2025-11-25, and the test pins that. Falling back is fine as a rollout choice, but a 2026-07-28 client hitting a flag-off server will then get handshake-era behaviour instead of a clear error. Is the silent fallback what the follow-up PRs intend? If so, a short note on select saying it is deliberate would help.

written by claude on behalf of @jubrad

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's on purpose. If we answered with a 400 and a 2026-07-28 error while the flag is off, dual-era clients would think we speak 2026-07-28 and stop falling back to initialize, so the SDKs in auto mode and Claude Code would break. Rejecting unknown values once the flag is on comes with the version check (DEX-80). Added a note on select.

@bobbyiliev
bobbyiliev merged commit 21affe3 into MaterializeInc:main Oct 9, 2026
82 checks passed
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.

2 participants