Skip to content

mcp: export ClientSessionOptions.ProtocolVersion - #1127

Merged
guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
arimu1:feat/1113-export-protocol-version
Aug 3, 2026
Merged

mcp: export ClientSessionOptions.ProtocolVersion#1127
guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
arimu1:feat/1113-export-protocol-version

Conversation

@arimu1

@arimu1 arimu1 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

ClientSessionOptions.protocolVersion was unexported and documented as test-only, so external consumers of Client.Connect could not request a specific protocol revision.

This exports the field as ProtocolVersion with the same semantics:

  • empty → request the latest supported version (unchanged default)
  • non-empty → send that version in initialize/discover
  • existing negotiate-down path is unchanged

Usage

cs, err := client.Connect(ctx, transport, &mcp.ClientSessionOptions{
    ProtocolVersion: "2025-11-25",
})

Testing

  • go test ./mcp/ -count=1 (pass)

Fixes #1113

arimu1 and others added 2 commits August 1, 2026 12:55
Allow clients to request a specific protocol version at Connect
time. Empty continues to mean the latest supported version;
negotiation is unchanged.

Fixes modelcontextprotocol#1113
@guglielmo-san

Copy link
Copy Markdown
Contributor

This makes sense, thank you for the contribution

@guglielmo-san
guglielmo-san merged commit 1acd66e into modelcontextprotocol:main Aug 3, 2026
9 checks passed
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.

No public way for a client to request a specific protocol version

2 participants