Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Jul 9, 2025

Negotiate the protocol version properly, and set the header on HTTP transports.

We follow the logic of the Typescript SDK.

  • On initialization, the client sends the latest version it can support, and accepts the version that the server returns if the client supports it. If not, the connection fails.

  • The server accepts the client's version unless it doesn't support it, in which case it replies with its latest version.

Fixes #103.

Negotiate the protocol version properly, and set the header on
HTTP transports.

We follow the logic of the Typescript SDK.

- On initialization, the client sends the latest version it can support,
  and accepts the version that the server returns if the client supports
  it. If not, the connection fails.

- The server accepts the client's version unless it doesn't support it,
  in which case it replies with its latest version.
@jba jba requested review from findleyr and samthanawalla July 9, 2025 16:56
samthanawalla
samthanawalla previously approved these changes Jul 9, 2025
findleyr
findleyr previously approved these changes Jul 10, 2025
mcp/shared.go Outdated
// It is the version that the client sends in the initialization request.
const latestProtocolVersion = "2025-06-18"

var supportedProtocolVersions = []string{latestProtocolVersion, "2025-03-26"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we also support the 2024-11 version?
If we don't say that, what will that mean for SSE usage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@jba jba merged commit c037ba5 into modelcontextprotocol:main Jul 10, 2025
3 checks passed
@jba jba mentioned this pull request Jul 14, 2025
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.

implement version negotiation

3 participants