pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/python-sdk/commit/b478bff56d56aea238ebdec26c1ee818e59ee258

gin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-12d60eb17c94521c.css" /> Remove the unsupported WebSocket transport (#2785) · modelcontextprotocol/python-sdk@b478bff · GitHub
Skip to content

Commit b478bff

Browse files
authored
Remove the unsupported WebSocket transport (#2785)
1 parent ac96f88 commit b478bff

8 files changed

Lines changed: 9 additions & 331 deletions

File tree

docs/migration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ group (spawned with `start_new_session=True`); the `getpgid()` lookup and the
145145
per-process terminate/kill fallback are gone. The win32 utilities logger is now
146146
named `mcp.os.win32.utilities` (was `client.stdio.win32`).
147147

148+
### WebSocket transport removed
149+
150+
The WebSocket transport has been removed: `mcp.client.websocket.websocket_client`, `mcp.server.websocket.websocket_server`, and the `ws` optional dependency extra (`mcp[ws]`) no longer exist. WebSocket was never part of the MCP specification. Use the streamable HTTP transport instead (`mcp.client.streamable_http.streamable_http_client` on the client, `streamable_http_app()` on the server), which supports bidirectional communication with server-to-client streaming over standard HTTP.
151+
148152
### Removed type aliases and classes
149153

150154
The following deprecated type aliases and classes have been removed from `mcp.types`:

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ dependencies = [
4646
[project.optional-dependencies]
4747
rich = ["rich>=13.9.4"]
4848
cli = ["typer>=0.16.0", "python-dotenv>=1.0.0"]
49-
ws = ["websockets>=15.0.1"]
5049

5150
[project.scripts]
5251
mcp = "mcp.cli:app [cli]"
@@ -75,8 +74,8 @@ build-constraint-dependencies = [
7574

7675
[dependency-groups]
7776
dev = [
78-
# We add mcp[cli,ws] so `uv sync` considers the extras.
79-
"mcp[cli,ws]",
77+
# We add mcp[cli] so `uv sync` considers the extras.
78+
"mcp[cli]",
8079
"pyright>=1.1.400",
8180
"pytest>=8.4.0",
8281
"ruff>=0.8.5",
@@ -204,9 +203,6 @@ addopts = """
204203
"""
205204
filterwarnings = [
206205
"error",
207-
# This should be fixed on Uvicorn's side.
208-
"ignore::DeprecationWarning:websockets",
209-
"ignore:websockets.server.WebSocketServerProtocol is deprecated:DeprecationWarning",
210206
# pywin32 internal deprecation warning
211207
"ignore:getargs.*The 'u' format is deprecated:DeprecationWarning",
212208
]

src/mcp/client/websocket.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/mcp/server/websocket.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/client/test_transport_stream_cleanup.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
from mcp.client.sse import sse_client
2323
from mcp.client.streamable_http import streamable_http_client
24-
from mcp.client.websocket import websocket_client
2524

2625

2726
@contextmanager
@@ -104,16 +103,3 @@ async def test_streamable_http_client_closes_all_streams_on_exit() -> None:
104103
with _assert_no_memory_stream_leak():
105104
async with streamable_http_client("http://127.0.0.1:1/mcp"):
106105
pass
107-
108-
109-
@pytest.mark.anyio
110-
async def test_websocket_client_closes_all_streams_on_connection_error(free_tcp_port: int) -> None:
111-
"""websocket_client must close all 4 stream ends when ws_connect fails.
112-
113-
Before the fix, there was no try/finally at all — if ws_connect raised,
114-
all 4 streams were leaked.
115-
"""
116-
with _assert_no_memory_stream_leak():
117-
with pytest.raises(OSError):
118-
async with websocket_client(f"ws://127.0.0.1:{free_tcp_port}/ws"):
119-
pytest.fail("should not reach here") # pragma: no cover

tests/shared/test_ws.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/test_helpers.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy