Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default environment even when env is provided #327

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

maxguru
Copy link
Contributor

@maxguru maxguru commented Mar 20, 2025

Fixed issue #326 - MCP client with npx not working when env parameter of StdioServerParameters is set

Motivation and Context

See issue #326
Discarding the output of get_default_environment() when server.env has additional variables doesn't make sense. A reasonable assumption is that setting env variables adds to what was there otherwise.

How Has This Been Tested?

I tested it and it fixed the issue for me.

Breaking Changes

If somebody relied on setting the env parameter to clear default environment variables then they would need to change their code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [?] Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

None

@dsp-ant
Copy link
Member

dsp-ant commented Mar 20, 2025

Can you please fix the formatting issue? You should be able to run uv run ruff format

@maxguru maxguru closed this Mar 20, 2025
@maxguru maxguru force-pushed the maxguru-patch-issue-326 branch from b226a0d to e2a7338 Compare March 20, 2025 18:42
…g when env parameter of StdioServerParameters is set
@maxguru maxguru reopened this Mar 20, 2025
@Kludex Kludex changed the title Fixed issue #326 Use default environment even when env is provided Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants