Skip to content

feat: expose protocol version negotiation to server handlers - #1247

Open
DaleSeo wants to merge 1 commit into
mainfrom
DaleSeo/negotiate-initialize
Open

feat: expose protocol version negotiation to server handlers#1247
DaleSeo wants to merge 1 commit into
mainfrom
DaleSeo/negotiate-initialize

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Sep 6, 2026

Copy link
Copy Markdown
Member

Closes #1245.

Motivation and Context

The negotiation logic lives in a pub(crate) function and in a default method generated by a macro, so an override cannot access it. Servers that override initialize for telemetry or peer registration have to duplicate the rule, which can silently get out of sync when the SDK rule changes.

This PR adds ServerHandler::negotiate_initialize, so servers that override initialize can reuse the SDK's protocol version negotiation instead of implementing it again.

How Has This Been Tested?

Add 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

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-examples Example code changes T-handler Handler implementation changes T-service Service layer changes labels Sep 6, 2026
@DaleSeo DaleSeo self-assigned this Sep 6, 2026
@DaleSeo
DaleSeo marked this pull request as ready for review September 6, 2026 09:26
@DaleSeo
DaleSeo requested a review from a team as a code owner September 6, 2026 09:26
@DaleSeo
DaleSeo force-pushed the DaleSeo/negotiate-initialize branch from 8c516c4 to 4940bc9 Compare September 6, 2026 09:30
@DaleSeo
DaleSeo force-pushed the DaleSeo/negotiate-initialize branch from 4940bc9 to ca4564a Compare September 6, 2026 10:21
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-examples Example code changes T-handler Handler implementation changes T-service Service layer changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose protocol version negotiation to servers that override ServerHandler::initialize

1 participant