fix(mcp): allow common Windows env vars by default

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-03 18:04:20 +09:00
parent 316d250465
commit e20b59cb29
2 changed files with 11 additions and 2 deletions
@@ -5,6 +5,8 @@ const BUILTIN_ALLOWED_MCP_ENV_VARS = [
"SHELL",
"TERM",
"TMPDIR",
"TMP",
"TEMP",
"PWD",
"OLDPWD",
"LANG",
@@ -17,6 +19,9 @@ const BUILTIN_ALLOWED_MCP_ENV_VARS = [
"XDG_CACHE_HOME",
"HOSTNAME",
"LOGNAME",
"USERPROFILE",
"APPDATA",
"LOCALAPPDATA",
]
const SENSITIVE_MCP_ENV_VAR_PATTERN = /KEY|TOKEN|SECRET|PASSWORD|AUTH|CREDENTIAL/i
@@ -46,16 +46,20 @@ describe("expandEnvVars", () => {
it("#when expanding the value #then it returns the env value", () => {
// given
process.env.TMPDIR = "/tmp/omo"
process.env.TEMP = "C:\\Temp"
process.env.USERPROFILE = "C:\\Users\\tester"
process.env.LANG = "en_US.UTF-8"
process.env.XDG_CONFIG_HOME = "/Users/tester/.config"
// when
const expanded = expandEnvVars(
"${TMPDIR}|${LANG}|${XDG_CONFIG_HOME}"
"${TMPDIR}|${TEMP}|${USERPROFILE}|${LANG}|${XDG_CONFIG_HOME}"
)
// then
expect(expanded).toBe("/tmp/omo|en_US.UTF-8|/Users/tester/.config")
expect(expanded).toBe(
"/tmp/omo|C:\\Temp|C:\\Users\\tester|en_US.UTF-8|/Users/tester/.config"
)
})
})