Skip to content

Commit c8eaeba

Browse files
committed
Revert README, stdio/__init__.py, and test_stdio.py to match upstream main
1 parent 0629a3f commit c8eaeba

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,15 +585,12 @@ For low level server with Streamable HTTP implementations, see:
585585
- Stateful server: [`examples/servers/simple-streamablehttp/`](examples/servers/simple-streamablehttp/)
586586
- Stateless server: [`examples/servers/simple-streamablehttp-stateless/`](examples/servers/simple-streamablehttp-stateless/)
587587

588-
589-
590588
The streamable HTTP transport supports:
591589
- Stateful and stateless operation modes
592590
- Resumability with event stores
593-
- JSON or SSE response formats
591+
- JSON or SSE response formats
594592
- Better scalability for multi-node deployments
595593

596-
597594
### Mounting to an Existing ASGI Server
598595

599596
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).

src/mcp/client/stdio/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,18 @@ async def stdin_writer():
179179
yield read_stream, write_stream
180180
finally:
181181
# Clean up process to prevent any dangling orphaned processes
182-
if sys.platform == "win32":
183-
await terminate_windows_process(process)
184-
else:
185-
# On Linux, terminating a process that has already exited raises ProcessLookupError.
186-
# This can happen if the command failed to launch properly (as in this test case).
187-
try:
182+
try:
183+
if sys.platform == "win32":
184+
await terminate_windows_process(process)
185+
else:
188186
process.terminate()
189-
except ProcessLookupError:
190-
# Process already exited — safe to ignore
191-
pass
187+
except ProcessLookupError:
188+
# Process already exited, which is fine
189+
pass
192190
await read_stream.aclose()
193191
await write_stream.aclose()
192+
await read_stream_writer.aclose()
193+
await write_stream_reader.aclose()
194194

195195

196196
def _get_executable_command(command: str) -> str:

tests/client/test_stdio.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,7 @@ async def test_stdio_client():
5757
@pytest.mark.anyio
5858
async def test_stdio_client_bad_path():
5959
"""Check that the connection doesn't hang if process errors."""
60-
61-
# Removed `-c` to simulate a real "file not found" error instead of
62-
# executing a bad inline script.
63-
# This ensures the subprocess fails to launch, which better matches
64-
# the test's intent.
65-
server_params = StdioServerParameters(command="python", args=["non-existent-file.py"])
60+
server_params = StdioServerParameters(command="python", args=["-c", "non-existent-file.py"])
6661
async with stdio_client(server_params) as (read_stream, write_stream):
6762
async with ClientSession(read_stream, write_stream) as session:
6863
# The session should raise an error when the connection closes

0 commit comments

Comments
 (0)