feat(sep-2243): add x-mcp-header static-reachability checks#352
Draft
pja-ant wants to merge 1 commit into
Draft
Conversation
Upstream spec PR modelcontextprotocol/modelcontextprotocol#2891 tightens the x-mcp-header placement rule: the annotation MUST only appear on properties statically reachable from the inputSchema root via a chain of `properties` keys, never through `items`, `oneOf`/`anyOf`/`allOf`/`not`, `if`/`then`/`else`, or `$ref`. It also clarifies that header values are extracted at the annotated property's exact properties-path. - http-invalid-tool-headers: serve seven new invalid tools (one per disallowed placement keyword) under new check ID `sep-2243-x-mcp-header-statically-reachable`; clients MUST reject each. - http-custom-headers: add `test_custom_headers_nested` with x-mcp-header on `properties.outer.properties.inner` and assert under new check ID `sep-2243-client-extract-nested-path` that the client sends Mcp-Param-Nested when outer.inner is present and omits it when absent. - sep-2243.yaml: add traceability rows for both new check IDs with verbatim spec text from #2891. - tests: extend the conforming-client path to call the nested tool and add negative cases for nested-header-missing and invalid_under_items-called. Claude-Session: https://claude.ai/code/session_01Gbqx5LodtAghT5fRYFxeja
commit: |
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.
Summary
Upstream spec PR modelcontextprotocol/modelcontextprotocol#2891 tightens the
x-mcp-headerplacement rule for SEP-2243: the annotation MUST only appear on properties that are statically reachable from theinputSchemaroot via a chain ofpropertieskeys. The chain MUST NOT pass throughitems,oneOf/anyOf/allOf/not,if/then/else, or$ref. It also clarifies that header values are read at the annotated property's exact properties-path, and omitted when no value is present there.This PR adds conformance coverage for both halves.
New check IDs
sep-2243-x-mcp-header-statically-reachable—http-invalid-tool-headersnow serves seven additional invalid tool definitions, each placingx-mcp-headerunder one of the disallowed keywords (items,oneOf,anyOf,allOf,not,then,$ref). Clients MUST exclude every one of them.sep-2243-client-extract-nested-path—http-custom-headersnow servestest_custom_headers_nestedwithx-mcp-headeronproperties.outer.properties.inner. The scenario asserts the client sendsMcp-Param-Nestedwhenouter.inneris present and omits it when absent.What changed
src/scenarios/client/http-custom-headers.ts— new tool fixtures, declared-ID lists,INVALID_TOOL_CONSTRAINT_IDSentries, and the nested-tool call handler.src/scenarios/client/http-custom-headers.test.ts— extends the conforming-client path to call the nested tool (present + absent), and adds negative cases for nested-header-missing andinvalid_under_itemscalled.src/seps/sep-2243.yaml— traceability rows for both new check IDs with verbatim spec text from #2891.Verification
npx tsc --noEmit— cleannpm run lint— cleannpm test— 295 passedhttps://claude.ai/code/session_01Gbqx5LodtAghT5fRYFxeja