MCP Server Initialization Fails on First Run with Skip Permissions Flag
Bug Description
Summary
When adding an .mcp.json file to a project for the first time and starting Claude Code with the --dangerously-skip-permissions flag, MCP servers fail to load. The servers only initialize properly after starting Claude Code once without the flag, then subsequent runs with --dangerously-skip-permissions work correctly.
Steps to Reproduce
- Create a new project directory
- Add an
.mcp.jsonfile with MCP server configurations - Start Claude Code with:
claude --dangerously-skip-permissions - Observe that MCP servers are not loaded (no MCP tools available)
Expected Behavior
MCP servers defined in .mcp.json should load and be available regardless of whether --dangerously-skip-permissions flag is used, especially on first run.
Actual Behavior
- First run with
--dangerously-skip-permissions: MCP servers do not load - First run without the flag: MCP servers load correctly with permission prompts
- Subsequent runs with
--dangerously-skip-permissions: MCP servers load correctly
Workaround
- Start Claude Code once without the
--dangerously-skip-permissionsflag - Accept/configure permissions as prompted
- Exit Claude Code
- Restart with
--dangerously-skip-permissionsflag - servers now load correctly
Impact
This issue impacts developer workflow when:
- Setting up new projects with MCP configurations
- Using automation scripts that rely on
--dangerously-skip-permissions - Working in environments where interactive permission prompts are not feasible
Possible Root Cause
The --dangerously-skip-permissions flag may be bypassing initial MCP configuration parsing or initialization steps that are required on first run. These initialization steps appear to create necessary state/cache that allows subsequent runs to work correctly.
Suggested Fix
Ensure that MCP configuration parsing and initialization occurs regardless of permission flag status, with only the permission prompts being skipped when --dangerously-skip-permissions is used.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 1.0.84
- Feedback ID: