fix(sep-2243): reject x-mcp-header on number-typed params (#444)

SEP-2243 permits `x-mcp-header` only on integer, string and boolean
parameters — "Parameters with type `number` are not permitted" — but the
harness never verified the `number` case and its requirement text still
described `number` as permitted.

PR #371 fixed the positive `http-custom-headers` fixture (priority is now
`integer`, `float_val` is served unannotated) but left the two remaining
items from #344:

- `HttpInvalidToolHeadersScenario` serves invalid tools for every other
  x-mcp-header constraint but had no number-typed case, so nothing checked
  that a client excludes such a tool.
- `sep-2243.yaml` claimed primitive types are "(number, string, or
  boolean)" and that "number values" get decimal-string encoding, both of
  which contradict the released 2026-07-28 spec.

Add an `invalid_number_header` tool mapped to the existing
`sep-2243-x-mcp-header-primitive-only` requirement (no new check IDs) and
correct both requirement texts. traceability.json is updated in place
since it embeds the yaml text verbatim; check IDs and statuses are
unchanged.

Verified against typescript-sdk@main: the new check fails there because
the SDK deliberately allow-lists `number` to satisfy the old fixture — a
workaround its own source notes as "tracked upstream" and can now drop.
The positive scenario still passes 18/18.

Closes #344

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Stephen Halter 2026-09-06 13:23:38 -07:00 • committed by GitHub
commit 3507f94150
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,13 +23,13 @@ requirements:
text: 'The x-mcp-header value MUST be case-insensitively unique within a single tool definition.'
url: https://modelcontextprotocol.io/specification/draft/server/tools#custom-headers
- check: sep-2243-x-mcp-header-primitive-only
text: 'x-mcp-header MUST only be applied to parameters with primitive types (number, string, or boolean).'
text: 'x-mcp-header MUST only be applied to parameters with primitive types (integer, string, boolean). Parameters with type `number` are not permitted.'
url: https://modelcontextprotocol.io/specification/draft/server/tools#custom-headers
- check: sep-2243-client-reject-invalid-tool
text: 'Clients MUST reject tool definitions where any x-mcp-header value violates these constraints. Rejection means the client MUST exclude the invalid tool from the set of tools returned by tools/list.'
url: https://modelcontextprotocol.io/specification/draft/server/tools#custom-headers
- check: sep-2243-client-encode-values
text: 'Clients MUST encode parameter values before including them in HTTP headers: number values MUST be converted to their decimal string representation; boolean values MUST be converted to the lowercase strings "true" or "false".'
text: 'Clients MUST encode parameter values before including them in HTTP headers: integer values MUST be converted to their decimal string representation; boolean values MUST be converted to the lowercase strings "true" or "false".'
- check: sep-2243-client-base64-unsafe
text: 'When a value cannot be safely represented as plain ASCII (e.g., contains non-ASCII characters, control characters, or leading/trailing whitespace), clients MUST use Base64 encoding of the UTF-8 representation, wrapped as =?base64?{encoded}?=.'
- check: sep-2243-server-decode-base64