Skip to content

fix: clean up MCP server display and add CONCAT merge strategy for mcp allowed/excluded lists#2219

Merged
tanzhenxin merged 1 commit intoQwenLM:mainfrom
LaZzyMan:fix-mcp-extension-ui
Mar 10, 2026
Merged

fix: clean up MCP server display and add CONCAT merge strategy for mcp allowed/excluded lists#2219
tanzhenxin merged 1 commit intoQwenLM:mainfrom
LaZzyMan:fix-mcp-extension-ui

Conversation

@LaZzyMan
Copy link
Copy Markdown
Collaborator

@LaZzyMan LaZzyMan commented Mar 9, 2026

TLDR

This PR makes two improvements to the MCP (Model Context Protocol) configuration:

  1. Remove redundant scope field from MCPServerDisplayInfo: The scope field ('user' | 'workspace' | 'extension') duplicated the intent of the existing source field ('user' | 'project' | 'extension'). All usages of scope are replaced with source, simplifying the data model.

  2. Add CONCAT merge strategy for mcp.allowed and mcp.excluded: These array settings now use MergeStrategy.CONCAT so that allowed/excluded MCP server lists from different settings scopes (system, user, workspace) are concatenated rather than replaced. This enables administrators to build cumulative allow/exclude lists across configuration levels.

Dive Deeper

Scope field removal

  • Removed scope: 'user' | 'workspace' | 'extension' from the MCPServerDisplayInfo interface in types.ts
  • Updated MCPManagementDialog.tsx to derive scope from server.source directly instead of a separate scope field
  • Updated ServerDetailStep.tsx to use server.source for display logic
  • Cleaned up redundant scope-determination logic in the dialog component

Merge strategy change

  • Added mergeStrategy: MergeStrategy.CONCAT to both mcp.allowed and mcp.excluded in the settings schema
  • Updated test expectations in settings.test.ts to reflect the concatenation behavior

Reviewer Test Plan

  1. Pull the branch and run npx vitest run packages/cli/src/config/settings.test.ts — all 87 tests should pass
  2. Verify MCP server management dialog still correctly shows server source (User Settings / Workspace Settings / Extension)
  3. Test disabling an MCP server from different scopes to verify the source-based logic works correctly

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

…CAT merge strategy for mcp allowed/excluded lists
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 9, 2026

📋 Review Summary

This PR makes two well-executed improvements to the MCP (Model Context Protocol) configuration: removing a redundant scope field from MCPServerDisplayInfo and adding CONCAT merge strategy for mcp.allowed and mcp.excluded arrays. The changes simplify the data model and enable cumulative allow/exclude lists across configuration scopes. All tests pass successfully.

🔍 General Feedback

  • The PR is well-scoped and focused on two distinct but related improvements to MCP configuration handling
  • Test updates are appropriate and all 87 settings tests + 16 MCP utils tests pass
  • The removal of the redundant scope field simplifies the data model without losing functionality
  • The CONCAT merge strategy change is a sensible improvement for administrative use cases
  • Good practice of updating test expectations to reflect the new concatenation behavior
  • The PR description is thorough with a clear testing matrix and reviewer instructions

🎯 Specific Feedback

🟡 High

  • File: packages/cli/src/ui/components/mcp/steps/ServerDetailStep.tsx:136-142 - The code still references server.scope in the ternary expression, but the scope field has been removed from the type definition. This appears to be an incomplete migration - the code should use server.source instead. The condition checks server.scope === 'user' and server.scope === 'workspace' but should check server.source === 'user' and server.source === 'project' respectively (note: 'workspace' should become 'project' to match the new naming convention).

🔵 Low

  • File: packages/cli/src/ui/components/mcp/types.ts:37-38 - The comment /** 配置所在的 scope */ (Chinese comment for "configuration scope") remains even though the scope field was removed. Consider removing this orphaned comment to avoid confusion.

  • File: packages/cli/src/ui/components/mcp/types.ts:36 - The comment /** 来源类型 */ for the source field is in Chinese while other comments in the codebase appear to be in English. Consider standardizing to English comments for consistency (e.g., /** Source type */).

  • File: packages/cli/src/ui/components/mcp/steps/ServerDetailStep.tsx - Multiple Chinese comments throughout the file (e.g., // 标签列宽度, // 根据服务器状态动态生成可用操作). While this may be a team preference, consider standardizing to English comments for better international collaboration.

✅ Highlights

  • Clean removal of redundant data fields with proper updates to all usages
  • The CONCAT merge strategy is a thoughtful addition that enables better administrative control over MCP server configurations
  • Test expectations were properly updated to reflect the new concatenation behavior (e.g., allowed: ['server1', 'server2', 'server3', 'server1', 'server2'] showing cumulative merging)
  • Good separation of concerns - the PR focuses on two related but distinct improvements
  • The PR description includes a comprehensive testing matrix and clear instructions for reviewers

Copy link
Copy Markdown
Collaborator

@tanzhenxin tanzhenxin left a comment

Choose a reason for hiding this comment

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

LGTM!

@tanzhenxin tanzhenxin merged commit 9154048 into QwenLM:main Mar 10, 2026
15 checks passed
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