feat(client): validate safe integer range for x-mcp-header parameters (#445) - #499
Open
Yudis-bit wants to merge 1 commit into
Open
feat(client): validate safe integer range for x-mcp-header parameters (#445)#499Yudis-bit wants to merge 1 commit into
Yudis-bit wants to merge 1 commit into
Conversation
…modelcontextprotocol#445) Per the Streamable HTTP specification (SEP-2243) and server/tools.mdx: 'Integer values MUST be within the safe range for integers represented using IEEE754 double-precision floating point numbers (−2^53+1 to 2^53−1)' Previously, the conformance harness had no requirement row in sep-2243.yaml, no emitted check ID, and no verification that clients refrain from mirroring out-of-range integer values into Mcp-Param headers. 1. Add sep-2243-x-mcp-header-integer-safe-range to src/seps/sep-2243.yaml and CUSTOM_HEADERS_DECLARED_CHECK_IDS in http-custom-headers.ts. 2. Add an annotated integer parameter unsafe_integer_val to test_custom_headers with context argument 9007199254740992 (2^53). 3. In HttpCustomHeadersScenario.handleToolsCall, verify that the client does not mirror unsafe integer arguments into Mcp-Param-UnsafeInteger. 4. Add positive and negative unit test assertions in http-custom-headers.test.ts. 5. Update traceability.json for SEP-2243. Closes modelcontextprotocol#445
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.
Closes #445.
What
Per the Streamable HTTP specification (SEP-2243) and
server/tools.mdx:Previously, this requirement was completely uncovered in the conformance test harness:
src/seps/sep-2243.yaml(the list stopped atprimitive-only).src/scenarios/client/http-custom-headers.ts.2**53 = 9007199254740992).Mcp-Param-*headers passed the conformance suite with zero indication.Changes
src/seps/sep-2243.yaml:src/scenarios/client/http-custom-headers.ts:'sep-2243-x-mcp-header-integer-safe-range'toCUSTOM_HEADERS_DECLARED_CHECK_IDS.unsafe_integer_valwithx-mcp-header: 'UnsafeInteger'to thetest_custom_headerstool definition.unsafe_integer_val: 9007199254740992(2**53) inurls.context.toolCalls[0].arguments.handleToolsCall, verified that the client does not mirror out-of-range integer arguments intoMcp-Param-UnsafeInteger, emittingSUCCESSwhen omitted andFAILUREwhen mirrored.src/scenarios/client/http-custom-headers.test.ts:FAILs safe-integer-range when a client mirrors an out-of-range integer header.PASSes safe-integer-range when a client omits the out-of-range integer header.unsafe_integer_valand verify that all declared requirement IDs inCUSTOM_HEADERS_DECLARED_CHECK_IDSpass on conforming tool calls.src/seps/traceability.json:tested: 19).Validation
npm run check:typecheck(tsgo --noEmit) andlint(eslint&prettier) pass cleanly with 0 errors, 0 warnings.npm run build: buildsdist/index.jscleanly with 0 errors.npm test: all 45 test files, 589 tests pass across the suite.AI assistance disclosure: Generated with Antigravity agent in pair-programming session following maintainer instructions on issue #445 with minimal reproducible test coverage.