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/ide/mcp-servers.md
+50-19Lines changed: 50 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: 'Use MCP servers (Preview)'
3
-
description: Adding MCP servers in Visual Studio to extend GitHub Copilot agent capabilities, setting up mcp.json and managing tool permissions.
4
-
ms.date: 6/18/2025
2
+
title: 'Use MCP servers'
3
+
description: Learn how to add MCP servers in Visual Studio to extend GitHub Copilot agent capabilities, set up mcp.json, and manage tool permissions.
4
+
ms.date: 8/19/2025
5
5
ms.update-cycle: 180-days
6
6
ms.topic: get-started
7
7
author: anandmeg
@@ -11,29 +11,30 @@ ms.subservice: ai-tools
11
11
ms.collection: ce-skilling-ai-copilot
12
12
monikerRange: '>= vs-2022'
13
13
---
14
-
# Use MCP servers (Preview)
14
+
# Use MCP servers
15
15
16
16
Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and services through a unified interface. In Visual Studio, MCP support enhances GitHub Copilot's agent mode by allowing you to connect any MCP-compatible server to your agentic coding workflow. This article guides you through setting up MCP servers and using tools with agent mode in Visual Studio.
17
17
18
18
## Prerequisites
19
-
+[Visual Studio 2022 version 17.14](/visualstudio/releases/2022/release-history) or later. The latest servicing release of 17.14 is highly recommended as MCP features are actively being added with each release.
19
+
+[Visual Studio 2022 version 17.14](/visualstudio/releases/2022/release-history) or later.
20
+
The latest servicing release of 17.14 is highly recommended as MCP features are actively being added with each release.
20
21
21
22
## How do MCP and Visual Studio extend GitHub Copilot's agent?
22
23
23
-
* MCP clients, such as Visual Studio connect to MCP servers and request actions on behalf of the AI model
24
+
* MCP clients, such as Visual Studio connect to MCP servers and request actions on behalf of the AI model.
24
25
* MCP servers provide one or more tools that expose specific functionalities through a well-defined interface.
25
-
* The Model Context Protocol (MCP) defines the message format for communication between clients and servers, including tool discovery, invocation, and response handling
26
+
* The Model Context Protocol (MCP) defines the message format for communication between clients and servers, including tool discovery, invocation, and response handling.
26
27
27
28
For example, a file system MCP server might provide tools for reading, writing, or searching files and directories. [GitHub's official MCP server](https://github.com/github/github-mcp-server) offers tools to list repositories, create pull requests, or manage issues. MCP servers can run locally on your machine or be hosted remotely, and Visual Studio supports both configurations.
28
29
29
-
By standardizing this interaction, MCP eliminates the need for custom integrations between each AI model and each tool. This allows you to extend your AI assistant's capabilities by simply adding new MCP servers to your workspace. Learn more about the Model Context Protocol specification.
30
+
By standardizing this interaction, MCP eliminates the need for custom integrations between each AI model and each tool. This allows you to extend your AI assistant's capabilities by simply adding new MCP servers to your workspace. Learn more about the [Model Context Protocol specification](https://modelcontextprotocol.io/specification/draft).
30
31
31
32
## Configuration example with GitHub MCP server
32
33
33
34
The following walkthrough requires 17.14.9 or later.
34
35
35
36
1. Create a new file: `<SOLUTIONDIR>\.mcp.json` or `%USERPROFILE%\.mcp.json`. Using Visual Studio to edit this file is recommended so its JSON schema is automatically applied.
36
-
2. Paste the following contents into the `.mcp.json` file
37
+
1. Paste the following contents into the `.mcp.json` file
37
38
38
39
```json
39
40
{
@@ -45,32 +46,54 @@ The following walkthrough requires 17.14.9 or later.
45
46
}
46
47
```
47
48
48
-
3. Save the file, then activate the CodeLens that appears over the new server to authenticate to this server using a GitHub account.
49
+
1. Save the file, then activate the CodeLens that appears over the new server to authenticate to this server using a GitHub account.
49
50
50
-
5. In Visual Studio, click the `Ask` dropdown in the GitHub Copilot Chat window, and then select `Agent`.
51
+
1. In Visual Studio, click the `Ask` dropdown in the GitHub Copilot Chat window, and then select `Agent`.
7. Select the tools you'd like to use, for example, `list_issues`
55
+
1. Select the tools you'd like to use, for example, `list_issues`
55
56
56
57
:::image type="content" source="media/vs-2022/mcp-servers/model-context-protocol-github-tools-list.png" alt-text="Screenshot that shows MCP GitHub tools." lightbox="media/vs-2022/mcp-servers/model-context-protocol-github-tools-list.png":::
57
58
58
-
8. Try a sample prompt: `list issues assigned to me on GitHub`
59
-
9. Copilot asks for permission to use a tool made available to it by the MCP server, select **Allow** with the scope you wish to proceed with.
59
+
1. Try a sample prompt: `list issues assigned to me on GitHub`
60
+
1. Copilot asks for permission to use a tool made available to it by the MCP server, select **Allow** with the scope you wish to proceed with.
60
61
61
62
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-tool-approval.png" alt-text="Screenshot that shows the agent tools confirmation options." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-tool-approval.png":::
62
63
63
64
## Supported MCP capabilities
64
65
65
-
Visual Studio supports local standard input/output (`stdio`), server-sent events (`sse`), and streamable HTTP (`http`) 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. Visual Studio provides servers with the current solution folders using `roots`[(spec)](https://modelcontextprotocol.io/docs/concepts/roots).
66
+
Visual Studio supports the following MCP capabilities:
67
+
68
+
- MCP Server transport: Local standard input/output (`stdio`), server-sent events (`sse`), and streamable HTTP (`http`).
69
+
- MCP features: 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.
70
+
- Visual Studio provides servers with the current solution folders using `roots`[(spec)](https://modelcontextprotocol.io/docs/concepts/roots).
71
+
-[MCP authorization](https://modelcontextprotocol.io/specification/draft/basic/authorization): Visual Studio supports authentication for remote servers with any OAuth provider.
66
72
67
73
## Finding MCP servers
68
74
69
75
MCP's [official server repository](https://github.com/modelcontextprotocol/servers) is a great starting point for reference, official, and community-contributed servers that showcase MCP's versatility. You can explore servers for various functionalities, such as file system operations, database interactions, and web services.
70
76
71
77
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.
72
78
73
-
## Adding an MCP server
79
+
## Add an MCP server
80
+
81
+
You have multiple options to add an MCP server in Visual Studio:
82
+
83
+
### One-click install from the web
84
+
85
+
With the latest servicing release of 17.14, Visual Studio now supports direct installation of MCP Servers. You can click the **Install** button on an MCP server to automatically add it to your Visual Studio instance.
86
+
87
+
To add a one-click install button to your MCP server repo, or if you notice one missing from a public server repo, you can create one using the following protocol handler template:
88
+
89
+
### Add from chat view
90
+
91
+
To add an MCP server in Visual Studio:
92
+
93
+
1. Select the green plus (`+`) button in the tool picker in the chat window.
94
+
1. Specify the server name, input method, any arguments, and URL for HTTP servers.
95
+
96
+
:::image type="content" source="media/vs-2022/mcp-servers/configure-server-visual-studio.png" alt-text="Screenshot that shows the agent tools confirmation options." lightbox="media/vs-2022/mcp-servers/configure-server-visual-studio.png":::
74
97
75
98
### Create a file to manage configuration of MCP servers
76
99
@@ -94,7 +117,7 @@ MCP server configurations are read from the following directories, in the follow
94
117
95
118
Some of these locations require `.mcp.json` while others require `mcp.json`.
96
119
97
-
###MCP configuration format
120
+
## MCP configuration format
98
121
99
122
You may define both **remote** (URL and credentials) and **local** (command-line invocation) servers.
100
123
@@ -110,7 +133,7 @@ When the file is saved with valid syntax, GitHub Copilot's agent restarts and re
110
133
111
134
:::image type="content" source="media/vs-2022/mcp-servers/model-context-protocol-add-solution-item.png" alt-text="Screenshot that shows adding the MCP configuration file location to Solution Items." lightbox="media/vs-2022/mcp-servers/model-context-protocol-add-solution-item.png":::
112
135
113
-
### Tool Lifecycle
136
+
### Tool lifecycle
114
137
115
138
As soon as a server is discovered or added:
116
139
@@ -133,11 +156,19 @@ You can reset tool confirmation selections in **Tools** > **Options** > **GitHub
133
156
134
157
:::image type="content" source="media/vs-2022/copilot-agent-mode/copilot-agent-tool-config.png" alt-text="Screenshot that shows the tools configuration setting." lightbox="media/vs-2022/copilot-agent-mode/copilot-agent-tool-config.png":::
135
158
159
+
## Manage authorization
160
+
161
+
Visual Studio now supports authentication for remote servers with any OAuth provider, per [MCP authorization spec](https://modelcontextprotocol.io/specification/draft/basic/authorization), in addition to integration with the Visual Studio keychain.
162
+
163
+
To manage authentication for an MCP server:
164
+
- Select **Manage Authentication** for that server from CodeLens in the `.mcp.json` file.
165
+
- Provide credentials for the necessary OAuth provider for that server in the browser pop-up.
166
+
136
167
## Frequently asked questions
137
168
138
169
#### As an administrator, how do I control use of MCP servers in agent mode for Visual Studio users?
139
170
140
-
Agent mode and MCP usage in Visual Studio are governed by the **Editor preview features** flag in the GitHub Copilot dashboard for administrators.
171
+
Agent mode and MCP usage in Visual Studio are governed by the GitHub policy settings in the GitHub Copilot dashboard for administrators.
141
172
If the administrator turns off this setting, users under that subscription won’t be able to use agent mode or connect to MCP servers in Visual Studio.
142
173
143
174
For more information, see [managing policies and features for copilot in your enterprise](https://docs.github.com/en/enterprise-cloud@latest/copilot/managing-copilot/managing-copilot-for-your-enterprise/managing-policies-and-features-for-copilot-in-your-enterprise#editor-preview-features).
0 commit comments