You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -29,73 +29,24 @@ You might consider implementing a language model tool with the [Language Model A
29
29
- You want to deeply integrate with VS Code by using extension APIs.
30
30
- You want to distribute your tool and updates by using the Visual Studio Marketplace.
31
31
32
-
## Add MCP servers to VS Code
33
-
34
-
Users can add MCP servers within VS Code in several ways:
35
-
36
-
- Workspace configuration: Specify the server configuration in a `.vscode/mcp.json` file in the workspace.
37
-
- Global configuration: Define servers globally in the user [profile](https://code.visualstudio.com/docs/configure/profiles).
38
-
- Autodiscovery: VS Code can discover servers from other tools like Claude Desktop.
39
-
- Extension: VS Code extensions can register MCP servers programmatically.
40
-
41
-
In addition, users can trigger MCP installation by opening a [special URL](#mcp-url-handler) (`vscode:mcp/install`), which is used in the [MCP gallery on the VS Code website](https://code.visualstudio.com/mcp). Users can access the gallery directly from the MCP view in the Extensions view.
42
-
43
-
Finally, install MCP servers from the [command line](/docs/copilot/chat/mcp-servers#_command-line-configuration) with the `--add-mcp` command-line option.
44
-
45
-
## Manage MCP servers
46
-
47
-
You can manage the list of installed MCP servers from the Extension view (`kb(workbench.view.extensions)`) in VS Code.
48
-
49
-

50
-
51
-
Right-click on an MCP server or select the gear icon to perform the following actions:
52
-
53
-
-**Start/Stop/Restart**: Start, stop, or restart the MCP server.
54
-
-**Disconnect Account**: Disconnect the account for authentication with the MCP server.
55
-
-**Show Output**: View the server logs to diagnose issues.
56
-
-**Show Configuration**: View the MCP server configuration.
57
-
-**Configure Model Access**: Configure which models the MCP server can access (sampling).
58
-
-**Show Sampling Requests**: View the sampling requests made by the MCP server.
59
-
-**Browse Resources**: View the resources provided by the MCP server.
60
-
-**Uninstall**: Uninstall the MCP server from your environment.
61
-
62
-
Alternatively, run the **MCP: List Servers** command from the Command Palette to view the list of configured MCP servers. You can then select a server and perform actions on it.
63
-
64
-
> [!TIP]
65
-
> When you open the `.vscode/mcp.json` file, VS Code shows commands to start, stop, or restart a server directly from the editor.
66
-
67
-

68
-
69
-
### MCP URL handler
70
-
71
-
VS Code provides a URL handler for installing an MCP server from a link. To form the URL, construct an `obj` object in the same format as you would provide to `--add-mcp`, and then create the link by using the following logic:
72
-
73
-
```typescript
74
-
// For Insiders, use `vscode-insiders` instead of `code`
75
-
const link =`vscode:mcp/install?${encodeURIComponent(JSON.stringify(obj))}`;
76
-
```
77
-
78
-
This link can be used in a browser, or opened on the command line, for example via `xdg-open $LINK` on Linux.
79
-
80
32
## MCP features supported by VS Code
81
33
82
-
VS Code supports the following transport methods for MCP servers:
83
-
84
-
- Standard input/output (`stdio`): Run a server as a local process that communicates over standard input and output
85
-
- Streamable HTTP (`http`): Communicate with a (remote) server using HTTP POST and GET
86
-
- Server-sent events (`sse`, legacy): Supported with a (remote) server over HTTP using server-sent events
34
+
VS Code supports the following MCP capabilities:
87
35
88
-
The following MCP features are supported in VS Code:
- Tools: Executable actions that can be used in [agent mode](/docs/copilot/chat/chat-agent-mode)
91
-
- Prompts: Reusable chat prompt templates, optionally with parameters, which users can invoke through slash commands(`/mcp.servername.promptname`) in chat
92
-
- Resources: Data and content which users can add as chat context or interact with directly in VS Code
93
-
- Authorization: Authorize access to an MCP server using OAuth
94
-
- Sampling _(Preview)_: Make language model requests using the user's configured models and subscription
95
-
- Elicitation: Request input from the user
96
-
- Workspace roots: Information about the user's workspace structure
97
-
98
-
For complete specification details, see the [Model Context Protocol documentation](https://modelcontextprotocol.io/).
* Tools: extend [agent mode](/docs/copilot/chat/chat-agent-mode) with extra tools
43
+
* Prompts: add reusable prompts as slash commands in chat
44
+
* Resources: provide data and content that users can add as chat context or interact with directly in VS Code
45
+
* Elicitation: request input from the user
46
+
* Sampling: make language model requests using the user's configured models and subscription
47
+
* Authentication: authorize access to an MCP server using OAuth
48
+
* Server instructions
49
+
* Roots: provide information about the user's workspace root folder(s)
99
50
100
51
### Tools
101
52
@@ -197,15 +148,15 @@ When DCR is not supported by the MCP server, users will go through the fallback
197
148
> [!NOTE]
198
149
> VS Code still supports MCP servers that behave as an authorization server, but it is recommended to use the latest specification for new servers.
199
150
200
-
### Sampling (Preview)
151
+
### Sampling
201
152
202
-
VS Code provides access to [sampling](https://modelcontextprotocol.io/docs/concepts/sampling) for MCP servers. This allows your MCP server to make language model requests using the user's configured models and subscriptions. Sampling can be used to summarize large data or extract information before sending it to the client, or to implement smarter agentic decision in tool logic.
153
+
VS Code provides access to [sampling](https://modelcontextprotocol.io/docs/concepts/sampling) for MCP servers. This allows your MCP server to make language model requests using the user's configured models and subscriptions. For example, use sampling to summarize large data sets, to extract information before sending it to the client, or to implement agentic decision logic in a tool.
203
154
204
155
The first time an MCP server performs a sampling request, the user is prompted to authorize the server to access their models.
205
156
206
157

207
158
208
-
Users can specify which models they allow the MCP server to use for sampling by using the **MCP: List Servers** > **Configure Model Access** command in the Command Palette. You can specify `modelPreferences` in your MCP server to provide hints about which models to use for sampling, and VS Code will pick from the allowed models when evaluating the server's preferences
159
+
When making sampling requests with specific models, consider that users can restrict which models an MCP server can use with the **MCP: List Servers** > **Configure Model Access** command in the Command Palette. When you specify `modelPreferences` in your MCP server to provide hints about which models to use for sampling, VS Code will pick from the allowed models.
209
160
210
161

211
162
@@ -215,6 +166,45 @@ Users can view the sampling requests made by an MCP server with the **MCP: List
215
166
216
167
VS Code provides the MCP server with the user's workspace root folder information.
217
168
169
+
## Add MCP servers to VS Code
170
+
171
+
Users can add MCP servers within VS Code in several ways:
172
+
173
+
- Install directly from the web: use a special MCP installation URL (`vscode:mcp/install`) on your website.
174
+
- Workspace configuration: Specify the server configuration in a `.vscode/mcp.json` file in the workspace.
175
+
- Global configuration: Define servers globally in the user [profile](/docs/configure/profiles).
176
+
- Autodiscovery: VS Code can discover servers from other tools like Claude Desktop.
177
+
- Extension: VS Code extensions can register MCP servers programmatically.
178
+
- Command line: Install MCP servers from the command line with the `--add-mcp` VS Code command-line option.
179
+
180
+
Learn more about the different ways to [add MCP servers to VS Code](/docs/copilot/customization/mcp-servers#add-an-mcp-server).
181
+
182
+
## Manage MCP servers
183
+
184
+
You can manage the list of installed MCP servers from the Extension view (`kb(workbench.view.extensions)`) in VS Code.
185
+
186
+

187
+
188
+
Right-click on an MCP server or select the gear icon to perform different management actions on the server. Alternatively, run the **MCP: List Servers** command from the Command Palette to view the list of configured MCP servers. You can then select a server and perform actions on it.
189
+
190
+
> [!TIP]
191
+
> When you open the `.vscode/mcp.json` file, VS Code shows commands in the editor to start, stop, or restart a server directly from the editor.
192
+
>
193
+
> 
194
+
195
+
## Create an MCP installation URL
196
+
197
+
VS Code provides a URL handler for installing an MCP server from a link: `vscode:mcp/install?{json-configuration}` (Insiders: `vscode-insiders:mcp/install?{json-configuration}`).
198
+
199
+
Provide the JSON server configuration in the form `{\"name\":\"server-name\",\"command\":...}` and then perform a JSON-stringify and URL encode on it. For example, use the following logic to create the installation URL:
200
+
201
+
```typescript
202
+
// For Insiders, use `vscode-insiders` instead of `code`
203
+
const link =`vscode:mcp/install?${encodeURIComponent(JSON.stringify(obj))}`;
204
+
```
205
+
206
+
This link can be used in a browser, or opened on the command line, for example via `xdg-open $LINK` on Linux.
207
+
218
208
## Register an MCP server in your extension
219
209
220
210
To register an MCP server in your extension, you need to perform the following steps:
@@ -322,31 +312,61 @@ export function activate(context: vscode.ExtensionContext) {
322
312
323
313
### MCP development mode in VS Code
324
314
325
-
When developing MCP servers, you can enable MCP development mode in VS Code. To enable development mode, add the `dev`property to your MCP server configuration and specify the following properties:
315
+
When developing MCP servers, you can enable _development mode_ for MCP servers by adding a `dev`key to the MCP server configuration. This is an object with two properties:
326
316
327
-
-`watch`: A glob pattern to watch for file changes to files and automatically restart the server
328
-
-`debug`: Debugger to attach to your MCP server process when starting it (currently only supported for servers launched with `node` or `python`)
317
+
*`watch`: A file glob pattern to watch for files change that will restart the MCP server.
318
+
*`debug`: Enables you to set up a debugger with the MCP server. Currently, VS Code supports debugging Node.js and Python MCP servers.
329
319
330
-
The following example shows how to configure a Node.js MCP server that watches for changes to TypeScript files in the `src` directory and uses the Node.js debugger:
320
+
<details>
321
+
<summary>Node.js MCP server</summary>
331
322
332
-
```json
333
-
{
334
-
"servers": {
335
-
"my-mcp-server": {
336
-
"type": "stdio",
337
-
"command": "node",
338
-
"cwd": "${workspaceFolder}",
339
-
"args": [
340
-
"./build/index.js"
341
-
],
342
-
"dev": {
343
-
"watch": "src/**/*.ts",
344
-
"debug": { "type": "node" }
323
+
To debug a Node.js MCP server, set the `debug.type` property to `node`.
324
+
325
+
```json
326
+
{
327
+
"servers": {
328
+
"my-mcp-server": {
329
+
"type": "stdio",
330
+
"command": "node",
331
+
"cwd": "${workspaceFolder}",
332
+
"args": [ "./build/index.js" ],
333
+
"dev": {
334
+
"watch": "src/**/*.ts",
335
+
"debug": { "type": "node" }
336
+
}
345
337
}
346
338
}
347
339
}
348
-
}
349
-
```
340
+
```
341
+
342
+
</details>
343
+
344
+
<details>
345
+
<summary>Python MCP server</summary>
346
+
347
+
To debug a Python MCP server, set the `debug.type` property to `debugpy`, and optionally set the `debug.debugpyPath` property to the path of the `debugpy` module if it is not installed in the default Python environment.
@@ -167,6 +178,19 @@ Configure autodiscovery with the `setting(chat.mcp.discovery.enabled)` setting.
167
178
168
179
</details>
169
180
181
+
<details>
182
+
<summary>Install an MCP server from the command line</summary>
183
+
184
+
You can also use the VS Code command-line interface to add an MCP server to your user profile or to a workspace.
185
+
186
+
To add an MCP server to your user profile, use the `--add-mcp` VS Code command line option, and provide the JSON server configuration in the form `{\"name\":\"server-name\",\"command\":...}`.
When VS Code starts the MCP server for the first time, it discovers the server's capabilities and tools. You can then [use these tools in agent mode](#use-mcp-tools-in-agent-mode). VS Code caches the list of tools for an MCP server. To clear the cached tools, use the **MCP: Reset Cached Tools** command in the Command Palette.
171
195
172
196
## View installed MCP servers
@@ -286,27 +310,6 @@ Alternatively, manually restart the MCP server from the Chat view, or by selecti
286
310
287
311

288
312
289
-
### Command-line configuration
290
-
291
-
You can also use the VS Code command-line interface to add an MCP server to your user profile or to a workspace.
292
-
293
-
To add an MCP server to your user profile, use the `--add-mcp` command line option, and provide the JSON server configuration in the form `{\"name\":\"server-name\",\"command\":...}`.
VS Code also includes a URL handler that you can use to install an MCP server. To form the URL, construct an `obj` object in the same format as you would provide to `--add-mcp`, and then create the link by using the following logic:
302
-
303
-
```typescript
304
-
// For Insiders, use `vscode-insiders` instead of `code`
305
-
const link =`vscode:mcp/install?${encodeURIComponent(JSON.stringify(obj))}`;
306
-
```
307
-
308
-
This link can be used in a browser, or opened on the command line, for example via `xdg-open $LINK` on Linux.
309
-
310
313
## Find MCP servers
311
314
312
315
MCP is still a relatively new standard, and the ecosystem is rapidly evolving. As more developers adopt MCP, you can expect to see an increasing number of servers and tools available for integration with your projects.
@@ -491,22 +494,9 @@ Select the error notification in the Chat view, and then select the **Show Outpu
491
494
You can enable _development mode_ for MCP servers by adding a `dev` key to the MCP server configuration. This is an object with two properties:
492
495
493
496
*`watch`: A file glob pattern to watch for files change that will restart the MCP server.
494
-
*`debug`: Enables you to set up a debugger with the MCP server.
497
+
*`debug`: Enables you to set up a debugger with the MCP server. Currently, VS Code supports debugging Node.js and Python MCP servers.
495
498
496
-
```json
497
-
{
498
-
"servers": {
499
-
"gistpad": {
500
-
"command": "node",
501
-
"args": ["build/index.js"],
502
-
"dev": {
503
-
"watch": "build/**/*.js",
504
-
"debug": { "type": "node" }
505
-
},
506
-
```
507
-
508
-
> [!NOTE]
509
-
> We currently only support debugging Node.js and Python servers launched with `node` and `python` respectively.
499
+
Learn more about [MCP development mode](/api/extension-guides/ai/mcp.md#mcp-development-mode-in-vs-code) in the MCP Dev Guide.
0 commit comments