[v1.x] Deprecate the WebSocket transport and the experimental tasks entry points#2828
Draft
maxisbey wants to merge 1 commit into
Draft
[v1.x] Deprecate the WebSocket transport and the experimental tasks entry points#2828maxisbey wants to merge 1 commit into
maxisbey wants to merge 1 commit into
Conversation
…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.
7aef6e6 to
adda346
Compare
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.
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.websocket_clientandwebsocket_servernow carrytyping_extensions.deprecatedmarkers and emit aDeprecationWarningwhen called. WebSocket was never part of the MCP specification; the streamable HTTP transport is the replacement.ClientSession.experimental, theexperimental_task_handlersconstructor kwarg,ServerSession.experimental, andServer.experimentalwarn the same way. Tasks (SEP-1686) were removed from the MCP specification and are expected to return as a separate MCP extension in the future.Design notes
ServerSession._experimentalaccessor, and a regression test asserts that a plain client/server round trip emits zero deprecation warnings.@deprecatedis applied outside@asynccontextmanagerso the warning points at the caller's frame rather than contextlib internals.reportDeprecated, ty'sdeprecatedrule) will now surface these usages downstream — that static channel reaches maintainers more reliably than runtime warnings, which Python hides by default.filterwarningsignores (a conftest for the tasks suite, apytestmarkfor the websocket suite) instead of repo-global ignores, so the globalfilterwarnings = ["error"]net still catches any accidental warning from SDK internals elsewhere.Deliberately not in this PR: the task types in
mcp.typesand 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