[BUG] Claude CLI non-interactive mode does not able to override global settings
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: <!-- specify -->
- Claude CLI version: 1.0.81
- Operating System: macOS 15.6
- Terminal: Zsh
Bug Description
Running claude \
-p \
--mcp-config playwright-mcp-config.json \
--allowedTools "mcp__playwright__browser_navigate,mcp__playwright__browser_type,mcp__playwright__browser_snapshot,mcp__playwright__browser_take_screenshot,mcp__playwright__browser_evaluate,mcp__playwright__browser_wait_for,mcp__playwright__browser_close,mcp__playwright__browser_press_key,Read,Write"
This will inherit all the tools and mcp servers from ~/.claude.json and there is no way to disable them, or to disable their tools.
disallowedTools and allowedTools do not work.
Steps to Reproduce
- Go to any folder
- Run command
- Log out the messages
Expected Behavior
I would expect that the global tools should not be applied to the non-interactive mode. If its that is expected behaviour, okay, but at least we should be able to disable them.
With disallowedTools and allowedTools we should be able to prevent global mcp tools from loading.
Similar issues:
https://github.com/anthropics/claude-code/issues/1188
https://github.com/anthropics/claude-code/issues/581
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗