fix: Correctly propose protocol version vs. error#60
Conversation
franz-zuplo
left a comment
There was a problem hiding this comment.
One nit on docs but LGTM otherwise
d3ab467 to
060182e
Compare
There was a problem hiding this comment.
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.
Signed-off-by: John McBride <john@zuplo.com>
060182e to
69509ed
Compare
There was a problem hiding this comment.
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.
Related to: modelcontextprotocol/inspector#959
Don't send an error if the protocol version is too high. Instead, attempt to propose an aligned version.