Is your feature request related to a problem? Please describe.
ClientSessionOptions.protocolVersion is unexported and documented as test-only (mcp/client.go:251):
type ClientSessionOptions struct {
// protocolVersion overrides the protocol version sent in the initialize
// request, for testing. If empty, latestProtocolVersion is used.
protocolVersion string
}
So Client.Connect always requests latestProtocolVersion (mcp/client.go:313) and there is no public way for a consumer to request a specific revision. The SDK's own tests can, via the unexported field; external code cannot.
Describe the solution you'd like
Export it, or add an equivalent public option — e.g. ClientSessionOptions.ProtocolVersion string, keeping empty as "use the latest" so existing behaviour is unchanged.
Negotiation semantics need not change: the requested version would still be subject to the existing negotiate-down path, so a server that cannot serve it responds as it does today.
Describe alternatives you've considered
None available. The field is unexported and Connect takes no other version input, so a consumer cannot influence the requested version at all — including by wrapping or decorating, since the value is read inside Connect.
Additional context
Two concrete motivations, both from building a compatibility shim on top of this SDK:
-
Wrapping an API that accepts a requested version. Our shim exposes an mcp-go-shaped Initialize(ctx, InitializeRequest) whose params include a ProtocolVersion. Because the SDK offers no knob, the shim can only discard it — a caller asking for 2025-11-25 silently gets 2026-07-28 requested on the wire, with no error and no warning. Being unable to either honour or meaningfully reject the request is the awkward part: the least-bad option available to us is to document that the field does nothing.
-
Deliberately pinning an older revision. A proxy that must present a specific revision to a downstream peer, or an integration test asserting behaviour against a particular revision, currently cannot express that against a real client — which is presumably why the test-only field exists in the first place.
If exporting the existing field is acceptable I am happy to send a PR.
Is your feature request related to a problem? Please describe.
ClientSessionOptions.protocolVersionis unexported and documented as test-only (mcp/client.go:251):So
Client.Connectalways requestslatestProtocolVersion(mcp/client.go:313) and there is no public way for a consumer to request a specific revision. The SDK's own tests can, via the unexported field; external code cannot.Describe the solution you'd like
Export it, or add an equivalent public option — e.g.
ClientSessionOptions.ProtocolVersion string, keeping empty as "use the latest" so existing behaviour is unchanged.Negotiation semantics need not change: the requested version would still be subject to the existing negotiate-down path, so a server that cannot serve it responds as it does today.
Describe alternatives you've considered
None available. The field is unexported and
Connecttakes no other version input, so a consumer cannot influence the requested version at all — including by wrapping or decorating, since the value is read insideConnect.Additional context
Two concrete motivations, both from building a compatibility shim on top of this SDK:
Wrapping an API that accepts a requested version. Our shim exposes an mcp-go-shaped
Initialize(ctx, InitializeRequest)whose params include aProtocolVersion. Because the SDK offers no knob, the shim can only discard it — a caller asking for2025-11-25silently gets2026-07-28requested on the wire, with no error and no warning. Being unable to either honour or meaningfully reject the request is the awkward part: the least-bad option available to us is to document that the field does nothing.Deliberately pinning an older revision. A proxy that must present a specific revision to a downstream peer, or an integration test asserting behaviour against a particular revision, currently cannot express that against a real client — which is presumably why the test-only field exists in the first place.
If exporting the existing field is acceptable I am happy to send a PR.