Deprecate Server.__init__ handlers for removed capabilities#3002
Conversation
The 2026-07-28 spec deprecates Logging and Roots (SEP-2577) and the client-to-server progress notification. Their lowlevel `Server.__init__` handler parameters - `on_set_logging_level`, `on_roots_list_changed`, and `on_progress` - are now split into a `typing_extensions.deprecated` overload, so type checkers and IDEs flag them, and the real constructor emits `MCPDeprecationWarning` at runtime when one is passed. The non-deprecated overload omits these parameters, keeping the common case warning-free.
There was a problem hiding this comment.
LGTM — mechanical deprecation following the established SEP-2577 pattern; no behavior change beyond the new warnings.
Extended reasoning...
Overview
The PR deprecates three lowlevel Server.__init__ handler parameters (on_set_logging_level, on_roots_list_changed, on_progress) by splitting the constructor into a clean overload and a typing_extensions.deprecated overload, plus emitting MCPDeprecationWarning at runtime when any of the three is passed. The remaining files are documentation (docs/migration.md) and test/example call sites annotated with # pyright: ignore[reportDeprecated], with the stdio subprocess helper additionally guarding construction with warnings.catch_warnings().
Security risks
None. The change adds overloads and warning emission only; no auth, crypto, transport, or input-handling logic is touched, and no runtime behavior changes for existing handlers — they are still registered exactly as before.
Level of scrutiny
The diff is large in line count, but almost entirely duplicated constructor signatures required by the overload pattern. The substantive change is three warnings.warn calls. The runtime warning messages match the repository's existing filterwarnings ignores in pyproject.toml (.*is deprecated as of 2026-07-28 \(SEP-2577\). and Client-to-server progress is deprecated as of 2026-07-28.*), so the test suite's strict warning configuration is not tripped. No internal SDK code constructs Server with the deprecated parameters, so library consumers using MCPServer are unaffected.
Other factors
This mirrors the deprecation approach already used throughout the SDK for SEP-2577 (same wording, same MCPDeprecationWarning category), the bug-hunting pass found no issues, and the author reports pyright/ruff/full-suite/coverage all passing. The risk profile is low enough that human review adds little here.
The 2026-07-28 spec deprecates Logging and Roots (SEP-2577) and the client-to-server progress notification. This deprecates the corresponding lowlevel
Server.__init__handler parameters:on_set_logging_level(Logging),on_roots_list_changed(Roots), andon_progress(client-to-server progress).What changed
Server.__init__is split into two@overloads: a clean signature without the three deprecated parameters, and atyping_extensions.deprecatedoverload with them. Passing any of the three resolves to the deprecated overload, so type checkers and IDEs flag it.MCPDeprecationWarningat runtime when a deprecated handler is passed, with messages matching the existing SEP-2577 / progress wording (so the project's existingfilterwarningsignores already cover them).# pyright: ignore[reportDeprecated]; the stdio subprocess test helper guards construction withwarnings.catch_warnings()since the global pytest filter doesn't reach the child process.docs/migration.md, grouped into the existing SEP-2577 section.100% coverage on the touched module;
pyright,ruff,strict-no-cover, and the full suite pass.AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.