Skip to content

feat(core): auto-negotiation fallback and custom protocol array support#396

Open
anubhav756 wants to merge 1 commit into
anubhav-mcp-latestfrom
anubhav-draft-negotiation
Open

feat(core): auto-negotiation fallback and custom protocol array support#396
anubhav756 wants to merge 1 commit into
anubhav-mcp-latestfrom
anubhav-draft-negotiation

Conversation

@anubhav756

@anubhav756 anubhav756 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

This PR implements full auto-negotiation fallback support for the SDK as per SEP-2575 (Stateless MCP).

  • Protocol Negotiation: If a draft protocol fails with a -32004 error during connection initialization, the SDK correctly strips the headers and falls back chronologically.
  • Custom Protocols Array: Users can now pass an array of preferred protocols (e.g., [Protocol.MCP_v20251125, Protocol.MCP_DRAFT]) when initializing the client. The SDK will intersect these with the server's capabilities and strictly negotiate them in a newest-to-oldest order.

This PR no longer contains the dual-server integration test infrastructure, which has been extracted to a separate PR to maintain clean history.

@anubhav756 anubhav756 requested a review from a team as a code owner June 26, 2026 19:02
@anubhav756 anubhav756 force-pushed the anubhav-draft-negotiation branch 4 times, most recently from 09cce7c to 59364c1 Compare June 30, 2026 17:10
@twishabansal twishabansal added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Jul 1, 2026
@anubhav756 anubhav756 changed the title feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback feat(core): auto-negotiation fallback and custom protocol array support Jul 2, 2026
@anubhav756 anubhav756 force-pushed the anubhav-draft-negotiation branch from 991d611 to d92afc5 Compare July 2, 2026 04:49
@anubhav756 anubhav756 force-pushed the anubhav-mcp-latest branch from b2f21ed to cd5294b Compare July 3, 2026 08:16
@anubhav756 anubhav756 force-pushed the anubhav-draft-negotiation branch from d92afc5 to b213139 Compare July 3, 2026 08:20
@anubhav756 anubhav756 force-pushed the anubhav-mcp-latest branch from cd5294b to d0f4c59 Compare July 3, 2026 12:15
@anubhav756 anubhav756 force-pushed the anubhav-draft-negotiation branch from b213139 to 01fd05c Compare July 3, 2026 12:23
@anubhav756 anubhav756 force-pushed the anubhav-draft-negotiation branch from 01fd05c to a0c429f Compare July 3, 2026 22:39
@anubhav756 anubhav756 force-pushed the anubhav-mcp-latest branch from d0f4c59 to b2a948b Compare July 3, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p2 Moderately-important priority. Fix may not be included in next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants