-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Deprecate the legacy HTTP+SSE transport #3204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
| import mcp.types as types | ||
| from mcp import ClientSession | ||
| from mcp.client.context import ClientRequestContext | ||
| from mcp.client.sse import sse_client | ||
| from mcp.client.streamable_http import streamable_http_client | ||
| from mcp.shared.exceptions import MCPError, UrlElicitationRequiredError | ||
| from mcp.types import URL_ELICITATION_REQUIRED | ||
|
|
||
|
|
@@ -280,16 +280,16 @@ async def run_command_loop(session: ClientSession) -> None: | |
|
|
||
| async def main() -> None: | ||
| """Run the interactive URL elicitation client.""" | ||
| server_url = "http://localhost:8000/sse" | ||
| server_url = "http://localhost:8000/mcp" | ||
|
|
||
| print("=" * 60) | ||
| print("URL Elicitation Client Example") | ||
| print("=" * 60) | ||
| print(f"\nConnecting to: {server_url}") | ||
| print("(Start server with: cd examples/snippets && uv run server elicitation sse)") | ||
| print("(Start server with: cd examples/snippets && uv run server elicitation streamable-http)") | ||
|
|
||
| try: | ||
| async with sse_client(server_url) as (read, write): | ||
| async with streamable_http_client(server_url) as (read, write): | ||
| async with ClientSession( | ||
| read, | ||
| write, | ||
|
Comment on lines
+283
to
295
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 The migration of this client to Streamable HTTP left two stale instructions that still say to start the server in SSE mode: the module docstring ( Extended reasoning...What the bug is. This PR migrates
The code path that triggers it. The snippets server runner ( Step-by-step proof.
Beyond the connection failure, following the stale instruction also puts the user on the transport this very PR is deprecating: the server run emits Why nothing catches it. These are string literals in comments and print statements — no type checker, test, or the new deprecation warnings can flag them. The example only fails when run interactively against a real server, which CI doesn't do. Impact and fix. Impact is confined to this example: the primary hint in |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,6 +266,9 @@ filterwarnings = [ | |
| # 2026-07-28 drops ping; Client.send_ping() is advisory-deprecated and the | ||
| # legacy interaction/transport tests still drive it. | ||
| "ignore:ping is removed as of 2026-07-28.*:mcp.MCPDeprecationWarning", | ||
| # SEP-2596 deprecates the HTTP+SSE transport; the SDK still ships it for | ||
| # servers/clients that haven't migrated, and the tests still exercise it. | ||
| "ignore:.*HTTP\\+SSE transport is deprecated as of 2025-03-26.*:mcp.MCPDeprecationWarning", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The suite-wide ignore masks this SDK's new deprecation warning at every call site, so future tests can accidentally introduce legacy HTTP+SSE usage without failing. The existing legacy-transport tests can keep a module- or test-level Prompt for AI agents |
||
| ] | ||
|
|
||
| [tool.markdown.lint] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: When the initial Streamable HTTP connection is refused, the recovery message still tells users to start the server with
sse. That starts the legacy transport instead of the/mcpendpoint this client now targets, so following the error guidance leaves the retry unable to connect. Updating the fallback (and the module usage text) tostreamable-httpwould keep the example runnable.Prompt for AI agents