Skip to content

feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4)#218

Open
xinyi-gong wants to merge 3 commits into
feature/auto-approvefrom
tori/auto-approve-mcp
Open

feat: MCP tool auto-approve and global auto-approve (Auto-approve Part 4)#218
xinyi-gong wants to merge 3 commits into
feature/auto-approvefrom
tori/auto-approve-mcp

Conversation

@xinyi-gong
Copy link
Copy Markdown
Member

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.
  • Trust annotations: Optional auto-approve for read-only/closed-world tools (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.
  • ConfirmationService wired to dispatch to McpConfirmationHandler.

Global Auto-Approve

  • GlobalAutoApproveSection: Preference UI for the global YOLO toggle, with a confirmation dialog on enable and a warning label.
  • ConfirmationService short-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, and buildContent action structure.
  • Manual test plans: test-plans/mcp-auto-approve/mcp-auto-approve.md (TC-001–006) and test-plans/global-auto-approve/global-auto-approve.md (TC-001–003).
  • Testing Trust Annotations (read-only tool auto-approve)

To test the "Trust MCP Tool Annotations" feature, use the GitHub MCP server — its get_me tool has readOnlyHint=true and openWorldHint=false, making it eligible for annotation-based auto-approve.

Add the following to your MCP config (settings.json or mcp.json):

"io.github.github/github-mcp-server": {
  "type": "http",
  "url": "https://api.githubcopilot.com/mcp/",
  "requestInit": {
    "headers": {}
  },
  "x-metadata": {
    "registry": {
      "api": {
        "baseUrl": "https://api.mcp.github.com",
        "version": "v0.1"
      },
      "mcpServer": {
        "name": "io.github.github/github-mcp-server",
        "version": "1.0.4"
      }
    }
  }
}

Preference page:
image

No servers and tools registered:
image

Global approve confirm dialog:
image

Chat view confirm dialog:
image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@xinyi-gong xinyi-gong force-pushed the tori/auto-approve-mcp branch from dc87261 to 8e1094a Compare May 19, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants