Open
Description
Describe the bug
When using the stdio_client context manager, the process is never cleaned up.
To Reproduce
Steps to reproduce the behavior:
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def run():
server_params = StdioServerParameters(
command="claude",
args=["mcp", "serve"],
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as _:
pass
print("exit ClientSession")
print("exit stdio_client")
if __name__ == "__main__":
asyncio.run(run())
Expected behavior
The program would print:
exit ClientSession
exit stdio_client
But it never exits the stdio_client context.
Metadata
Metadata
Assignees
Labels
No labels