MCP subprocess env vars with semicolons in value are silently dropped
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When Claude Code spawns an MCP server subprocess, environment
variable values containing semicolons (;) are silently dropped —
the key never reaches the subprocess environment at all.
What Should Happen?
Expected behavior:
All env vars defined in settings.json are passed to the subprocess
unchanged, regardless of their value content.
Actual behavior:
Env vars whose values contain semicolons are silently omitted from
the subprocess environment.
Error Messages/Logs
Steps to Reproduce
- Add an env var with a semicolon-containing value to
settings.json:
{
"mcpServers": {
"my-server": {
"command": "...",
"env": {
"MY_COOKIE": "foo=bar; baz=qux; session=abc123"
}
}
}
}
- In the MCP server process, print os.environ.get("MY_COOKIE") →
returns None
- Other env vars without semicolons (e.g. JIRA_URL) are passed
correctly
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.14.5
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗