-
Notifications
You must be signed in to change notification settings - Fork 3.3k
More control over stderr in stdio client #1806
Copy link
Copy link
Labels
P3Nice to haves, rare edge casesNice to haves, rare edge casesenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedneeds decisionIssue is actionable, needs maintainer decision on whether to implementIssue is actionable, needs maintainer decision on whether to implement
Metadata
Metadata
Assignees
Labels
P3Nice to haves, rare edge casesNice to haves, rare edge casesenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedneeds decisionIssue is actionable, needs maintainer decision on whether to implementIssue is actionable, needs maintainer decision on whether to implement
Description
Currently, a
TextIOobject (defaulting tosys.stderr) must be set forerrlogwhen creating a new stdio client session.python-sdk/src/mcp/client/stdio/__init__.py
Line 106 in 2aa1ad2
However, the underlying calls to Python's native
Popenandanyio.create_processboth supportsubprocess.DEVNULL: int = -3forstderr, which allows the stream to be ignored.By updating the type hint, we can easily support
intforerrlog. This change would benefit downstream projects and resolve issues for CLI users. Furthermore, I believe ignoringerrlogis a better default than piping them intostderr, as the current behaviour can create unexpected side-effects that are difficult to trace.References
Related Issues:
#156
langchain-ai/langchain-mcp-adapters#72
Documentation:
https://docs.python.org/3/library/subprocess.html#subprocess.Popen
https://anyio.readthedocs.io/en/stable/api.html#anyio.open_process