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
Copy file name to clipboardExpand all lines: docs/copilot/chat/mcp-servers.md
+51-11Lines changed: 51 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ By standardizing this interaction, MCP eliminates the need for custom integratio
28
28
29
29
### Supported MCP capabilities
30
30
31
-
VS Code supports local standard input/output (`stdio`) and server-sent events (`sse`) for MCP server transport. Currently of the [3 primitives](https://modelcontextprotocol.io/specification/2025-03-26#features) (`tools`, `prompts`, `resources`), servers can only provide `tools` to Copilot's agent mode. The list and descriptions of tools can be updated dynamically using *list changed* events. VS Code provides servers with the current workspace folders using `roots` ([spec](https://modelcontextprotocol.io/docs/concepts/roots)).
31
+
VS Code supports local standard input/output (`stdio`) and server-sent events (`sse`) for MCP server transport. Currently of the [three primitives](https://modelcontextprotocol.io/specification/2025-03-26#features) (`tools`, `prompts`, `resources`), servers can only provide `tools` to Copilot's agent mode. The list and descriptions of tools can be updated dynamically using *list changed* events. VS Code provides servers with the current workspace folders using `roots` ([spec](https://modelcontextprotocol.io/docs/concepts/roots)).
32
32
33
33
### Finding MCP servers
34
34
@@ -38,13 +38,31 @@ MCP is still a relatively new standard, and the ecosystem is rapidly evolving. A
38
38
39
39
## Add an MCP server
40
40
41
-
To add an MCP server to your workspace, follow these steps (see below for how to add a server to your user settings):
41
+
You have multiple options to add an MCP server in VS Code:
42
42
43
-
1. Configure an MCP server in the `.vscode/mcp.json` file in your workspace to share configurations with project collaborators. Make sure to avoid hardcoding sensitive information like API keys and other credentials by using input variables or environment files.
43
+
-**Workspace settings**: add a `.vscode/mcp.json` file in your workspace to configure MCP servers for a workspace and share configurations with team members.
44
+
-**User settings**: specify the server in your user settings to enable the MCP server across all workspaces.
45
+
-**Automatic discovery**: enable autodiscovery of MCP servers defined in other tools, such as Claude Desktop.
44
46
45
-
Create a `.vscode/mcp.json` file in your workspace and select the **Add Server** button to add a template for a new server. VS Code provides IntelliSense for the MCP server configuration file.
47
+
> [!CAUTION]
48
+
> MCP servers can run arbitrary code on your machine. Only add servers from trusted sources, and review the publisher and server configuration before starting it.
46
49
47
-
Alternatively, run the **MCP: Add Server** command from the Command Palette and provide the server information to add a new MCP server configuration. Choose **Workspace Settings** to create the `.vscode/mcp.json` file in your workspace if it doesn't already exist.
50
+
To view and manage the list of configured MCP servers, run the **MCP: List Servers** command from the Command Palette.
51
+
52
+
After you add an MCP server, you can [use the tools it provides in agent mode](#use-mcp-tools-in-agent-mode).
53
+
54
+
### Add an MCP server to your workspace
55
+
56
+
To configure an MCP server for a specific workspace, you can create a `.vscode/mcp.json` file in your workspace folder. This allows you to share the server configuration with project team members.
57
+
58
+
> [!IMPORTANT]
59
+
> Make sure to avoid hardcoding sensitive information like API keys and other credentials by using input variables or environment files.
60
+
61
+
To add an MCP server to your workspace:
62
+
63
+
1. Create a `.vscode/mcp.json` file in your workspace.
64
+
65
+
1. Select the **Add Server** button to add a template for a new server. VS Code provides IntelliSense for the MCP server configuration file.
48
66
49
67
The following example shows how to configure a [Perplexity MCP server](https://github.com/ppl-ai/modelcontextprotocol/), where VS Code prompts you for the API key when the server starts. Learn more about the [Configuration format](#configuration-format).
50
68
@@ -76,14 +94,36 @@ To add an MCP server to your workspace, follow these steps (see below for how to
76
94
}
77
95
```
78
96
79
-
1. Optionally, specify the server in the `setting(mcp)` VS Code [user settings](/docs/getstarted/personalize-vscode.md#configure-settings) to enable the MCP server across all workspaces.
97
+
1. Alternatively, run the **MCP: Add Server** command from the Command Palette, choose the type of MCP server to add and provide the server information. Next, select **Workspace Settings** to create the `.vscode/mcp.json` file in your workspace if it doesn't already exist.
98
+
99
+
### Add an MCP server to your user settings
100
+
101
+
To configure an MCP server for all your workspaces, you can add the server configuration to your user settings. This allows you to reuse the same server configuration across multiple projects.
102
+
103
+
Specify the server in the `setting(mcp)` VS Code [user settings](/docs/getstarted/personalize-vscode.md#configure-settings) to enable the MCP server across all workspaces.
104
+
105
+
```json
106
+
// settings.json
107
+
{
108
+
"mcp": {
109
+
"servers": {
110
+
"my-mcp-server": {
111
+
"type": "stdio",
112
+
"command": "my-command",
113
+
"args": []
114
+
}
115
+
}
116
+
},
117
+
}
118
+
```
119
+
120
+
Alternatively, use the **MCP: Add Server** command from the Command Palette, provide the server information, and then select **User Settings** to add the server configuration to your user settings.
80
121
81
-
If you use the **MCP: Add Server** command from the Command Palette, choose **User Settings** to add a new MCP server configuration in user settings.
122
+
### Automatic discovery of MCP servers
82
123
83
-
1. VS Code can automatically detect and reuse MCP servers that you defined in other tools, such as Claude Desktop.
84
-
Enable auto-discovery with the `setting(chat.mcp.discovery.enabled)` setting.
124
+
VS Code can automatically detect and reuse MCP servers that you defined in other tools, such as Claude Desktop.
85
125
86
-
1. Run the **MCP: List Servers** command from the Command Palette to view and manage the configured MCP servers.
126
+
Enable autodiscovery with the `setting(chat.mcp.discovery.enabled)` setting.
87
127
88
128
## Configuration format
89
129
@@ -235,7 +275,7 @@ This link can be used in a browser, or opened on the command line, for example v
0 commit comments