[BUG] non-interactive mcp add doesn't accept arguments
Resolved 💬 2 comments Opened Mar 21, 2025 by izaitsevfb Closed Mar 21, 2025
Environment
- Platform (select one):
- [ ] Anthropic API
- [x] AWS Bedrock
- [ ] Google Vertex AI
- Claude CLI version: 0.2.53 (Claude Code)
- Operating System: macOS 15.3.2 (24D81)
- Terminal: iTerm2
Bug Description
Using mcp-server-fetch as an example (can be any python module mcp, runnable as python -m module_name_mcp), there is no obvious way to connect it to claude code in non-interactive way (without using the wizard).
What I tried:
1.
claude mcp add fetch python '-m mcp_server_fetch'
error: unknown option '-m mcp_server_fetch'
2.
claude mcp add fetch python -m mcp_server_fetch
error: unknown option '-m'
3.
claude mcp add fetch 'python -m mcp_server_fetch'
Added stdio MCP server fetch with command: python -m mcp_server_fetch to local config
claude --mcp-debug
MCP server "fetch" Connection failed: spawn python -m mcp_server_fetch ENOENT
- Using wizard works:
claude mcp add
1. Server Name: fetch
2. Server Scope: project
3. Server Command: python -m mcp_server_fetch
claude
> /mcp
⎿ MCP Server Status
• fetch: connected
Steps to Reproduce
pip install mcp-server-fetchclaude mcp add --scope project fetch "python -m mcp_server_fetch"
Expected Behavior
added mcp server works
.mcp.json produced:
{
"mcpServers": {
"fetch": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_server_fetch"],
"env": {}
}
}
}
Actual Behavior
added mcp server fails to spawn
.mcp.json produced:
{
"mcpServers": {
"fetch": {
"type": "stdio",
"command": "python -m mcp_server_fetch",
"args": [],
"env": {}
}
}
}
Additional Context
Looks like the issue is in how mcp add parses arguments and could be related to #526.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗