Repository navigation
[P30] deprecations: roots, sampling, logging and includeContext (SEP-2577, SEP-2596) - #341
Merged
Merged
Conversation
…SEP-2596) 2026-07-28 deprecates roots, sampling and logging (SEP-2577), and reclassifies the includeContext values thisServer and allServers, and the HTTP+SSE transport, as deprecated (SEP-2596). The features work on every revision that has them; the wire does not change. SEP-2596 asks a Tier 1 SDK to mark the deprecated API surface with the language's own mechanism, with the SEP and the earliest removal. The entry points are @available(*, deprecated): Server.requestSampling, listRoots and the two log(level:logger:data:); Client. withSamplingHandler, withRootsHandler, notifyRootsChanged and setLoggingLevel. Each message gives the SEP, the earliest removal (the first revision released on or after 2027-07-28) and the migration. Sampling.ContextInclusion.thisServer and .allServers are deprecated too; they still decode and encode. Types, capabilities and input request cases carry a documentation note: the SDK uses them itself, so a native marker would warn in its own code. SEP-2577 asks for a warning when a deprecated capability is negotiated. The server logs a notice the first time a client declares roots or sampling, and the client when a server declares logging, once for each process: a stateful HTTP server creates a server for each session. rough_edges lists the features the specification deprecates, with what the SDK does and the migration, also dynamic client registration and HTTP+SSE, which the SDK never implemented. VERSIONING links the list.
- Claim a once-per-process notice (SEP-2577) only when the instance's logger emits .notice. An instance with the transports' default no-op logger (level critical), or with a logger above notice, used the notice up, and later instances with a logger never logged it. - Log the server's notices for the client's roots and sampling from the default initialize handler, using params.capabilities, after the initialize hook. During a handshake initialize the request context has no client capabilities yet, so the notice waited for a second request, and behind a sessionless transport it was never logged. - Tests: a handshake connect with no request after it, and a first instance with the default no-op logger followed by one with a logger.
This was referenced Nov 25, 2026
varun06
previously approved these changes
Nov 25, 2026
varun06
left a comment
Contributor
There was a problem hiding this comment.
Already reviewed and still looking good.
varun06
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: P29 (#342) · next: P31 (#340))conformance/p30-spec-deprecationsconformance/p29-tool-names(stacked: GitHub retargets this PR torel/1.0.0when the previous part merges)a79cda4deprecations: roots, sampling, logging and includeContext (SEP-2577, SEP-2596)de7b2f3deprecations: second-pass review fixesSummary
2026-07-28 deprecates roots, sampling and logging (SEP-2577), and reclassifies the
includeContextvaluesthisServerandallServers, and the HTTP+SSE transport, as deprecated (SEP-2596). The SDK marks its API for them with@available(*, deprecated), with the SEP, the earliest removal and the migration, and logs a notice once for each process when a peer declares a deprecated capability. The features work on every revision that has them; the wire does not change.Motivation
SEP-2596 asks a Tier 1 SDK to mark the deprecated API surface with the language's own mechanism, and to give the SEP and the earliest removal. SEP-2577 asks implementations to warn when a deprecated capability is negotiated. The earliest removal is the first revision released on or after 2027-07-28.
Changes
Compiler deprecations (each message gives the SEP, the earliest removal and the migration)
Server:requestSampling(...),listRoots()and the twolog(level:logger:data:).Client:withSamplingHandler,withRootsHandler,notifyRootsChanged,setLoggingLevel.Sampling.ContextInclusion.thisServerand.allServers. They still decode and encode.Documentation notes
> Important:note with the same text:Sampling,CreateSamplingMessage,Root,ListRoots,LogLevel,SetLoggingLevel,LogMessageNotification; thesamplingandrootsclient capabilities, theloggingserver capability andClient.Configuration.logLevel;Metadata.logLevel; thesamplingandlistRootsinput requests and their responses. The SDK uses them itself, so a native marker would warn in its own code.Runtime notices (
Sources/MCP/Base/DeprecationNotices.swift)initializeresult and theserver/discoverresult.notice.Docs
rough_edges.md, "Deprecated by the specification": each deprecated feature, what the SDK does, and the migration; also dynamic client registration and HTTP+SSE, which the SDK never implemented.VERSIONING.mdlinks the list.API changes
Server.requestSampling(...),listRoots(),log(level:logger:data:)(both)Client.withSamplingHandler,withRootsHandler,notifyRootsChanged,setLoggingLevelSampling.ContextInclusion.thisServer,.allServersNothing is removed and no signature changes.
Behavior changes
Conformance
Baselines unchanged (empty on every leg). Tier scores 100% at both revisions.
Tests
Tests/MCPTests/DeprecationNoticeTests.swift: the server logs one notice for each deprecated client capability, and the client one when the server declares logging, at both eras; no notice without deprecated capabilities, and none at warning level.SamplingTestsuses the raw values forthisServerandallServers. Ata79cda4,swift testpasses 1040 swift-testing tests inMCPTestsand 108 snippet tests on macOS, and 1132 tests on Linux (scripts/ci-linux.sh build-test).Review notes
DeprecationNoticeskeeps the reported features in a lock-protected set. Tests run with their own instance through a task-local value, which the receive loop and the handler tasks inherit.Sources/MCPhas none.Verification
swift test; DocC with warnings as errors; doc coverage;swift scripts/weave.swift --check; the API breakage job.scripts/run-interop.sh --check; Linuxscripts/ci-linux.sh build-test.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.