Skip to content

Commit e3e98e5

Browse files
committed
Merge branch 'main' into feat/sep-2207
2 parents 15e06ce + e1fd62e commit e3e98e5

File tree

9 files changed

+390
-293
lines changed

9 files changed

+390
-293
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.14",
2626
]
2727
dependencies = [
28-
"anyio>=4.5",
28+
"anyio>=4.9",
2929
"httpx>=0.27.1",
3030
"httpx-sse>=0.4",
3131
"pydantic>=2.12.0",

src/mcp/client/sse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ async def post_writer(endpoint_url: str):
160160
finally:
161161
await read_stream_writer.aclose()
162162
await write_stream.aclose()
163+
await read_stream.aclose()
164+
await write_stream_reader.aclose()

src/mcp/client/streamable_http.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,5 @@ def start_get_stream() -> None:
577577
finally:
578578
await read_stream_writer.aclose()
579579
await write_stream.aclose()
580+
await read_stream.aclose()
581+
await write_stream_reader.aclose()

src/mcp/client/websocket.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ async def websocket_client(
3838
write_stream: MemoryObjectSendStream[SessionMessage]
3939
write_stream_reader: MemoryObjectReceiveStream[SessionMessage]
4040

41-
read_stream_writer, read_stream = anyio.create_memory_object_stream(0)
42-
write_stream, write_stream_reader = anyio.create_memory_object_stream(0)
43-
4441
# Connect using websockets, requesting the "mcp" subprotocol
4542
async with ws_connect(url, subprotocols=[Subprotocol("mcp")]) as ws:
43+
read_stream_writer, read_stream = anyio.create_memory_object_stream(0)
44+
write_stream, write_stream_reader = anyio.create_memory_object_stream(0)
4645

4746
async def ws_reader():
4847
"""Reads text messages from the WebSocket, parses them as JSON-RPC messages,
@@ -68,7 +67,13 @@ async def ws_writer():
6867
msg_dict = session_message.message.model_dump(by_alias=True, mode="json", exclude_unset=True)
6968
await ws.send(json.dumps(msg_dict))
7069

71-
async with anyio.create_task_group() as tg:
70+
async with (
71+
read_stream_writer,
72+
read_stream,
73+
write_stream,
74+
write_stream_reader,
75+
anyio.create_task_group() as tg,
76+
):
7277
# Start reader and writer tasks
7378
tg.start_soon(ws_reader)
7479
tg.start_soon(ws_writer)

src/mcp/os/win32/utilities.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ def pid(self) -> int:
123123
"""Return the process ID."""
124124
return self.popen.pid
125125

126+
@property
127+
def returncode(self) -> int | None:
128+
"""Return the exit code, or ``None`` if the process has not yet terminated."""
129+
return self.popen.returncode
130+
126131

127132
# ------------------------
128133
# Updated function

0 commit comments

Comments
 (0)