Repository navigation
feat(client): add a maximum MCP protocol version - #1977
Coding-Professional wants to merge 2 commits into
Conversation
chrikrah
left a comment
There was a problem hiding this comment.
@Coding-Professional, this covers rules 1 to 4 of #1868 with tests, and caps resume. From my perspective it can be merged; the API call stays open on #1868.
non-blocking: both ceiling .Where filters can't fire before a revision after 2026-07-28, so removing them still passes 58. I'd keep them. Could you add a comment that the next revision needs a ceiling test?
$ dotnet test tests/ModelContextProtocol.Tests -f net10.0 --filter "FullyQualifiedName~July2026ProtocolFallbackTests" # head dd3bef4, git archive export, sdk 10.0.403
Passed: 58
$ <same, both ceiling filters removed from McpClientImpl.cs>
Passed: 58
efbf0ab to
a5b8f02
Compare
|
CI after rebasing onto upstream The focused protocol negotiation tests pass locally (58/58 on net10.0) against the rebased branch. I cannot rerun the upstream job from my contributor account. Could a maintainer please rerun the failed Ubuntu Release job? |
Summary
Add
McpClientOptions.MaximumProtocolVersionso clients can choose an upper protocol bound while accepting an older mutually supported revision. This is useful for MCP hosts and gateways that have validated a limited range of protocol revisions.Fixes #1868.
Behavior
ProtocolVersionpin before opening a transport.2026-07-28ceiling retains discovery and fallback, filtering advertised versions before selecting one.Verification
dotnet build src/ModelContextProtocol.Core/ModelContextProtocol.Core.csproj --no-restore: passed for netstandard2.0, net8.0, net9.0, and net10.0 with no warnings or errors.git diff --check: passed.dotnet format whitespace --verify-no-changes --include ...reports existing whitespace violations on untouched lines inMcpClient.Methods.csandMcpClientImpl.cs; this PR does not reformat those unrelated sections.AI assistance was used to investigate and draft this change; I reviewed the implementation and ran the tests above.