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
description: Learn how to use built-in models or bring your own model (BYOM) in GitHub Copilot Chat for Visual Studio.
4
+
ms.date: 8/19/2025
5
+
ms.update-cycle: 180-days
6
+
ms.topic: get-started
7
+
author: anandmeg
8
+
ms.author: meghaanand
9
+
ms.manager: mijacobs
10
+
ms.subservice: ai-tools
11
+
ms.collection: ce-skilling-ai-copilot
12
+
monikerRange: '>= vs-2022'
13
+
---
14
+
# Using AI models in Copilot Chat
15
+
16
+
With Visual Studio 17.14, Copilot in Visual Studio uses **GPT-4.1** as the default model (previously GPT-4o). GPT-4.1 provides faster response times, higher quality suggestions, and improved efficiency for coding tasks.
17
+
18
+
However, you are not limited to using this model. You can also select from additional models or add your own, allowing you to choose the model that best fits your workflow requirements.
19
+
20
+
## Available models
21
+
22
+
Choose from an expanded set of models in the model picker:
23
+
24
+
- Claude Sonnet 4
25
+
- Claude Opus 4
26
+
- GPT-5
27
+
- Claude Sonnet 3.5
28
+
- Claude 3.7 (thinking and non-thinking)
29
+
- OpenAI o3-mini
30
+
- Gemini 2.0 Flash
31
+
- Gemini 2.5 Pro
32
+
33
+
**Model selection improvements**
34
+
35
+
-**Persistent selection**: The model you choose remains selected across chat threads.
36
+
-**Enable models directly**: If a model is available in your plan but not yet enabled, you’ll see a prompt in the model picker to activate it.
37
+
38
+
> Model availability depends on your Copilot subscription and the current status of each model. For Copilot Enterprise and Business, administrators must enable the **Preview** policy in Copilot settings before models are available in Visual Studio.
39
+
40
+
## Bring your own model (BYOM)
41
+
42
+
You can add your own language model to Copilot Chat by providing API keys from providers such as Anthropic, Google, or OpenAI. This allows you to select and configure custom AI models to match your workflow or to evaluate new model capabilities.
43
+
44
+
### Benefits
45
+
46
+
Using your own model enables you to:
47
+
48
+
- Expand model selection beyond built-in options, including new or experimental models.
49
+
- Meet infrastructure, security, or performance requirements with models that align to your needs.
50
+
- Control and monitor API usage directly with your chosen provider.
51
+
- Switch models easily between built-in and custom options.
52
+
53
+
### Get started
54
+
55
+
To add an API key:
56
+
57
+
1. In the bottom right of the chat view, select the **model picker** dropdown.
58
+
1. Select your provider (currently supported: **OpenAI**, **Anthropic**, and **Google**; additional providers may be added in future releases).
59
+
1. Enter your **API key**.
60
+
1. Select:
61
+
- Any standard model listed, or
62
+
- Any supported model offered by your provider, even if it doesn't appear in the default list.
63
+
1. Once added, the custom model appears in the model picker.
64
+
1. Start prompting in chat. Chat uses the custom model.
65
+
66
+
### Limitations and considerations
67
+
68
+
- Custom model support is limited to the Chat experience in Visual Studio and does not affect code completions or other AI-assisted features, such as commit message generation.
69
+
- Model capabilities depend on the provider; some models may not support features such as tool use, vision inputs, or advanced reasoning.
70
+
- Services like embeddings, intent detection, and repository indexing may continue to use the Copilot API.
71
+
- When using a custom model, output is returned directly from the provider and may bypass Copilot’s responsible AI filtering.
72
+
- Custom model support is **not** available for Copilot Business or Enterprise users.
73
+
74
+
## Related content
75
+
76
+
-[Choosing the right AI model for your task](https://docs.github.com/en/copilot/using-github-copilot/ai-models/choosing-the-right-ai-model-for-your-task)
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,22 +11,23 @@ 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
@@ -35,46 +36,122 @@ The following walkthrough requires 17.14.9 or later.
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
37
2. Paste the following contents into the `.mcp.json` file
37
38
38
-
```json
39
-
{
40
-
"servers": {
41
-
"github": {
42
-
"url": "https://api.githubcopilot.com/mcp/"
39
+
```json
40
+
{
41
+
"servers": {
42
+
"github": {
43
+
"url": "https://api.githubcopilot.com/mcp/"
44
+
}
43
45
}
44
46
}
45
-
}
46
-
```
47
+
```
47
48
48
49
3. 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
+
4. 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
+
5. 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
+
6. Try a sample prompt: `list issues assigned to me on GitHub`
60
+
7. 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
+
</br>
88
+
<details>
89
+
<summary><strong title="To add a one-click install button for any MCP server in Visual Studio:">Add one-click install button for MCP server</strong></summary>
3. Insert the URL-encoded JSON into the MCP URI format to form a Visual Studio install link.
123
+
124
+
Format:
125
+
126
+
```bash
127
+
vsweb+mcp:/install?<ENCODED_JSON>
128
+
```
129
+
130
+
4. Add the markdown badge to your GitHub repo/docs.
131
+
132
+
Example:
133
+
134
+
```markdown
135
+
[](vsweb+mcp:/install?<ENCODED_JSON>)
136
+
```
137
+
138
+
When a user clicks the badge, Visual Studio will launch (or prompt to open), and the MCP install dialog will appear, pre-filled with your server details.
139
+
140
+
<br />
141
+
</details>
142
+
143
+
### Add from chat view
144
+
145
+
To add an MCP server in Visual Studio:
146
+
147
+
1. Select the green plus (`+`) button in the tool picker in the chat window.
148
+
1. Specify the server name and connection details, such as the URL for HTTP servers or the command and arguments for stdio servers.
149
+
150
+
:::image type="content" source="media/vs-2022/mcp-servers/configure-server-visual-studio.png" alt-text="Screenshot that shows adding an MCP server from chat view." lightbox="media/vs-2022/mcp-servers/configure-server-visual-studio.png":::
74
151
75
152
### Create a file to manage configuration of MCP servers
76
153
77
-
If you do not already have an `mcp.json` file, you can create it in various locations depending on the repos, users, and IDEs you would like the servers to be available/used for.
154
+
If you do not already have an `mcp.json` file, create oneinany of the supported locations based on your repository, user, or IDE requirements. To add an MCP server, locate the server’s JSON configuration online (for example, from the GitHub MCP servers repository) and paste it into your `mcp.json` file.
78
155
79
156
### File locations for automatic discovery of MCP configuration
80
157
@@ -94,7 +171,7 @@ MCP server configurations are read from the following directories, in the follow
94
171
95
172
Some of these locations require `.mcp.json` while others require `mcp.json`.
96
173
97
-
###MCP configuration format
174
+
## MCP configuration format
98
175
99
176
You may define both **remote** (URL and credentials) and **local** (command-line invocation) servers.
100
177
@@ -110,7 +187,7 @@ When the file is saved with valid syntax, GitHub Copilot's agent restarts and re
110
187
111
188
:::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
189
113
-
### Tool Lifecycle
190
+
### Tool lifecycle
114
191
115
192
As soon as a server is discovered or added:
116
193
@@ -133,11 +210,19 @@ You can reset tool confirmation selections in **Tools** > **Options** > **GitHub
133
210
134
211
:::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
212
213
+
## Manage authorization
214
+
215
+
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.
216
+
217
+
To manage authentication for an MCP server:
218
+
- Select **Manage Authentication** for that server from CodeLens in the `.mcp.json` file.
219
+
- Provide credentials for the necessary OAuth provider for that server in the browser pop-up.
220
+
136
221
## Frequently asked questions
137
222
138
223
#### As an administrator, how do I control use of MCP servers in agent mode for Visual Studio users?
139
224
140
-
Agent mode and MCP usage in Visual Studio are governed by the **Editor preview features** flag in the GitHub Copilot dashboard for administrators.
225
+
Agent mode and MCP usage in Visual Studio are governed by the GitHub policy settings in the GitHub Copilot dashboard for administrators.
141
226
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
227
143
228
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