Repository navigation
[P9] versions: make 2026-07-28 the client default - #361
Merged
Merged
Conversation
The release step that ROADMAP.md listed as remaining. `Client.Configuration.protocolMode` defaults to `.automatic`, so a client connects with `server/discover` at 2026-07-28 and falls back to `initialize` for older servers, and `Version.supported` lists 2026-07-28. `Version.latest` stays 2025-11-25. `StatefulHTTPServerTransport` now validates `MCP-Protocol-Version` against `Version.handshake` explicitly, so its behavior does not change with `Version.supported`. Docs, snippets and tests are updated to the new defaults. Custom validation pipelines stay on the handshake revisions too: `HTTPValidationContext` defaults `supportedProtocolVersions` to `Version.handshake` instead of the widened `Version.supported`. The guides state the cost of the new default against handshake-only servers: one extra request per connection.
- Say in the protocol versions guide and the migration guide that a server which does not answer requests sent before initialize delays an .automatic connect by up to discoveryTimeout (10 seconds by default), and that .handshake or a shorter timeout avoids the wait. - Pin the CompletionTests clients to the handshake, check that they negotiate 2025-11-25, and add a completion case with the default mode that runs at 2026-07-28, so both paths stay covered after the flip. - Run the initialize-hook rejection tests with a client in both the handshake and the default mode: a default client against a server with only an initialize hook falls back to initialize and is refused there, instead of connecting statelessly past the hook. - Name the release in VERSIONING.md, the docs index and the design note instead of "this major version".
- StatefulHTTPServerTransport validates a sessionless request against Version.handshake, the revisions it serves, instead of Version.supported, which now lists 2026-07-28. A custom validator sees the same versions as before this change, and the context no longer follows Version.supported. Test: "A stateless request is validated against the handshake revisions". - The migration guide names the calls that behave differently on a stateless connection (notifyRootsChanged(), setLoggingLevel(_:), ping(), notifications) and links the full lists in client.md and protocol_versions.md.
- The protected-pipeline snippet test builds its HTTPValidationContext with the default supported versions, the handshake revisions, instead of Version.supported, which now lists 2026-07-28. It matches what StatefulHTTPServerTransport passes to the pipeline.
- The Clients section of the protocol versions guide linked the migration guide "for opting in", but .automatic is now the default. The link points at "Clients connect at 2026-07-28" and says it explains how to keep the handshake behavior.
This was referenced Nov 25, 2026
canarik
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rel/1.0.0in order (previous: P10 (#362) · next: P11 (#360))conformance/p9-flipconformance/p10-docs(stacked: GitHub retargets this PR torel/1.0.0when the previous part merges)bd224feversions: make 2026-07-28 the client defaultc6d8750versions: review fixes7d0007fversions: second round of review fixes65423e4versions: second-pass review fixes3bc076bversions: third-pass review fixesSummary
The release step that ROADMAP.md listed as remaining.
Client.Configuration.protocolModedefaults to.automatic, so a client connects withserver/discoverat 2026-07-28 and falls back toinitializefor older servers, andVersion.supportedlists 2026-07-28.Version.lateststays 2025-11-25.StatefulHTTPServerTransportnow validatesMCP-Protocol-VersionagainstVersion.handshakeexplicitly, so its behavior does not change withVersion.supported. Docs, snippets and tests are updated to the new defaults. A review fix keeps custom validation pipelines on the handshake revisions too:HTTPValidationContextdefaultssupportedProtocolVersionstoVersion.handshakeinstead of the widenedVersion.supported. The guides state the cost of the new default against handshake-only servers: one extra request per connection.Motivation
Server.Configuration.protocolVersions); clients had to opt in withProtocolMode.automaticor.stateless("2026-07-28").Version.supporteddocumented "all protocol versions supported by this implementation" but omitted 2026-07-28.Changes
Library
Sources/MCP/Base/Versioning.swift:Version.supported = Set(handshake + stateless).Version.latestis unchanged (v2025_11_25); its doc comment now says it is the newest handshake revision, the versioninitializerequests and the defaultMCP-Protocol-Versionof session-based HTTP.Sources/MCP/Client/Client.swift:Client.Configuration.init(strict:protocolMode:logLevel:discoveryTimeout:multiRoundTrip:)defaultsprotocolModeto.automatic, andinit(from:)decodes a configuration withoutprotocolModeas.automatic;ProtocolMode.automaticis documented as the default.Sources/MCP/Base/Transports/HTTPServer/StatefulHTTPServerTransport.swift: every validation context (POST, GET, DELETE, and the sessionless context of a 2026-07-28 request, which the transport answers with -32022) passessupportedProtocolVersions: Set(Version.handshake)instead ofVersion.supported.Sources/MCP/MCP.docc/MCP.md: the client discovers a 2026-07-28 server and falls back to the handshake.Docs and snippets
CLAUDE.md:Version.supported, the.automaticdefault and the handshake test helper.docs/src/migration.src.md: two rows in the summary table (Client,Version.supported), a "Clients connect at 2026-07-28" section with themigration-handshake-clientsnippet to keep the old behavior; the opt-in snippetmigration-opt-in-clientand the "default is still.handshake" note are removed.docs/src/rough_edges.src.md: "Defaults that will change" is replaced by a "Versions" note thatVersion.latestis not the newest revision (Version.stateless[0]is).docs/src/protocol_versions.src.md,client.src.md,protocol.src.md,quick_start.src.md,troubleshooting.src.md: state.automaticas the default and the newVersion.supported; generateddocs/*.mdandREADME.mdregenerated.ROADMAP.md: "Remaining release step" removed; the revision table shows 2026-07-28 as the client default.VERSIONING.mdanddesign/design.mddescribe the new defaults and the rationale..automaticwhere it is now the default (QuickStart.swift,Protocol/Streams.swift,Protocol/Transports.swift,Protocol/Lifecycle.swift,Client/MultiRoundTrip.swift). The handshake example inProtocol/Lifecycle.swiftsets.handshakeexplicitly.Client/Client.swift:connectWithHandshakebecomesconnectWithDefaults.Guides/ProtocolVersions.swift: the comments onVersion.supportedand the mode constants follow the new default.Tests
Tests/MCPTests/Helpers/HandshakeConfiguration.swift:Client.Configuration.handshakeand.strictHandshake(test-only extension)..handshakeor.strictHandshake(60 clients inCancellationTests,ClientTests,ElicitationTests,HTTPClientTransportTests,LoggingTests,ProgressTests,PromptTests,RootsTests,RoundtripTests,SamplingTests).ClientConnectionFailureTests:{"strict":true}decodes withprotocolMode == .automatic.Review fixes
Validation context (
bd224fe)Sources/MCP/Base/Transports/HTTPServer/HTTPRequestValidation.swift:HTTPValidationContext.init(httpMethod:sessionID:isInitializationRequest:supportedProtocolVersions:)defaultedsupportedProtocolVersionstoVersion.supported, which this PR widens to 2026-07-28. A custom pipeline for a session-based transport that relied on the default would have acceptedMCP-Protocol-Version: 2026-07-28. The default is nowSet(Version.handshake), the value it had before this PR; the doc comment says that a stateless transport passesVersion.statelesstoo.Docs
docs/src/migration.src.md: theHTTPValidationContextdefault (a custom stateless pipeline passesVersion.stateless + Version.handshake), and the cost of.automaticagainst a server that serves only the handshake: one extra request per connection (server/discover, answered with an error, theninitialize); clients that open many short connections to such servers use.handshake.docs/src/protocol_versions.src.md("Clients"): the same cost; the client does not remember which servers serve only the handshake.Tests
Tests/MCPTests/StatelessServerTests.swift: new suite "HTTP validation context": a default context holds the handshake revisions only, andProtocolVersionValidatoranswersMCP-Protocol-Version: 2026-07-28with HTTP 400 and -32022 whosedata.supportedomits 2026-07-28.Second round (
7d0007f)Sources/MCP/Base/Transports/HTTPServer/StatefulHTTPServerTransport.swift: the sessionless context that a 2026-07-28 request is validated in before its -32022 still usedVersion.supported, so with this PR a custom validator saw 2026-07-28 there. It now passesSet(Version.handshake), like the other contexts.docs/src/migration.src.md("Clients connect at 2026-07-28"): names the calls that behave differently on a stateless connection (notifyRootsChanged()does nothing,setLoggingLevel(_:),ping(), notifications) and links the lists inclient.mdandprotocol_versions.md.Tests/MCPTests/StatelessGatingTests.swift: "A stateless request is validated against the handshake revisions".Diagram
flowchart TD subgraph pre["Before: default .handshake"] B1["connect"] --> B2["initialize at Version.latest"] end subgraph post["After: default .automatic"] A1["connect"] --> A2["server/discover at 2026-07-28"] A2 -->|"served"| A3["stateless connection"] A2 -->|"-32022 listing a stateless version"| A4["retry once with that version"] A4 -->|"served"| A3 A2 -->|"other JSON-RPC error, HTTP 400/404/405, no answer in discoveryTimeout, or no stateless revision in common"| A5["initialize at Version.latest"] A2 -->|"other transport error"| A6["thrown"] endAPI changes
Added
None in the library. Test-only:
Client.Configuration.handshake,Client.Configuration.strictHandshake.Changed
Client.Configuration.init(strict:protocolMode:logLevel:discoveryTimeout:multiRoundTrip:)protocolModedefault.handshaketo.automatic; breaking (behavior)Client.Configuration.init(from:)protocolModedecodes as.automatic; breaking (behavior)Version.supportedSet(handshake)toSet(handshake + stateless), now contains"2026-07-28"; breaking (behavior) for code that used it as the list ofinitializerevisionsHTTPValidationContext.init(httpMethod:sessionID:isInitializationRequest:supportedProtocolVersions:)supportedProtocolVersionswritten asSet(Version.handshake)instead ofVersion.supported; same value as before this PRVersion.latest"2025-11-25"); doc comment onlyRemoved
None.
Behavior changes
Client(name:version:)without a configuration sendsserver/discoverat 2026-07-28 onconnect. Against a server that serves it, the connection is stateless: every request carries_meta, there is no session, and the server cannot send requests to the client; it returns input-required results, which the client answers with the same handlers.server/discover, one that refuses it with HTTP 400, 404 or 405, or one that does not answer withindiscoveryTimeout(10 seconds), the client sendsinitializeas before, after one extra exchange.server/discover(401 and 403 after the authorization attempts, 408, 429, 5xx,URLError) are thrown; the client does not tryinitialize.Client.ConfigurationwithoutprotocolModedecodes as.automatic.Client.Configuration(protocolMode: .handshake)keeps the previous behavior.Version.supported.contains("2026-07-28")istrue.Version.negotiatestill returns only handshake revisions, because it also checksVersion.handshake.StatefulHTTPServerTransportaccepts the sameMCP-Protocol-Versionvalues as before (handshake revisions).StatelessHTTPServerTransportalready usedVersion.stateless + Version.handshake.HTTPValidationContextwith the defaultsupportedProtocolVersionsaccepts the handshake revisions only, as before.Conformance
No baseline changes. The conformance client chooses its mode from
MCP_CONFORMANCE_PROTOCOL_VERSION(conformanceProtocolMode), so the default flip does not change what the harness sees.All three legs pass against their baselines; tier score 100% for client and server at 2025-11-25 and 2026-07-28.
Tests
VersioningTests:Version.supportedhas five entries including 2026-07-28 and equalsSet(Version.handshake + Version.stateless).ClientSnippetTests: "connect discovers 2026-07-28 by default" (stateless result at 2026-07-28) and new "connect falls back to initialize by default" (handshake-only server, 2025-11-25).GuidesSnippetTests: version lists andClient.Configuration().protocolMode == .automatic; the migration test coversmakeHandshakeClient()against a handshake-only server and a server that serves both eras;WireLognow recordsserver/discoverfirst.ProtocolSnippetTests,ServerSnippetTests: the clients that check handshake-only behavior pin.handshake; explicit.automaticremoved.ClientSnippetTestsconfigures handshake-only servers withprotocolVersions: Version.handshakewhere a test needs 2025-11-25 (roots).StatelessServerTests"HTTP validation context": the default context and the -32022 answer for a 2026-07-28 header (review fix).ClientConnectionFailureTests: a saved configuration withoutprotocolModedecodes as.automatic.swift testat7d0007f: 844 swift-testing tests inMCPTestsand 100 snippet tests, all passed.Review notes
Version.lateststays a handshake revision on purpose: it is the versioninitializerequests and the initialMCP-Protocol-VersionofHTTPClientTransport. Deriving it assupported.max()would have made 2026-07-28 theinitializeversion.docs/rough_edges.mddocuments that the newest revision isVersion.stateless[0].StatefulHTTPServerTransporttoVersion.handshakekeeps sessions on handshake revisions; 2026-07-28 requests belong onStatelessHTTPServerTransport..automaticfalls back on any JSON-RPC error fromserver/discover, on HTTP 400/404/405 and ondiscoveryTimeout(P4 ([P4] client: connect with server/discover at 2026-07-28 #367)), so servers that answer the unknown method with another error code, or refuse a request without a session, still connect. Other transport errors are thrown, so a handshake-only server that answersserver/discoverwith 5xx failsconnectin the default mode.logging/setLevel) that do not exist on a stateless connection. The tests keep covering the handshake; new default-mode coverage is inClientSnippetTests.Verification
State: the branch builds and passes
swift test(784 swift-testing tests plus the XCTest suites, all passed);swift scripts/weave.swift --checkpasses; DocC builds with--warnings-as-errors; the three conformance legs pass at their baselines, and the tier score is 100% at both revisions.AI usage disclosure: the changes, the tests, the commit messages and this description were written with Claude Opus 5.5 and reviewed by the authors.