◐ Shell
clean mode source ↗

[v1.x] Deprecate the WebSocket transport and the experimental tasks entry points by maxisbey · Pull Request #2828 · modelcontextprotocol/python-sdk

…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.

@maxisbey maxisbey marked this pull request as ready for review

June 11, 2026 07:34

pcarleton

@maxisbey maxisbey deleted the deprecate-websocket-and-tasks-entry-points branch

June 11, 2026 08:20