Skip to content

[P30] deprecations: roots, sampling, logging and includeContext (SEP-2577, SEP-2596) - #341

Merged
jeanmatthieu merged 2 commits into
rel/1.0.0from
conformance/p30-spec-deprecations
Nov 25, 2026
Merged

jeanmatthieu merged 2 commits into
rel/1.0.0from
conformance/p30-spec-deprecations

Conversation

@jeanmatthieu

@jeanmatthieu jeanmatthieu commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor
Part P30 of P0–P35, merged into rel/1.0.0 in order (previous: P29 (#342) · next: P31 (#340))
Branch conformance/p30-spec-deprecations
Base conformance/p29-tool-names (stacked: GitHub retargets this PR to rel/1.0.0 when the previous part merges)
Commits a79cda4 deprecations: roots, sampling, logging and includeContext (SEP-2577, SEP-2596)
de7b2f3 deprecations: second-pass review fixes
Size 22 files, +357 / -13

Summary

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 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 two log(level:logger:data:).
  • Client: withSamplingHandler, withRootsHandler, notifyRootsChanged, setLoggingLevel.
  • Sampling.ContextInclusion.thisServer and .allServers. They still decode and encode.

Documentation notes

  • Types, capabilities and input-request cases carry a > Important: note with the same text: Sampling, CreateSamplingMessage, Root, ListRoots, LogLevel, SetLoggingLevel, LogMessageNotification; the sampling and roots client capabilities, the logging server capability and Client.Configuration.logLevel; Metadata.logLevel; the sampling and listRoots input 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)

  • The server logs a notice the first time a client declares roots or sampling; the client logs one when a server declares logging. Each notice is logged once for each process, because a stateful HTTP server creates a server for each session.
  • The server checks in the handler task, after the stateless hook and the header check, so a client that is not authorized cannot cause a notice. The client checks the initialize result and the server/discover result.
  • The level is 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.md links the list.
  • Server and client guides and the migration guide: the deprecations. CHANGELOG. ROADMAP: SEP-2577 and SEP-2596 Implemented.

API changes

Symbol Change
Server.requestSampling(...), listRoots(), log(level:logger:data:) (both) deprecated
Client.withSamplingHandler, withRootsHandler, notifyRootsChanged, setLoggingLevel deprecated
Sampling.ContextInclusion.thisServer, .allServers deprecated

Nothing is removed and no signature changes.

Behavior changes

  • Code that calls the deprecated entry points gets compiler warnings.
  • A notice is logged once for each process when a client declares roots or sampling, or a server declares logging.

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. SamplingTests uses the raw values for thisServer and allServers. At a79cda4, swift test passes 1040 swift-testing tests in MCPTests and 108 snippet tests on macOS, and 1132 tests on Linux (scripts/ci-linux.sh build-test).

Review notes

  • DeprecationNotices keeps 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.
  • The markers give deprecation warnings in the examples, the conformance fixtures, the interop driver and the tests, which use the deprecated features on purpose. Sources/MCP has none.

Verification

  • swift test; DocC with warnings as errors; doc coverage; swift scripts/weave.swift --check; the API breakage job.
  • Every conformance leg for client and server; both tier scores.
  • scripts/run-interop.sh --check; Linux scripts/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.

…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.
varun06
varun06 previously approved these changes Nov 25, 2026

@varun06 varun06 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed and still looking good.

Base automatically changed from conformance/p29-tool-names to rel/1.0.0 November 25, 2026 12:53
@jeanmatthieu
jeanmatthieu dismissed varun06’s stale review November 25, 2026 12:53

The base branch was changed.

@jeanmatthieu
jeanmatthieu merged commit c57079a into rel/1.0.0 Nov 25, 2026
@jeanmatthieu
jeanmatthieu deleted the conformance/p30-spec-deprecations branch November 25, 2026 12:53
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.

2 participants