Skip to content

fix: align protocol version negotiation#855

Merged
alexhancock merged 2 commits into
mainfrom
fix-version-negotiation
May 18, 2026
Merged

fix: align protocol version negotiation#855
alexhancock merged 2 commits into
mainfrom
fix-version-negotiation

Conversation

@DaleSeo
Copy link
Copy Markdown
Member

@DaleSeo DaleSeo commented May 18, 2026

Fixes #852

Motivation and Context

The Rust SDK always responds with 2024-11-05, no matter what protocol version the client requests in the initialize body. The cross-SDK comparison in spec issue modelcontextprotocol/modelcontextprotocol#2721 shows that Rust is one of only two SDKs that ignore the body.

This PR fix the protocol negotiation logic so that the server echoes the client-requested version when it's known. Otherwise, it returns the server-configured protocol_version as a fallback (this is the value set by with_protocol_version, which defaults to LATEST).

How Has This Been Tested?

Add integration tests

Breaking Changes

None. The dead UnsupportedProtocolVersion variant is marked #[deprecated].

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@DaleSeo DaleSeo self-assigned this May 18, 2026
@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-service Service layer changes labels May 18, 2026
@DaleSeo DaleSeo force-pushed the fix-version-negotiation branch from 320ddfb to ae30772 Compare May 18, 2026 02:40
@DaleSeo DaleSeo changed the title fix: align protocol version negotiation feat: align protocol version negotiation May 18, 2026
@github-actions github-actions Bot added T-CI Changes to CI/CD workflows and configuration T-config Configuration file changes labels May 18, 2026
@DaleSeo DaleSeo force-pushed the fix-version-negotiation branch from 68f71c6 to 13d2dd7 Compare May 18, 2026 03:07
Comment thread .github/workflows/ci.yml
cargo semver-checks \
--package rmcp \
--baseline-rev ${{ github.event.pull_request.base.sha }} \
--release-type minor \
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the CI fails completely on any non-patch change. With it, release-plz still determines the actual version bump, but the CI gate now only catches major bumps with breaking regressions. Minor additions, like this deprecation, are allowed.

@DaleSeo DaleSeo marked this pull request as ready for review May 18, 2026 03:08
@DaleSeo DaleSeo requested a review from a team as a code owner May 18, 2026 03:08
@DaleSeo DaleSeo changed the title feat: align protocol version negotiation fix: align protocol version negotiation May 18, 2026
@alexhancock alexhancock merged commit d328751 into main May 18, 2026
18 checks passed
@alexhancock alexhancock deleted the fix-version-negotiation branch May 18, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-CI Changes to CI/CD workflows and configuration T-config Configuration file changes T-core Core library changes T-service Service layer changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamable HTTP server accepts mismatched header/body protocol versions and negotiates 2024-11-05 on initialize

2 participants