Skip to content

fix(protocol): align HTTP headers with the negotiated MCP version - #115

Open
galatanovidiu wants to merge 1 commit into
trunkfrom
fix/negotiated-protocol-version
Open

galatanovidiu wants to merge 1 commit into
trunkfrom
fix/negotiated-protocol-version

Conversation

@galatanovidiu

Copy link
Copy Markdown
Contributor

The proxy forwarded the client's initialization version but always sent MCP-Protocol-Version: 2025-06-18. When WordPress negotiated 2025-11-25, subsequent HTTP requests still advertised the older revision.

Use the offered version for initialization headers and the negotiated WordPress version for subsequent requests. Default to 2025-11-25, preserve supported older client versions, and pin the supported revisions independently of SDK upgrades: newer or unknown client revisions offer 2025-11-25, while unsupported backend revisions are rejected. This does not add support for a 2026 revision.

Custom headers cannot override the protocol header, regardless of casing. Preserve the existing 2025-06-18 fallback when the backend omits its version. Session refresh reuses the initialization offer and requires the backend to keep the negotiated version; a version change requires reconnecting the client.

Validation:

  • npm run check — passed formatting and TypeScript checks.
  • npx jest tests/unit/ tests/integration/ --no-coverage — all 234 tests across 15 suites passed. Added coverage for JSON-RPC and simple transport headers, older-server negotiation, unknown client revisions, unsupported backend revisions, missing-version fallback, custom-header precedence, and session refresh.
  • npm run build — passed; generated the 2.43 MB proxy bundle.

No package version bump or release is included.

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