Repository navigation
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
Draft
Martin Aeschlimann (aeschli) wants to merge 1 commit into
Martin Aeschlimann (aeschli) wants to merge 1 commit into
Conversation
…ig.json or .mcp.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 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.jsonand 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
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.


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
IEditableMcpServerConfigurationgets aremove()next tosave().McpWorkbenchService.resolveEditableMcpServerConfigurationimplements it withIMcpResourceScannerService.removeMcpServersfor both the Copilot globalmcp-config.jsonand workspace root.mcp.json.McpListWidgetresolves 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
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.tsandembeddedMcpServerDetail.test.tspass (161 tests);tsc --noEmitonsrc/tsconfig.jsonand oxlint on the changed files are clean.Agent harness