[Bug] MCP Server Detection Fails with --dangerously-skip-permissions

Resolved 💬 3 comments Opened Aug 30, 2025 by fank Closed Aug 31, 2025

Bug Description

When a repository contains a .mcp.json file with MCP server configurations, Claude Code does not automatically detect or use these servers when running with the --dangerously-skip-permissions flag, even though this flag is meant to bypass permission checks.

Steps to Reproduce

  1. Have a repository with a valid .mcp.json file in the root (e.g., configuring a gopls MCP server)
  2. Start Claude Code with claude --dangerously-skip-permissions
  3. Run claude mcp list
  4. Observe: "No MCP servers configured" message appears, project MCP servers are not detected

Expected Behavior

When using --dangerously-skip-permissions, project-level MCP configurations should be automatically trusted and loaded without requiring user interaction.

Actual Behavior

Project MCP servers are only recognized after:

  1. Running Claude Code once WITHOUT the --dangerously-skip-permissions flag
  2. Explicitly trusting the MCP servers when prompted
  3. Then subsequent runs with --dangerously-skip-permissions work correctly

Workaround

Start Claude Code once without --dangerously-skip-permissions to trust the project's MCP servers, then the flag works as expected in future sessions.

Impact

This creates confusion for users who expect --dangerously-skip-permissions to bypass all permission checks, and makes automated/CI workflows more difficult since they require an initial manual trust step.

Environment Info

  • Platform: linux
  • Terminal: windows-terminal
  • Version: 1.0.98
  • Feedback ID:

Errors

[{"error":"Error: Request was aborted.\n    at d71._createMessage (file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:970:7955)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-30T06:27:10.913Z"},{"error":"AggregateError\n    at sc.from (file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:671:39831)\n    at zK.I1 (file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:674:10122)\n    at zK.emit (node:events:507:28)\n    at zK.emit (node:domain:489:12)\n    at mm1.<computed> (file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:25:1161)\n    at ClientRequest.emit (node:events:507:28)\n    at ClientRequest.emit (node:domain:489:12)\n    at emitErrorEvent (node:_http_client:104:11)\n    at TLSSocket.socketErrorListener (node:_http_client:518:5)\n    at TLSSocket.emit (node:events:507:28)\n    at w21.request (file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:676:2088)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async oF5 (file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2429:470)\n    at async Promise.all (index 0)\n    at async file:///home/fank/.nvm/versions/node/v24.1.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:9180","timestamp":"2025-08-30T06:34:57.069Z"}]

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗