fix(runtime): pass HOME/TMP/TEMP to stdio MCP servers on all platforms#1095
Open
Streamweaver wants to merge 1 commit intoRightNow-AI:mainfrom
Open
fix(runtime): pass HOME/TMP/TEMP to stdio MCP servers on all platforms#1095Streamweaver wants to merge 1 commit intoRightNow-AI:mainfrom
Streamweaver wants to merge 1 commit intoRightNow-AI:mainfrom
Conversation
Node/npx-backed stdio MCP servers (Gmail, AgentMail, Exa, etc.) need a usable HOME directory for npm cache and temp-file scratch space. Without it, npm errors with EACCES on /nonexistent or silently falls over when trying to write cache entries. Previously these three variables were only passed on Windows. Linux and macOS hosts launching stdio MCP servers through npx would get an empty env for HOME/TMP/TEMP, breaking most community MCP servers. Move the HOME/TMP/TEMP passthrough above the cfg!(windows) block so it applies to every platform. Remove the now-redundant entries from the Windows-only list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
stdio MCP servers launched via
npx(Gmail, AgentMail, Exa, and community servers generally) fail or misbehave on Linux and macOS becauseHOME,TMP, andTEMPare not passed through to the child process. npm, node, and npx need a writableHOMEfor the npm cache andTMPfor scratch files; without them they error withEACCESagainst/nonexistentor fall over silently.The existing code passes these three variables only inside a
cfg!(windows)guard, so Linux/macOS hosts running stdio MCP servers vianpxhit the failure.Fix
Move the
HOME/TMP/TEMPpassthrough above thecfg!(windows)guard so it applies on every platform, and remove the now-redundant entries from the Windows-only list.Test notes
Verified locally on WSL2 (Ubuntu, rustc 1.95.0) by rebuilding against this branch and confirming three
npx-backed stdio MCP servers initialize cleanly from a fresh spawn:@gongrzhe/server-gmail-autoauth-mcp— 19 toolsagentmail-mcp— 11 toolsexa-mcp-server— 3 toolsAll three would fail on the parent branch without this patch (npm cache write errors against a non-existent
HOME).Windows behavior is unchanged — the same three variables are still passed, just via the universal block instead of the Windows-only block.
Scope
Pure runtime fix, one file, 10 lines. No API surface changes, no new dependencies, no behavioral change on Windows.