feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4)#218
Open
xinyi-gong wants to merge 3 commits into
Open
feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4)#218xinyi-gong wants to merge 3 commits into
xinyi-gong wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the tool auto-approve feature suite by adding (1) MCP tool auto-approve (per-tool/per-server, session/global) and (2) a global “auto-approve everything” (YOLO) toggle, wiring both into confirmation evaluation and preferences UI.
Changes:
- Added MCP-specific confirmation evaluation + preference UI (server/tool tree + optional trust of MCP annotations).
- Added global auto-approve (YOLO) preference UI and a short-circuit in
ConfirmationService. - Added unit tests for MCP confirmation behavior and manual SWTBot test plans.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/messages.properties | Adds preference UI strings for MCP + global auto-approve sections. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/Messages.java | Exposes new NLS keys for the added preference strings. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/McpAutoApproveSection.java | New preference section implementing MCP server/tool approval tree + trust-annotations toggle. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/GlobalAutoApproveSection.java | New preference section implementing global auto-approve (YOLO) toggle with warning dialog. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/CopilotPreferenceInitializer.java | Initializes default values for new auto-approve preferences. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/preferences/AutoApprovePreferencePage.java | Adds the new MCP + global sections to the Tool Auto Approve preference page and binds MCP config service. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/McpConfigService.java | Exposes MCP server/tool collections to the auto-approve section via a side-effect binding. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/messages.properties | Adds MCP confirmation dialog/action strings. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/Messages.java | Exposes new MCP confirmation dialog/action NLS keys. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/McpConfirmationHandler.java | New handler implementing MCP confirmation evaluation + session/global persistence + trust annotations. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationService.java | Wires MCP handler and adds global YOLO short-circuit before classification. |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/McpConfirmationHandlerTests.java | Adds unit tests for MCP confirmation evaluation, caching, and content/action structure. |
| com.microsoft.copilot.eclipse.swtbot.test/test-plans/mcp-auto-approve/mcp-auto-approve.md | Manual end-to-end test plan for MCP auto-approve scenarios. |
| com.microsoft.copilot.eclipse.swtbot.test/test-plans/global-auto-approve/global-auto-approve.md | Manual end-to-end test plan for global auto-approve scenarios. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/Constants.java | Adds new preference keys for MCP auto-approve and global auto-approve. |
dc87261 to
8e1094a
Compare
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.
Summary
Adds MCP tool auto-approve and a global auto-approve toggle, completing the auto-approve feature suite.
Changes
MCP Auto-Approve
McpConfirmationHandler: Evaluates MCP tool confirmation requests against session and global approval lists. Supports per-tool and per-server approval at both session and global scopes.readOnlyHint=true+openWorldHint=false) via a "Trust MCP Tool Annotations" toggle.McpAutoApproveSection: Preference page UI with a live tree of MCP servers/tools, loading state to prevent empty-list flash, and correct tree expand-before-setChecked to ensure ChatView "Always Allow" selections sync to the preference page.McpConfigService: Exposes MCP server/tool collections to the preference section.ConfirmationServicewired to dispatch toMcpConfirmationHandler.Global Auto-Approve
GlobalAutoApproveSection: Preference UI for the global YOLO toggle, with a confirmation dialog on enable and a warning label.ConfirmationServiceshort-circuits all tool confirmations when global auto-approve is enabled.Tests & Docs
McpConfirmationHandlerTests: 24 unit tests covering global list evaluation (case-insensitive), trust annotations logic, session approval caching/clearing, andbuildContentaction structure.test-plans/mcp-auto-approve/mcp-auto-approve.md(TC-001–006) andtest-plans/global-auto-approve/global-auto-approve.md(TC-001–003).To test the "Trust MCP Tool Annotations" feature, use the GitHub MCP server — its
get_metool hasreadOnlyHint=trueandopenWorldHint=false, making it eligible for annotation-based auto-approve.Add the following to your MCP config (
settings.jsonormcp.json):Preference page:

No servers and tools registered:

Global approve confirm dialog:

Chat view confirm dialog:
