Skip to content

Expose negotiated protocol version after MCP client initialisation #668

@JH8676

Description

@JH8676

Is your feature request related to a problem? Please describe.
I am writing a local MCP reverse proxy and using the McpClientFactory.CreateAsync() to create clients for the downstream MCP servers. The proxy must determine the highest common protocol version so the proxy can safely present itself to upstream clients as a single unified MCP server.

Currently, there is no way to retrieve the negotiated MCP protocol version from the initialization handshake that happens internally during CreateAsync()

Specifically:

  • If McpClientOptions.ProtocolVersion is set, and the server responds with a different version, the SDK throws an exception.
  • If ProtocolVersion is left null (allowing negotiation), the SDK auto-validates the version but does not expose what the server actually selected.
  • Unless I am missing something (I very easily could be). There is no property or callback to inspect the agreed version, which forces developers to re-implement the handshake logic if that want to access it.

It would be very helpful to use the SDK’s built-in negotiation logic and retrieve the selected version without duplicating code or relying on internals.

Describe the solution you'd like
Add a ProtocolVersion property to the IMcpClient interface, set once the handshake completes.This would allow consumers to easily read the negotiated version post-CreateAsync().

Alternatively, provide access to the InitializeResult from the internal handshake, or offer a lower-level hook into the initialization process.

Describe alternatives you've considered
Manually re-implementing the MCP initialize call via raw JSON-RPC just to get the version.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions