Skip to content

Commit 467f307

Browse files
committed
make stderr of server subprocess configurable
1 parent 53bfac0 commit 467f307

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mcp/client/stdio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class StdioServerParameters(BaseModel):
8383

8484

8585
@asynccontextmanager
86-
async def stdio_client(server: StdioServerParameters):
86+
async def stdio_client(server: StdioServerParameters, errlog=sys.stderr):
8787
"""
8888
Client transport for stdio: this will connect to a server by spawning a
8989
process and communicating with it over stdin/stdout.
@@ -100,7 +100,7 @@ async def stdio_client(server: StdioServerParameters):
100100
process = await anyio.open_process(
101101
[server.command, *server.args],
102102
env=server.env if server.env is not None else get_default_environment(),
103-
stderr=sys.stderr,
103+
stderr=errlog,
104104
)
105105

106106
async def stdout_reader():

0 commit comments

Comments
 (0)