-
Notifications
You must be signed in to change notification settings - Fork 312
DISABLE_TOOL_VALIDATION doesn't affect SDK-level allowed_tools, blocking MCP tools #91
Description
Problem
When using MCP servers (e.g., Home Assistant MCP), all mcp__* tool calls are blocked because:
DISABLE_TOOL_VALIDATION=trueonly skips the bot-sideToolMonitorchecks inmonitor.py- The hardcoded default
claude_allowed_toolslist (17 tools) is still passed toClaudeAgentOptions(allowed_tools=...)insdk_integration.py:177 - The Claude Code CLI enforces this list independently, blocking any tool not in the default list
This means MCP tools like mcp__home-assistant__ha_get_overview are always blocked, regardless of DISABLE_TOOL_VALIDATION.
Why CLAUDE_ALLOWED_TOOLS doesn't help
The env var uses exact string matching (tool_name not in list), so prefix patterns like mcp__home-assistant don't match mcp__home-assistant__ha_get_overview. Users would need to list every individual MCP tool name, which is impractical since MCP servers can expose dozens of tools and the list changes when the server is updated.
Expected behavior
When DISABLE_TOOL_VALIDATION=true, the SDK should receive allowed_tools=None (allow all) instead of the hardcoded default list. This would let the Claude Code CLI allow all tools, including MCP tools.
Suggested fix
In sdk_integration.py, check disable_tool_validation before passing the list:
options = ClaudeAgentOptions(
allowed_tools=None if self.config.disable_tool_validation else self.config.claude_allowed_tools,
disallowed_tools=None if self.config.disable_tool_validation else self.config.claude_disallowed_tools,
...
)Alternatively, support wildcard/prefix matching in CLAUDE_ALLOWED_TOOLS (e.g., mcp__home-assistant matching all tools from that server).
Workaround
We're currently patching sdk_integration.py in our container entrypoint to replace allowed_tools=self.config.claude_allowed_tools with allowed_tools=None when DISABLE_TOOL_VALIDATION=true.