[FEATURE] MCP Tool names in allowedTools
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Currently claude agent sdk and claude code allow you to set a list of allowed tools.
Since tools don't allow regex, its suoper hard to include dynamically added MCP tool names at time of execution.
Example:
You have an image generation MCP that you add to the SDK. You have explicit deny and allow rules for security and production readyness. You want to allow to execute this with a dynamic selection of which MCPs should be used.
In this case you have no way of defining the names of the mcp tools that should be allowed here because you would have to inspect all tools by those MCPs by instantiating them first.
Proposed Solution
Allow prefix or regex for tool names in allowedTools string array e.g. ["mcp__image-generation__:*"]
Alternative Solutions
_No response_
Priority
Critical - Blocking my work
Feature Category
MCP server integration
Use Case Example
In enterprise autonomous scenarios we want to allow the user executing it to be able to pick which MCP servers they want to attach to the execution and auto allow their tools.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗