Skip to content

Conversation

@ziqch
Copy link

@ziqch ziqch commented Dec 26, 2025

Summary

  • Adds granular control for MCP (Model Context Protocol) tool auto-approval, allowing users to selectively approve specific MCP servers and their individual tools instead of all-or-nothing approval
  • Implements automatic migration from the old boolean mcp setting to the new granular mcpServers structure with sensible defaults
  • Enhances the auto-approve UI with an expandable MCP section that displays server status, tool counts, and per-tool selection

Key Changes

Auto-Approve Settings Store (store.ts)

  • Extended AutoApprove interface to include mcpServers?: Record<string, { tools: string[] }> for granular per-server, per-tool configuration
  • Maintained backward compatibility with existing mcp: boolean flag

MCP Auto-Approve Section Component (mcp-auto-approve-section.tsx)

  • Created new expandable/collapsible UI component for MCP server and tool selection
  • Displays real-time server status indicators (stopped, starting, ready, error)
  • Shows tool selection count for each server (e.g., "5/12 selected")
  • Supports "Select All" / "Clear All" actions per server
  • Handles disabled tools gracefully (preserves selections even when tools are temporarily disabled)
  • Sorted servers and tools alphabetically to prevent false dirty state

Migration Hook (use-mcp-auto-approve-defaults.ts)

  • Automatically migrates old settings when mcp: true but mcpServers is undefined
  • Enables all available MCP servers and their non-disabled tools by default on first migration
  • Persists settings automatically after migration

Tool Auto-Approval Logic (use-tool-auto-approval.ts)

  • Updated to check granular mcpServers configuration instead of just the boolean mcp flag
  • Only approves MCP tools that are explicitly included in a server's tools array

Auto-Approve Menu (auto-approve-menu.tsx)

  • Removed MCP from the core action settings list
  • Integrated new McpAutoApproveSection component
  • Updated MCP summary display to show in the button text when enabled

Internationalization

  • Added translations for all new UI elements across English, Japanese, Korean, and Chinese locales
  • New keys: noMcpServers, noToolsAvailable, selectAll, clearAll, toolsSelectedCount, loading

Test Plan

  • Verify migration from old mcp: true setting automatically enables all servers and tools
  • Verify migration from old mcp: false setting maintains disabled state
  • Test selecting/deselecting individual MCP servers
  • Test selecting/deselecting individual tools within servers
  • Test "Select All" and "Clear All" buttons for a server
  • Verify disabled tools are preserved in selection when toggled
  • Verify server status indicators display correctly for different states
  • Test that only explicitly approved MCP tools are auto-approved during agent execution
  • Verify settings persistence across sessions

🤖 Generated with Claude Code

iShot_2025-12-26_13 43 38

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 447 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.99%. Comparing base (a6c5be4) to head (15fa56c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...s/settings/components/mcp-auto-approve-section.tsx 0.00% 355 Missing and 1 partial ⚠️
...es/settings/hooks/use-mcp-auto-approve-defaults.ts 0.00% 64 Missing and 1 partial ⚠️
...features/settings/components/auto-approve-menu.tsx 0.00% 12 Missing ⚠️
.../features/settings/hooks/use-tool-auto-approval.ts 0.00% 12 Missing ⚠️
...ckages/vscode-webui/src/features/settings/store.ts 0.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #962      +/-   ##
==========================================
- Coverage   16.13%   15.99%   -0.14%     
==========================================
  Files         568      570       +2     
  Lines       51996    52432     +436     
  Branches     1694     1613      -81     
==========================================
  Hits         8388     8388              
- Misses      43376    43810     +434     
- Partials      232      234       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wsxiaoys wsxiaoys marked this pull request as draft December 31, 2025 05:23
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