Repository navigation
fix(server): reject Mcp-Param values the header check cannot verify #3167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
felixweinberger
merged 2 commits into
main
from
fix/mcp-param-header-non-primitive-body
Nov 10, 2026
+69
−3
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@modelcontextprotocol/core-internal': patch | ||
| '@modelcontextprotocol/server': patch | ||
| --- | ||
|
|
||
| Reject a `tools/call` with `400` / `-32020` (`HeaderMismatch`) when a body argument declared with `x-mcp-header` is an object or array, with or without its `Mcp-Param-*` header, and when the argument is an integer outside the safe range but the header is present. Previously the header check was skipped for these values, so the call reached the tool. | ||
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 nit (optional): Release-note readers are told these calls used to reach the tool, but for most tools they were answered
200with a tool input-validation error. The last sentence of the changeset at line 6 holds only when the tool's validator accepts the value, such asz.coerce.string()given an array. Fix: state what callers see change in both cases: a call that got200with anisErrorinput-validation result, or that ran the tool under a coercing schema, now gets400/-32020.Why this was flagged
No runtime trigger; nothing fails at runtime, the reader of the published changelog is the one affected. .changeset/mcp-param-header-non-primitive-body.md:6 ends "Previously the header check was skipped for these values, so the call reached the tool." On the base branch an object or array for a declared argument skipped the header check, then
validateToolInputat packages/server/src/server/mcp.ts:370-375 threw "Input validation error: Invalid arguments for tool ...", and the catch at packages/server/src/server/mcp.ts:320 returned it as anisErrorresult with HTTP 200.executeToolHandlerat packages/server/src/server/mcp.ts:307 never ran. The tool ran only when the schema's own validator accepted the value, for example a coercing schema, or a JSON Schemaintegerfor a value outside the safe range. The instruction guards against release notes that understate a visible change: here a200tool error becomes a400protocol error for every tool, not only coercing ones.Verification: The changeset's last sentence (.changeset/mcp-param-header-non-primitive-body.md:6) reads: "Previously the header check was skipped for these values, so the call reached the tool." So the caller-visible change for the common case is 200 with an
isErrorinput-validation result becoming 400 / -32020; the tool handler never ran.Finding ID:
f-a963bbc4