Vritant Bhardwaj 205d0627ee mcp: show where built-in MCP servers come from (#339427)
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:

https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->

Fixes #338719

The MCP server details in Chat Customizations didn't say where built-in
servers come from. The header showed a made-up `mcp.json`, and
Configuration only said "No definition is available". This PR uses what
the agent runtime already reports about each server (its source, display
name and contributing plugin) to show the real origin, and explains when
there's nothing to show.

### What you'll see

| MCP server | Before | Now |
|---|---|---|
| `github-mcp-server` (built into Copilot CLI) | Made-up `mcp.json`
label; "No definition is available" | **Built-in: Copilot**.
Configuration explains that Copilot sets it up, with an **Open
Settings** link to `chat.agentHost.githubMcpServer.enabled` |
| Copilot connector, e.g. "Linear (Connector)" | Made-up `mcp.json`
label; "No definition is available" | **Managed by Copilot**, and an
explanation of why there's no definition |
| GitHub server from the Copilot Chat extension (local chat) | No source
| **Built-in: GitHub Copilot Chat**, linking to the extension; the `...`
menu gains **Show Extension** |
| Added via **MCP: Add Server → Add to Current Agent Session** | Could
land under Built-In; no definition | Listed under **User**, labelled
**Agent host configuration**, with its definition |
| Reported as user or workspace config, but no file is known | Made-up
`mcp.json` label | **User configuration** / **Workspace configuration**
|
| Configured in an `mcp.json` or another app's config file | File link
and Edit Configuration | Unchanged. Built-in rows backed by another
app's file (e.g. Claude Desktop) also get **Show Configuration** in the
`...` menu |

### How it works

- The Copilot agent host forwards the runtime's `sourcePlugin` (from
`session.mcp.list`) as optional, namespaced `_meta` on MCP server
customizations. Other agent hosts can leave it out.
- The agent host also declares, in `_meta`, the setting that controls a
server it adds itself. The UI only offers **Open Settings** when the
host declares one.
- The details page shows where a server comes from when there's no file
to open, and an explanation when the agent owns the definition.
- An open details page updates when the agent host reports new metadata.
For example, a server in a restored session gets its origin and settings
link once the runtime reports it, without reopening the page.
- `getMcpServers()` also exposes the definition the agent host's own
configuration holds for a server, so servers added there show their
definition.

### Notes for reviewers

- Connector names come from the connector catalog (#339431). This PR
doesn't forward the runtime's own `displayName`: for anything other than
a connector it falls back to the server's advertised title, which would
rename servers that users configured.
- Copilot Chat's own servers keep their extension ID (to link to it) but
stay under Built-In.
- The setting link is never inferred from a server's name. Another agent
host, a plugin, or a user's config can also publish a
`github-mcp-server` that `chat.agentHost.githubMcpServer.enabled` can't
control, so Copilot declares the setting only for the runtime's own
GitHub server.
- Not in this PR: showing a built-in server's tools or instructions, or
its actual definition (the Copilot SDK doesn't expose it).

### How to test

1. In a Copilot CLI agent session, open Chat Customizations → MCP
Servers and select `github-mcp-server`. The header says "Built-in:
Copilot", Configuration explains why there's no definition, and **Open
Settings** opens `chat.agentHost.githubMcpServer.enabled`.
2. Run **MCP: Add Server → Add to Current Agent Session**. The server is
listed under User with "Agent host configuration" and its definition.
3. In a local chat, select Copilot's GitHub server. The header links to
GitHub Copilot Chat, and `...` → **Show Extension** opens it.
4. A server from `.vscode/mcp.json` still shows its file link and Edit
Configuration.
5. Open a server's details while a resumed Copilot CLI session is still
starting. Once the runtime reports the server, the details update
(origin, settings link) without reopening.

The `EmbeddedMcpDetailBuiltinAgent` and
`EmbeddedMcpDetailBuiltinExtension` component fixtures show the new
details states.

Validation (run locally on top of current `main`):

- Unit tests: passed, 1236 passing and 0 failing.
  ```
  ./scripts/test.sh \
--run src/vs/platform/agentHost/test/common/agentMetaReaders.test.ts \
--run
src/vs/platform/agentHost/test/common/metadataCompatibility.test.ts \
--run
src/vs/platform/agentHost/test/node/shared/mcpCustomizationController.test.ts
\
--run src/vs/platform/agentHost/test/node/shared/githubMcpServer.test.ts
\
--run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts \
--run
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostCustomizationService.test.ts
\
--run
src/vs/workbench/contrib/chat/test/browser/aiCustomization/embeddedMcpServerDetail.test.ts
\
--run
src/vs/workbench/contrib/chat/test/browser/aiCustomization/mcpListWidget.test.ts
\
--run
src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationManagementEditor.test.ts
\
--run
src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatMcpAuthenticationContentPart.test.ts
\
--run
src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatMcpServersStartingContentPart.test.ts
\
--run
src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatToolAuthenticationSubPart.test.ts
  ```
- Connector-name suites from #339431: passed.
`copilotSessionLauncher.test.ts` and `stateToProgressAdapter.test.ts`
had 301 passing; `mcpCommands.test.ts` had 2 passing.
- `npx tsc --project ./src/tsconfig.json --noEmit --skipLibCheck`: no
errors in code this PR changes. My locally installed dependencies are
older than `main`'s lockfile (Copilot SDK 1.0.15-preview.4 vs
1.0.17-preview.4). That causes 23 errors about newer APIs (`proxyCa`,
`managedSettings.resolve`, `FoundryLocalManager`), all in lines this PR
doesn't change.
- `npx eslint --max-warnings 0` on the changed files: passed.
- `node build/stylelint.ts
src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css`:
passed.
- `node build/checker/layersChecker.ts`: passed.
- Pre-commit hygiene: passed.
2026-10-05 13:39:24 -08:00
…
2026-10-05 04:39:50 +00:00
…
…

Visual Studio Code - Open Source ("Code - OSS")

Feature Requests Bugs

The Repository

This repository ("Code - OSS") is where we (Microsoft) develop the Visual Studio Code product together with the community. Not only do we work on code and issues here, but we also publish our roadmap, monthly iteration plans, and our endgame plans. This source code is available to everyone under the standard MIT license.

Visual Studio Code

VS Code in action

Visual Studio Code is a distribution of the Code - OSS repository with Microsoft-specific customizations released under a traditional Microsoft product license.

Visual Studio Code combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. It provides comprehensive code editing, navigation, and understanding support along with lightweight debugging, a rich extensibility model, and lightweight integration with existing tools.

Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on the Visual Studio Code website. To get the latest releases every day, install the Insiders build.

Contributing

There are many ways in which you can participate in this project, for example:

If you are interested in fixing issues and contributing directly to the codebase, please see the document How to Contribute, which covers the following:

Feedback

See our wiki for a description of each of these channels and information on some other available community-driven channels.

Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the node debug adapter and the mono debug adapter repositories are separate from each other. For a complete list, please visit the Related Projects page on our wiki.

Bundled Extensions

VS Code includes a set of built-in extensions located in the extensions folder, including grammars and snippets for many languages. Extensions that provide rich language support (inline suggestions, Go to Definition) for a language have the suffix language-features. For example, the json extension provides coloring for JSON and the json-language-features extension provides rich language support for JSON.

Development Container

This repository includes a Visual Studio Code Dev Containers / GitHub Codespaces development container.

  • For Dev Containers, use the Dev Containers: Clone Repository in Container Volume... command, which creates a Docker volume for better disk I/O on macOS and Windows.

    • If you already have VS Code and Docker installed, you can also click here to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
  • For Codespaces, install the GitHub Codespaces extension in VS Code, and use the Codespaces: Create New Codespace command.

Docker / the Codespace should have at least 4 cores and 6 GB of RAM (8 GB recommended) to run a full build. See the development container README for more information.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

Languages
TypeScript 82%
JSON 14.2%
CSS 1.4%
JavaScript 0.5%
C 0.5%
Other 1%