Skip to content

Add a Remove action for agent host MCP servers configured in mcp-config.json or .mcp.json - #350857

Draft
Martin Aeschlimann (aeschli) wants to merge 1 commit into
mainfrom
aeschli/agent-fix-20261127-154713-7xw2
Draft

Martin Aeschlimann (aeschli) wants to merge 1 commit into
mainfrom
aeschli/agent-fix-20261127-154713-7xw2

Conversation

@aeschli

Copy link
Copy Markdown
Contributor

Root cause

On the MCP Servers page of the Customizations dialog, servers that an agent host session discovers itself (for example from the Copilot CLI's ~/.copilot/mcp-config.json) are shown as session server rows. Their menu only had lifecycle, enablement and Server Options actions, so there was no way to remove such a server, although VS Code can already edit these shared files.

Fix

  • IEditableMcpServerConfiguration gets a remove() next to save(). McpWorkbenchService.resolveEditableMcpServerConfiguration implements it with IMcpResourceScannerService.removeMcpServers for both the Copilot global mcp-config.json and workspace root .mcp.json.
  • McpListWidget resolves the editable configuration of a session server row (not plugin-provided or client-bundled) before it shows the row's menu, and adds a Remove action at the end. It asks for confirmation, since other clients use the same file, and reports failures.

Verification

  • New unit test in mcpListWidget.test.ts: the menu of a server from an editable file ends with Remove, which removes it only after confirmation; servers from other files or plugins get no Remove. The test fails without the change.
  • mcpListWidget.test.ts and embeddedMcpServerDetail.test.ts pass (161 tests); tsc --noEmit on src/tsconfig.json and oxlint on the changed files are clean.
  • Not verified in a running Code OSS.

Agent harness

  • Run: 20261127-154713-7xw2
  • Copilot CLI: 1.0.99-2
  • Model: Claude (Copilot SDK in VS Code)
  • User-provided skills: dbgjs, mark-vscode-window

…ig.json or .mcp.json

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Pending configuration resolution can make Remove target a different file than the confirmation identifies, while out-of-order requests can replace the current row’s menu with stale actions.

2 open issues
What changed in this PR

Adds a Remove action for agent-host MCP servers configured in shared files, using the existing MCP configuration-editing service.

Changes:

  • Extends editable server configurations with removal support for Copilot’s mcp-config.json and workspace .mcp.json.
  • Adds a conditional Remove menu action with confirmation and error reporting.
  • Tests removal eligibility and confirmation, and updates existing mocks.
File Description
src/​vs/​workbench/​test/​browser/​componentFixtures/​sessions/​aiCustomizationManagementEditor.fixture.ts Adds removal stubs to configuration fixtures.
src/​vs/​workbench/​contrib/​mcp/​common/​mcpTypes.ts Adds remove() to the editable configuration interface.
src/​vs/​workbench/​contrib/​mcp/​browser/​mcpWorkbenchService.ts Implements removal through the resource scanner.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​aiCustomization/​mcpListWidget.test.ts Tests menu eligibility and confirmed removal.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​aiCustomization/​embeddedMcpServerDetail.test.ts Updates configuration mocks for the interface change.
src/​vs/​workbench/​contrib/​chat/​browser/​aiCustomization/​mcpListWidget.ts Resolves editable configurations and adds the Remove action.

Review effort: Balanced

}
}

private getMcpServerActions(entry: IMcpInstalledEntry, disposables: DisposableStore, editable?: IEditableMcpServerConfiguration): IAction[] {
this.showConnectorActions(entry.connector.connector, anchor);
return;
}
const editable = await this.resolveEditableSessionServerConfiguration(entry);

This branch has not been deployed

No deployments
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