Skip to content

fix: respect user-provided enableAllProjectMcpServers value#1182

Open
qozle wants to merge 1 commit intoanthropics:mainfrom
qozle:fix/respect-enableAllProjectMcpServers-false
Open

fix: respect user-provided enableAllProjectMcpServers value#1182
qozle wants to merge 1 commit intoanthropics:mainfrom
qozle:fix/respect-enableAllProjectMcpServers-false

Conversation

@qozle
Copy link
Copy Markdown
Contributor

@qozle qozle commented Apr 5, 2026

Fixes #1042

Root cause

setupClaudeCodeSettings unconditionally overwrites enableAllProjectMcpServers to true after merging the user's settings input, making it impossible to opt out of project MCP server loading:

// Always set enableAllProjectMcpServers to true
settings.enableAllProjectMcpServers = true;

Impact

Users with a .mcp.json containing local-path MCP servers (e.g., servers that require AWS credentials not available in CI) cannot suppress project MCP loading. Every action run generates permission denial errors for tools that were never meant to run in CI.

Fix

Replace the unconditional override with a nullish default so an explicit false (or true) from the user is preserved. Only absent values fall back to true:

settings.enableAllProjectMcpServers ??= true;

This matches the nullish-coalescing pattern already used elsewhere in the file (homeDir ?? homedir()).

Tests

  • Updated "should override enableAllProjectMcpServers even if false in input" → now verifies false is respected, not overridden
  • Added "should respect explicit true for enableAllProjectMcpServers" to cover the explicit-true case
  • All 665 existing tests pass

Previously, setupClaudeCodeSettings unconditionally overrode
enableAllProjectMcpServers to true after merging user settings,
making it impossible to disable project MCP servers via the
settings input.

Users with local .mcp.json files (e.g., servers requiring AWS
credentials not available in CI) had no way to suppress project
MCP loading and received permission denial errors on every run.

Change the override to a nullish default so an explicit false
(or true) is preserved; only absent values default to true.

Fixes anthropics#1042

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow disabling enableAllProjectMcpServers via settings input

1 participant