Mark SSE transport as deprecated with runtime warnings#2284
Open
omar-y-abdi wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
Mark SSE transport as deprecated with runtime warnings#2284omar-y-abdi wants to merge 1 commit intomodelcontextprotocol:mainfrom
omar-y-abdi wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
Add deprecation warnings to SseServerTransport, sse_client, MCPServer.sse_app, MCPServer.run_sse_async, and MCPServer.run(transport="sse") directing users to migrate to Streamable HTTP transport. Each warning follows the same pattern: "<name> is deprecated. Use <replacement> instead. SSE transport will be removed in a future major release." Tests verify the warnings are emitted from SseServerTransport, sse_client, and MCPServer.sse_app. A pyproject.toml filterwarnings entry prevents existing SSE tests from failing due to the new warnings. Github-Issue: modelcontextprotocol#2278
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
SSE transport has been superseded by Streamable HTTP but currently gives no signal to callers that they should migrate. This PR adds
DeprecationWarningemissions at every SSE entry point so that users see clear guidance when they run with-Wdor a warnings-as-errors configuration.What changed
SseServerTransport.__init__— emitsDeprecationWarningpointing toStreamableHTTPServerTransportsse_client— emitsDeprecationWarningpointing tostreamable_http_clientMCPServer.sse_app— emitsDeprecationWarningpointing tostreamable_http_appMCPServer.run_sse_async— emitsDeprecationWarningpointing torun_streamable_http_asyncMCPServer.run(transport="sse")— emitsDeprecationWarningpointing torun(transport="streamable-http")Each function also gets a
.. deprecated::docstring marker for documentation generators.Tests
test_sse_server_transport_emits_deprecation_warning— verifiesSseServerTransportwarningtest_sse_client_emits_deprecation_warning— verifiessse_clientwarning (E2E with server)test_sse_app_emits_deprecation_warning— verifiesMCPServer.sse_appwarningpyproject.tomlfilter that ignores the new warningsFull test suite passes with 100% coverage.
Closes #2278