[BUG] claude mcp add example fails when I run it on environment variable format
Resolved 💬 3 comments Opened Feb 20, 2026 by epugh Closed Feb 24, 2026
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 I try to add a mcp tool with an environment variable, I get back an error. I tried the one that is suggested when you run claude mcp add --help for stdio and it fails too:
➜ solr-mcp-tool-eric-test claude mcp add --help
# Add stdio server with environment variables:
claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
Then I run the example:
➜ solr-mcp-tool-eric-test claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
Invalid environment variable format: my-server, environment variables should be added as: -e KEY1=value1 -e KEY2=value2
I am on the latest version installed with homebrew:
➜ solr-mcp-tool-eric-test claude --version
2.1.49 (Claude Code)
What Should Happen?
should create a mcp tool
Error Messages/Logs
➜ solr-mcp-tool-eric-test claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
Invalid environment variable format: my-server, environment variables should be added as: -e KEY1=value1 -e KEY2=value2
Steps to Reproduce
1: run the command claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
2: see the error
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.49
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗