Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 12, 2025

This PR attempts to address Issue #9204. Feedback and guidance are welcome.

Problem

When using an MCP tool action with auto-approve set (alwaysAllowMcp: true), Roo was still asking for approval. This was a regression introduced in version 3.31.1 after the auto-approval logic was moved from the webview to the Task class in PR #9157.

Root Cause

The regression was caused by a change in the auto-approval logic that required BOTH:

  1. The global alwaysAllowMcp setting to be true
  2. Each individual MCP tool to have alwaysAllow property set to true

This was different from the previous behavior where setting alwaysAllowMcp would auto-approve ALL MCP tools by default.

Solution

Modified the auto-approval logic in checkAutoApproval to:

  • Auto-approve all MCP tools when alwaysAllowMcp is true (restoring previous behavior)
  • Still respect individual tool opt-outs when a tool explicitly sets alwaysAllow: false
  • This provides backward compatibility while allowing fine-grained control when needed

Changes

  • Updated src/core/auto-approval/index.ts to fix the MCP auto-approval logic
  • Added comprehensive test coverage in src/core/auto-approval/__tests__/checkAutoApproval.spec.ts

Testing

  • Added 10 new test cases covering various MCP auto-approval scenarios
  • All existing tests continue to pass
  • Verified that tools can still opt-out by setting alwaysAllow: false

Fixes #9204


Important

Restores MCP tool auto-approval behavior when alwaysAllowMcp is true, with individual tool opt-out support, and adds comprehensive test coverage.

  • Behavior:
    • Restores MCP tool auto-approval when alwaysAllowMcp is true in checkAutoApproval in index.ts.
    • Respects individual tool opt-outs with alwaysAllow: false.
  • Testing:
    • Adds 10 new test cases in checkAutoApproval.spec.ts for various MCP auto-approval scenarios.
    • Ensures all existing tests pass.
  • Misc:
    • Handles missing or unknown servers and tools gracefully in checkAutoApproval.

This description was created by Ellipsis for b8f00cc. You can customize this summary. It will automatically update as commits are pushed.

…nabled

- Fixed regression introduced in #9157 where MCP tools required individual alwaysAllow property
- When alwaysAllowMcp is true, all MCP tools are now auto-approved by default
- Tools can still opt-out by explicitly setting alwaysAllow=false
- Added comprehensive tests for MCP auto-approval scenarios

Fixes #9204
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 12, 2025 20:46
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 12, 2025
@dosubot dosubot bot added the bug Something isn't working label Nov 12, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. Found 1 minor issue that should be addressed.

  • Remove unused isMcpToolAlwaysAllowed import from src/core/auto-approval/index.ts

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

import type { McpServer, McpTool } from "../../shared/mcp"

import { isWriteToolAction, isReadOnlyToolAction } from "./tools"
import { isMcpToolAlwaysAllowed } from "./mcp"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isMcpToolAlwaysAllowed import is no longer used after refactoring the MCP auto-approval logic. This unused import should be removed to keep the code clean.

Fix it with Roo Code or mention @roomote and request a fix.

@daniel-lxs daniel-lxs closed this Nov 12, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 12, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] MCP tool action asks for approval even if set to auto-approve

3 participants