Skip to content

Conversation

@cpjet64
Copy link
Contributor

@cpjet64 cpjet64 commented Sep 24, 2025

Fixes #4180.

What
Expand the Windows DEFAULT_ENV_VARS list so MCP servers inherit COMSPEC, SYSTEMROOT, PROGRAMDATA, APPDATA, and other core variables used by CLI helpers and DNS
add a Windows-only regression test (test_create_env_for_mcp_server_includes_windows_defaults) that guards each entry in that list
keep the existing override test working cross‑platform by reading USERNAME on Windows

Why
Without those inherited variables, Windows MCP servers that shell out (Docker MCP gateway, npx-based servers, etc.) fail immediately because plugins, caches, or system DLLs can’t be located. The new test ensures we don’t regress on the required variable set.

How
Update codex-rs/mcp-client/src/mcp_client.rs
Introduce EnvVarGuard to safely mutate/restore env vars during tests
Document the rationale in the inline comment

Testing
just fmt
cargo test -p codex-mcp-client
just fix -p codex-mcp-client

@cpjet64
Copy link
Contributor Author

cpjet64 commented Sep 24, 2025

I have read the CLA Document and I hereby sign the CLA

@github-actions
Copy link

github-actions bot commented Sep 24, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


curtp seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

github-actions bot added a commit that referenced this pull request Sep 24, 2025
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

@cpjet64 cpjet64 force-pushed the fix/windows-compat branch from adea0f7 to 229ae2d Compare October 7, 2025 05:01
@cpjet64 cpjet64 closed this Oct 7, 2025
@cpjet64 cpjet64 deleted the fix/windows-compat branch October 7, 2025 12:57
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2025
@cpjet64 cpjet64 restored the fix/windows-compat branch October 9, 2025 22:57
@cpjet64 cpjet64 deleted the fix/windows-compat branch October 18, 2025 04:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP servers fail to start on Windows due to missing inherited environment variables

1 participant