[BUG] Interactive mode hangs when prompt follows --mcp-config (argument order)
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 using --mcp-config in interactive mode (no -p), placing the prompt after the flag causes claude to hang indefinitely with no output. Placing the prompt before the flags works fine.
This seems to contradict the documented usage: claude [options] [command] [prompt]
I saw some older closed issues about --mcp-config argument parsing (#5593, #16122) but those were about error messages, not hangs. And they were closed for inactivity rather than being fixed. This might be related or might be something different - not totally sure.
What Should Happen?
Based on the help text, this should work:
claude --mcp-config config.json "my prompt"
Steps to Reproduce
# This HANGS indefinitely (documented order):
claude --strict-mcp-config --mcp-config /path/to/config.json "say hello"
# This WORKS (undocumented order):
claude "say hello" --strict-mcp-config --mcp-config /path/to/config.json
The MCP config file is valid JSON with mcpServers defined. The hang happens before any UI appears - just a blank terminal.
Using -p (print mode) with the documented order works fine, so this seems specific to interactive mode.
Error Messages/Logs
No error messages - it just hangs with no output.
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.29
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Workaround from the older issues (-- separator) might work here too, haven't tested it. For now I'm just putting the prompt first which does the job.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗