Skip to content

fix: update peer info on duplicate initialize#862

Open
DaleSeo wants to merge 1 commit into
mainfrom
fix/issue-851-renegotiate-on-initialize
Open

fix: update peer info on duplicate initialize#862
DaleSeo wants to merge 1 commit into
mainfrom
fix/issue-851-renegotiate-on-initialize

Conversation

@DaleSeo
Copy link
Copy Markdown
Member

@DaleSeo DaleSeo commented May 29, 2026

Fixes #851

Motivation and Context

The Rust SDK accepted a second initialize request after the initialization phase but kept the original peer_info() without any notification. As a result, the client got a successful InitializeResult, but the server continued using outdated clientInfo, capabilities, and protocolVersion for tasks like sampling and elicitation checks. This created confusion about the post-init semantics and caused the client and server states to drift apart.

On the other hand, the TypeScript and Python SDKs both allow renegotiation and update the stored peer info. This PR makes the Rust SDK behave the same way, ensuring that the latest negotiated state always takes precedence.

How Has This Been Tested?

Added integration tests

Breaking Changes

None

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 29, 2026
@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-handler Handler implementation changes labels May 29, 2026
@DaleSeo DaleSeo marked this pull request as ready for review May 29, 2026 18:51
@DaleSeo DaleSeo requested a review from a team as a code owner May 29, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-handler Handler implementation changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server accepts duplicate initialize after initialization, while Peer<RoleServer>::peer_info() remains unchanged

1 participant