You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PATH lost and npx not found when proxying MCP servers because get_default_environment() is not used when user provides env in StdioServerParameters
#185
I wonder in the case where user specifies the env input, why get_default_environment()'s env vars are not retained? Not sure if this is a bug or left as it is intentionally. get_default_environment() returns crucial env vars like PATH and without it I current run into a issue where I have a proxy MCP server under uv and it tries to connect to a npx based MCP server but when env vars are specified in server params then the PATH is no longer injected, resulting in npx not found error in my use case.
Can we change it to following? Not sure if this has side effects or not, if it works happy to create a PR for that. So default envs are always provided but will be overwritten by user if they want.
To Reproduce
In a uvx isolated python environment, create a python client to connect to npx based pkg like @modelcontextprotocol/server-slack with env like SLACK_TEAM_ID configured, then it will raise an npx not found error.
Expected behavior
It should execute the npx based MCP server correctly.
Screenshots
Desktop (please complete the following information):
OS: [MacOS]
Browser [N/A]
Version [14.0 (23A344)]
The text was updated successfully, but these errors were encountered:
Describe the bug
In https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/stdio.py#L102
I wonder in the case where user specifies the env input, why get_default_environment()'s env vars are not retained? Not sure if this is a bug or left as it is intentionally.
get_default_environment()
returns crucial env vars likePATH
and without it I current run into a issue where I have a proxy MCP server underuv
and it tries to connect to anpx
based MCP server but when env vars are specified in server params then thePATH
is no longer injected, resulting innpx
not found error in my use case.Can we change it to following? Not sure if this has side effects or not, if it works happy to create a PR for that. So default envs are always provided but will be overwritten by user if they want.
To Reproduce
In a
uvx
isolated python environment, create a python client to connect tonpx
based pkg like@modelcontextprotocol/server-slack
with env like SLACK_TEAM_ID configured, then it will raise an npx not found error.Expected behavior
It should execute the npx based MCP server correctly.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: