Skip to content

fix: Correctly propose protocol version vs. error#60

Merged
jpmcb merged 1 commit intomainfrom
fixup-server-protocol-err
Dec 29, 2025
Merged

fix: Correctly propose protocol version vs. error#60
jpmcb merged 1 commit intomainfrom
fixup-server-protocol-err

Conversation

@jpmcb
Copy link
Contributor

@jpmcb jpmcb commented Dec 29, 2025

Related to: modelcontextprotocol/inspector#959

Don't send an error if the protocol version is too high. Instead, attempt to propose an aligned version.

Copilot AI review requested due to automatic review settings December 29, 2025 14:48
@jpmcb jpmcb requested review from franz-zuplo and removed request for Copilot December 29, 2025 14:49
Copy link
Contributor

@franz-zuplo franz-zuplo left a comment

Choose a reason for hiding this comment

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

One nit on docs but LGTM otherwise

@jpmcb jpmcb force-pushed the fixup-server-protocol-err branch from d3ab467 to 060182e Compare December 29, 2025 15:47
Copilot AI review requested due to automatic review settings December 29, 2025 15:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes protocol version negotiation to align with the MCP specification. Instead of returning an error when a client requests an unsupported protocol version, the server now attempts to negotiate by proposing the highest protocol version it supports.

  • Removed the switch statement that returned errors for unsupported versions
  • Implemented simple version negotiation logic that returns the requested version if supported, otherwise returns LATEST_PROTOCOL_VERSION
  • Updated test expectations to verify successful negotiation instead of error responses

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/server/index.ts Replaced switch-case error handling with version negotiation logic that proposes LATEST_PROTOCOL_VERSION for unsupported versions
src/server/initialization.test.ts Updated test case to verify successful version negotiation instead of error response when client requests unsupported protocol version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Signed-off-by: John McBride <john@zuplo.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jpmcb jpmcb merged commit 1ff6da0 into main Dec 29, 2025
10 checks passed
@jpmcb jpmcb deleted the fixup-server-protocol-err branch December 29, 2025 19:17
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.

2 participants