Implementation for SEP-2243 Http Standardization#1553
Open
mikekistler wants to merge 6 commits intomainfrom
Open
Implementation for SEP-2243 Http Standardization#1553mikekistler wants to merge 6 commits intomainfrom
mikekistler wants to merge 6 commits intomainfrom
Conversation
Address multiple specification compliance issues identified during review: Source fixes: - Fix tab (0x09) encoding: tabs now trigger Base64 encoding per spec - Add client-side tool schema validation: tools with invalid x-mcp-header annotations (non-object schemas, missing properties) are filtered out - Remove server empty-header early-return that skipped validation - Fix numeric precision loss: use GetRawText()/ToJsonString() instead of GetDouble()/GetValue<double>() for header value extraction - Implement proper version gating: only DRAFT-2026-v1 requires header validation on server side (client always sends headers unconditionally) - Add server-side invalid character validation for header values Test additions: - 22 new integration tests in Sep2243HeaderTests.cs covering encoding, validation, tool filtering, and end-to-end header scenarios - 4 new server conformance tests for draft version header validation - 2 new client conformance tests for tool filtering and header sending - 2 new unit tests for tab encoding behavior - 1 new theory for SupportsStandardHeaders version gating - Fix ConformanceClient to handle toolCalls array format and add prompts/list + prompts/get calls for http-standard-headers scenario Other: - Add *.lscache to .gitignore
The http-standard-headers, http-custom-headers, and http-invalid-tool-headers client scenarios and http-header-validation, http-custom-header-server-validation server scenarios require conformance package >= 0.1.16 which is not yet published to npm. Add NodeHelpers.GetConformanceVersion() that runs 'conformance --version' and NodeHelpers.IsConformanceVersionAtLeast() for runtime version checks. Tests auto-skip when the harness is too old and auto-run once the package is updated. Works with both npm-published and local file: references.
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.
Motivation and Context
Implements SEP-2243 (HTTP Standardization) (modelcontextprotocol/modelcontextprotocol#2243) for both the client and server Streamable HTTP transports. This enables network infrastructure (load balancers, proxies, gateways) to make routing and filtering decisions based on MCP request metadata without parsing the JSON-RPC body.
Fixes #1541.
Changes
Protocol & Constants
Client-side (ModelContextProtocol.Core)
Server-side (ModelContextProtocol.AspNetCore)
Tool authoring (ModelContextProtocol.Core)
Tests
Protocol Version Gating
Header validation is only enforced when the client's MCP-Protocol-Version header is >= DRAFT-2026-v1. Clients on older protocol versions are unaffected.
How Has This Been Tested?
The PR includes tests and all tests are passing. This includes conformance tests currently in PR to the conformance repo.
Breaking Changes
No breaking changes.
Types of changes
Checklist
Additional context