Skip to content

fix(transport): accept nested x-mcp-header annotations - #1359

Merged
DaleSeo merged 3 commits into
mainfrom
DaleSeo/client-rejects-spec-valid-nested-x-mcp-header-an
Oct 16, 2026
Merged

DaleSeo merged 3 commits into
mainfrom
DaleSeo/client-rejects-spec-valid-nested-x-mcp-header-an

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Fixes #1354.

Motivation and Context

The 2026-07-28 Streamable HTTP spec allows x-mcp-header on any property you can reach from the schema root using only properties keys. rmcp only handled top-level annotations, so it dropped tools with nested annotations from tools/list and only read top-level argument values when building headers.

Now, annotations are collected along the full properties chain, with each annotation's path. The existing checks for valid tokens, primitive types, and duplicates that differ only in case apply at every level. The client reads the header value from the full path, and the server checks it there too. If part of the path is missing, the client leaves out the header.

How Has This Been Tested?

Added tests

Breaking Changes

There are no API changes, but one behavior has changed. The old code only checked properties, so it silently ignored annotations under items, composition or conditional keywords, $defs or $ref targets, and the schema root. The spec says those annotations make the tool invalid, so the client now leaves those tools out of tools/list and logs a warning.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@github-actions github-actions Bot added T-core Core library changes T-transport Transport layer changes labels Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@bolinfest is on triage rotation this week and is the reviewer for this one.

Automated classification did not run for this one, so it needs a full manual pass.

Automated triage. Labels are a first pass and the assigned maintainer has the final say.

@DaleSeo
DaleSeo marked this pull request as ready for review October 14, 2026 13:29
@DaleSeo
DaleSeo requested a review from a team as a code owner October 14, 2026 13:29
@DaleSeo
DaleSeo requested a review from bolinfest October 14, 2026 13:29
@DaleSeo DaleSeo assigned DaleSeo and unassigned bolinfest Oct 14, 2026
Comment thread crates/rmcp/src/transport/common/mcp_headers.rs
@github-actions github-actions Bot added the T-documentation Documentation improvements label Oct 15, 2026
@DaleSeo
DaleSeo force-pushed the DaleSeo/client-rejects-spec-valid-nested-x-mcp-header-an branch from 9dbff39 to b88dbf8 Compare October 15, 2026 16:42
gocamille
gocamille previously approved these changes Oct 16, 2026

@gocamille gocamille left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me, thanks @DaleSeo! I checked the new tests against main and they all fail there for the right reason. I had a minor ask for the body: the server side changes too (an inline nested annotation now gets -32020 when the header is missing), so maybe a sentence in Breaking Changes would be useful.

Comment thread crates/rmcp/src/transport/common/mcp_headers.rs Outdated
Comment thread crates/rmcp/src/transport/common/mcp_headers.rs

@gocamille gocamille left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @DaleSeo 👍

@DaleSeo
DaleSeo merged commit b7568b8 into main Oct 16, 2026
24 checks passed
@DaleSeo
DaleSeo deleted the DaleSeo/client-rejects-spec-valid-nested-x-mcp-header-an branch October 16, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-documentation Documentation improvements T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client rejects spec-valid nested x-mcp-header annotations and drops the tool

3 participants