Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #11971
Description
This PR implements the
onlyAllowfeature for MCP server tool configuration, allowing users to specify an allowlist of tools instead of a denylist for servers with many tools.Key changes:
src/services/mcp/McpHub.ts): AddedonlyAllow: z.array(z.string()).optional()toBaseConfigSchemawith documentation explaining its precedence overdisabledTools.src/services/mcp/McpHub.ts):fetchToolsList()to readonlyAllowfrom config and apply precedence rules: whenonlyAllowis non-empty, it takes precedence overdisabledToolstoggleToolEnabledForPrompt()with smart config-aware logic: whenonlyAllowis active, tool toggles modify the allowlist; otherwise uses existingdisabledToolsbehaviorupdateServerToolList()signature to support"onlyAllow"as a list typesrc/services/mcp/__tests__/McpHub.spec.ts): Added 7 comprehensive test cases covering all scenarios:fetchToolsList: basic allowlist filtering, precedence overdisabledTools, fallback behavior, empty array handlingtoggleToolEnabledForPrompt: adding/removing tools from allowlist, fallback todisabledToolswhen allowlist is emptyNo breaking changes: Existing configurations without
onlyAllowwork exactly as before. Full backward compatibility maintained.Test Procedure
Manual verification (optional):
~/.config/Roo Code/mcp.jsonwith a test server usingonlyAllow:{ "mcpServers": { "test-server": { "command": "npx", "args": ["-y", "some-mcp-server"], "onlyAllow": ["tool_a", "tool_b", "tool_c"] } } }Verify in Roo Code's MCP settings that only the listed tools are enabled for prompt use.
Pre-Submission Checklist
onlyAllowsupport (one feature per PR).Screenshots / Videos
N/A — backend feature with no UI changes.
Documentation Updates
No documentation updates required in this PR. However, if Roo Code maintains user-facing MCP configuration documentation, it should mention the new
onlyAllowoption and its precedence rules.Additional Notes
enabledForPromptmechanismenabledForPromptonlyAlloware completely unaffectedGet in Touch
Discord: dmjdarshan
Interactively review PR in Roo Code Cloud