You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on May 15, 2026. It is now read-only.
[ENHANCEMENT] Per-Mode MCP Server Restrictions (Whitelist/Blacklist) to Prevent Context Bloat #12004
Currently, Roo Code lacks the ability to restrict which MCP servers are loaded on a per-mode basis. If a custom mode includes the "mcp" permission in its tool groups, Roo Code injects the descriptions and schemas for all globally and project-enabled MCP servers directly into the system prompt.
This brute-force approach causes severe issues:
Context Bloat: Dumping massive tool schemas into the prompt wastes thousands of tokens per request and degrades the model's reasoning capabilities.
Hard Tool Limits: Strict tool limits on modern models (e.g., the 128-tool limit) are easily exhausted when running multiple robust MCP servers simultaneously, causing API calls to outright fail.
Lack of Isolation: Specialized modes (e.g., a pure "Database Mode" or "Documentation Mode") get polluted with unrelated development tools, breaking the single-responsibility principle of Custom Modes.
Context (who is affected and when)
Happens for me when I want to use GPT5.4 which has a tool limit of 128.
Desired behavior (conceptual, not technical)
I would like the ability to explicitly whitelist or blacklist specific MCP servers within a custom mode's configuration (via .roomodes or the Custom Mode UI).
For example, adding an allowed_mcps or blocked_mcps array to the mode definition:
JSON
{
"customModes": [
{
"slug": "database-architect",
"name": "Database Architect",
"roleDefinition": "You manage the database schema...",
"groups": ["read", "edit", "mcp"],
"allowed_mcps": ["postgres-mcp", "redis-mcp"]
}
]
}
If allowed_mcps is defined, Roo Code should only inject the schemas for those specific servers into the system prompt for that mode, ignoring all other enabled MCPs.
Constraints / preferences (optional)
No response
Request checklist
I've searched existing Issues and Discussions for duplicates
This describes a specific problem with clear context and impact
@roomote , I approve this plan. This is exactly what I need and it will be great help. Allowlisting (aka whitelisting) is enoug which mean by default value of allowedMcpServers is * or all. * or all can be interpreted as the default behavior.
ghost added a commit that references this issue on Mar 27, 2026
Totally agree with this request. Once a mode pulls in every server schema, you lose both the mode boundary and hit the 128-tool limit fast.
As a temporary workaround until Roo gets native per-mode allowlists, I built an OSS compiler/gateway (toolc). You can feed it your existing MCP configs, and it compiles them into a smaller, filtered surface. This way, your mode points to one reduced endpoint instead of inheriting the whole noisy tool zoo.
Repo: https://github.com/aak204/Tool-Catalog-Compiler
Activity
simurg79 commentedon Mar 27, 2026
@roomote , I approve this plan. This is exactly what I need and it will be great help. Allowlisting (aka whitelisting) is enoug which mean by default value of allowedMcpServers is * or all. * or all can be interpreted as the default behavior.
feat: add per-mode MCP server allowlist (allowedMcpServers)
aak204 commentedon Apr 13, 2026
Totally agree with this request. Once a mode pulls in every server schema, you lose both the mode boundary and hit the 128-tool limit fast.
As a temporary workaround until Roo gets native per-mode allowlists, I built an OSS compiler/gateway (toolc). You can feed it your existing MCP configs, and it compiles them into a smaller, filtered surface. This way, your mode points to one reduced endpoint instead of inheriting the whole noisy tool zoo.
Repo: https://github.com/aak204/Tool-Catalog-Compiler