…ints
Both surfaces are removed in mcp 2.0, so mark them deprecated on the
v1.x line to give users advance notice:
- websocket_client and websocket_server now carry
typing_extensions.deprecated markers and emit a DeprecationWarning
when called. WebSocket was never part of the MCP specification; the
streamable HTTP transport is the replacement.
- The experimental tasks entry points (ClientSession.experimental,
the experimental_task_handlers kwarg, ServerSession.experimental,
and Server.experimental) warn the same way. Tasks (SEP-1686) were
removed from the MCP specification and are expected to return as a
separate MCP extension.
Warnings are emitted only when the deprecated APIs are used: there are
no import-time warnings, and internal code paths now go through a
private ServerSession._experimental accessor so plain (non-tasks)
clients and servers never see a warning. A regression test asserts
that plain session usage stays warning-free, and the warning ignores
for the suites that intentionally exercise these APIs are scoped to
those suites rather than silenced globally.
The docs pages for the experimental tasks API now carry a deprecation
banner instead of the experimental one.
Summary
Marks two API surfaces as deprecated on the v1.x line. Both are already removed on main (v2): the WebSocket transport in #2785 and experimental tasks support in #2714. This change gives 1.x users advance notice before they upgrade to 2.0.
Design notes
Deliberately not in this PR: the task types in mcp.types and the experimental module classes are untouched. Runtime warnings there would fire from inside libraries that build on these types and spam their users; a follow-up can add static-only markers (@deprecated(..., category=None)) for those.
Testing
AI Disclaimer