Merge pull request #1095 from Streamweaver/fix/mcp-stdio-env-passthrough-linux

fix(runtime): pass HOME/TMP/TEMP to stdio MCP servers on all platforms
This commit is contained in:
Jaber Jaber
2026-04-29 15:44:05 +03:00
committed by GitHub
+7 -3
View File
@@ -247,6 +247,13 @@ impl McpConnection {
if let Ok(path) = std::env::var("PATH") {
cmd.env("PATH", path);
}
// Some stdio MCP servers launched via node/npx require a usable home
// directory even when they do not declare any explicit secret env vars.
for var in &["HOME", "TMP", "TEMP"] {
if let Ok(val) = std::env::var(var) {
cmd.env(var, val);
}
}
// On Windows, npm/node need extra vars
if cfg!(windows) {
for var in &[
@@ -254,9 +261,6 @@ impl McpConnection {
"LOCALAPPDATA",
"USERPROFILE",
"SystemRoot",
"TEMP",
"TMP",
"HOME",
"HOMEDRIVE",
"HOMEPATH",
] {