Description
Currently, a TextIO object (defaulting to sys.stderr) must be set for errlog when creating a new stdio client session.
|
async def stdio_client(server: StdioServerParameters, errlog: TextIO = sys.stderr): |
However, the underlying calls to Python's native
Popen and
anyio.create_process both support
subprocess.DEVNULL: int = -3 for
stderr, which allows the stream to be ignored.
By updating the type hint, we can easily support
int for
errlog. This change would benefit downstream projects and resolve issues for CLI users. Furthermore, I believe ignoring
errlog is a better default than piping them into
stderr, 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
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