Skip to content

fix: enforce MCP parameter header requirements - #126

Open
lucarlig wants to merge 2 commits into
mainfrom
user/luca/allow-missing-tool-schemas
Open

fix: enforce MCP parameter header requirements#126
lucarlig wants to merge 2 commits into
mainfrom
user/luca/allow-missing-tool-schemas

Conversation

@lucarlig

@lucarlig lucarlig commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • allow tool_schemas to be omitted and validate parameter headers only when the control plane publishes the called tool's input schema
  • validate the MCP 2026-07-28 x-mcp-header contract: token syntax, case-insensitive uniqueness, primitive types, properties-only nested paths, exact value extraction, null/absence behavior, safe integers, numeric comparison, Base64 decoding, unsafe plain values, and repeated headers
  • forward unrecognized Mcp-Param-* headers unchanged when no matching annotation is published
  • update focused integration/unit coverage, the generated user-config schema, and hot-path wiki documentation

Behavior

Published annotation Argument Header Result
no any absent or present no local validation; forward present headers
yes absent or null absent allow
yes absent or null present HeaderMismatch (-32020)
yes present and non-null absent HeaderMismatch (-32020)
yes present and non-null present decode and validate against the exact argument path

Malformed annotations invalidate validation for the tool call. Malformed, conflicting, or mismatched recognized header values fail closed before the backend is called.

RMCP dependency

The dataplane returns the required HeaderMismatch JSON-RPC error. The required HTTP 400 mapping is tracked by upstream RMCP PR modelcontextprotocol/rust-sdk#1226; this PR intentionally does not duplicate or vendor that transport fix.

Validation

  • rebased onto main at 29a2a81
  • cargo fmt --all -- --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • cargo nextest run --locked --workspace (229 passed, 11 skipped)
  • cargo build --locked --workspace
  • cargo deny check advisories licenses (passed; existing transitive yanked chacha20 0.10.1 warning through rmcp)
  • cargo shear --check-test-targets --deny-warnings --locked
  • mdbook build _context/wiki
  • mdbook test _context/wiki

@lucarlig lucarlig changed the title fix: allow calls without published tool schemas fix: enforce MCP parameter header requirements Sep 1, 2026
@lucarlig
lucarlig marked this pull request as ready for review September 1, 2026 12:01
@lucarlig
lucarlig requested a review from cafalchio September 1, 2026 12:02
@lucarlig lucarlig self-assigned this Sep 1, 2026
@lucarlig lucarlig closed this Sep 1, 2026
@lucarlig lucarlig reopened this Sep 1, 2026
@lucarlig
lucarlig force-pushed the user/luca/allow-missing-tool-schemas branch from dcb5b03 to 20fc11c Compare September 1, 2026 12:40
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig force-pushed the user/luca/allow-missing-tool-schemas branch from 20fc11c to 9e0c3a6 Compare September 2, 2026 13:26
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.

1 participant