[BUG] Bug: --mcp-config flag broken in v1.0.73 - treats all arguments as config files and fails schema validation
The --mcp-config flag in Claude Code v1.0.73 has two critical bugs that make it completely unusable:
- Argument parsing bug: Any arguments after --mcp-config are incorrectly treated as additional config files, not as the prompt
- Schema validation failure: Even valid MCP configurations fail with "Does not adhere to MCP server configuration schema"
Environment
- Claude Code version: 1.0.73 (updated Aug 11, 2024)
- Platform: Linux (Ubuntu)
- Node.js: v18.19.1
- Installation method: Local installation via npm
Steps to Reproduce
- Create a minimal valid MCP config file:
echo '{"mcpServers":{"filesystem":{"command":"npx","args":["@modelcontextprotocol/server-filesystem","/opt"]}}}' > /tmp/test-mcp.json
- Try to start Claude with the config:
claude --mcp-config /tmp/test-mcp.json "Test prompt"
- Observe error:
Error: Invalid MCP configuration:
MCP config file not found: /opt/Test prompt
Does not adhere to MCP server configuration schema
- Even without a prompt, the schema validation fails:
claude --mcp-config /tmp/test-mcp.json
# Error: Does not adhere to MCP server configuration schema
Expected Behavior
- The --mcp-config flag should accept a JSON file path and load MCP servers from it
- Arguments after the config should be treated as the prompt, not as additional config files
- Valid MCP configurations should pass schema validation
Actual Behavior
- Any text after --mcp-config is treated as a file path (e.g., "Test prompt" becomes "/opt/Test prompt")
- Even empty {"mcpServers":{}} configurations fail schema validation
- The feature is completely broken and unusable
Workaround
The only workaround is to use claude mcp add-json to persistently configure servers:
claude mcp add-json test-fs '{"command":"npx","args":["@modelcontextprotocol/server-filesystem","/opt"]}' -s user
However, this loses the ability to have dynamic, per-project configurations.
Impact
This regression breaks all wrapper scripts and automation that rely on --mcp-config for dynamic MCP server configuration. Project-specific configurations (different paths,
credentials, etc.) can no longer be passed at runtime.
Additional Context
- This worked in previous versions (users report successful usage before Aug 11)
- The help text shows: --mcp-config <configs...> Load MCP servers from JSON files or strings (space-separated)
- The issue appears to be in the command-line parsing logic at /home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3373
Logs
Full error stack trace:
file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3373
);throw new Error(Invalid MCP configuration:
Error: Invalid MCP configuration:
MCP config file not found: /opt/Test prompt
Does not adhere to MCP server configuration schema
at QT0.<anonymous> (file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3373:10)
at QT0.B [as _actionHandler] (file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:667:528)
at file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:671:3127
at QT0._chainOrCall (file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:671:1694)
at QT0._parseCommand (file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:671:3103)
at QT0.parseAsync (file:///home/claude/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:668:4195)
---
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗