简介
The Model Context Protocol (MCP) is an open standard that defines how applications share context with large language models (LLMs). For an overview of MCP, see About Model Context Protocol (MCP).
For a curated list of MCP servers from partners and the community, see the GitHub MCP Registry.
企业和组织可以通过 MCP servers in Copilot 策略,为其成员启用或禁用 MCP 的使用。该策略默认是禁用的。请参阅在企业中管理 GitHub Copilot 的策略和功能以及在组织中管理 GitHub Copilot 的策略和功能。MCP 策略仅适用于拥有组织或企业为其配置了该策略的 Copilot Business 或 Copilot Enterprise 订阅的用户。Copilot Free、Copilot Pro 或 Copilot Pro+ 不受此策略控制其 MCP 访问权限。
先决条件
- 拥有 Copilot 访问权限。请参阅 什么是 GitHub Copilot?。
- Visual Studio Code version 1.99 or later. For information on installing Visual Studio Code, see the Visual Studio Code download page.
- 如果您是拥有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“Copilot 中的 MCP 服务器”策略才能在 Copilot 中使用 MCP。
Configuring MCP servers in Visual Studio Code
MCP servers can be configured manually in a configuration file, or through the GitHub MCP Registry. The GitHub MCP Registry provides a curated list of MCP servers that you can easily add to your Visual Studio Code instance.
Using the GitHub MCP Registry
注意
The GitHub MCP Registry is in public preview and may change.
Only MCP servers listed in the GitHub MCP Registry can be added through the registry. Other servers can be configured manually. See Configuring MCP servers manually.
- In Visual Studio Code, open the extensions panel by clicking the extensions icon in the sidebar or pressing Ctrl+Shift+X (Windows/Linux) / Command+Shift+X (Mac).
- In the extensions search bar, type
@mcpfollowed by the name of the MCP server you want to add. This opens the MCP server gallery and shows matching results. - Select the MCP server from the search results. On the MCP server's details page, click Install.
- When prompted, confirm that you trust the server to start it. VS Code discovers the server's tools and makes them available in chat.
- To verify that the MCP server is configured correctly, open the command palette by pressing Ctrl+Shift+P (Windows/Linux) / Command+Shift+P (Mac).
- Type and select MCP: List Servers. You should see the MCP server listed as a configured server.
Configuring MCP servers manually
To configure MCP servers in Visual Studio Code, you need to set up a configuration script that specifies the details of the MCP servers you want to use. You can configure MCP servers for either
-
A specific repository. This enables you to share MCP servers with anyone who opens the project in Visual Studio Code. To do this, create a
.vscode/mcp.jsonfile in the root of your repository. -
Your personal instance of Visual Studio Code. You will be the only person who has access to configured MCP servers. To do this, add the configuration to your
settings.jsonfile in Visual Studio Code. MCP servers configured this way will be available in all workspaces.注意
We recommend you use only one location per server. Adding the same server to both locations may cause conflicts and unexpected behavior.
The steps below show how to configure the Fetch MCP server in your .vscode/mcp.json file. The Fetch MCP server is a simple MCP server that provides web content fetching capabilities. For more information on the Fetch MCP server, see the Fetch directory in the MCP Server repository.
You can use the same steps to configure MCP servers in your personal Visual Studio Code settings. Details on how to configure other MCP servers are available in the MCP servers repository.
For information on configuring the GitHub MCP server, see Using the GitHub MCP Server in your IDE.
-
Add the following configuration to your
.vscode/mcp.jsonfileJSON { "inputs": [ // The "inputs" section defines the inputs required for the MCP server configuration. { "type": "promptString" } ], "servers": { // The "servers" section defines the MCP servers you want to use. "fetch": { "command": "uvx", "args": ["mcp-server-fetch"] } } }{ "inputs": [ // The "inputs" section defines the inputs required for the MCP server configuration. { "type": "promptString" } ], "servers": { // The "servers" section defines the MCP servers you want to use. "fetch": { "command": "uvx", "args": ["mcp-server-fetch"] } } } -
Save the
.vscode/mcp.jsonfile. -
A "Start" button will appear in your
.vscode/mcp.jsonfile, at the top of the list of servers. Click the "Start" button to start the MCP servers. This will trigger the input dialog and discover the server tools, which are then stored for later sessions.
-
打开 Copilot Chat,请点击位于 Visual Studio Code 标题栏的图标。
-
In the Copilot Chat box, select Agent from the popup menu.

-
To view your list of available MCP servers, click the tools icon in the top left corner of the chat box. This will open the MCP server list, where you can see all the MCP servers and associated tools that are currently available in your Visual Studio Code instance.
- Optionally, you can define toolsets, groups of related tools that you can reference in chat. Toolsets make it easier to group related MCP tools together and quickly enable or disable them. For information on how to define and use a toolset, see the VS Code docs.
For more information on configuring MCP servers in Visual Studio Code, see Use MCP servers in Visual Studio Code in the Visual Studio Code documentation.
Using MCP servers in Copilot Chat
Once you have configured your MCP servers, you can use them in Copilot Chat to access a wide range of tools and services. In the example below, we will use the Fetch MCP server to fetch details about a web page.
-
打开 Copilot Chat,请点击位于 Visual Studio Code 标题栏的图标。
-
In the Copilot Chat box, select Agent from the agent dropdown menu.
-
In the file with the MCP configuration, check that the MCP server is running. If it is not running, click the "Start" button to start the MCP server.

-
Ask Copilot Chat to fetch the details of a URL. For example
Fetch https://github.com/github/docs. -
If Copilot asks you to confirm that you want to proceed, click Continue.
-
Copilot will fetch the details of the URL and display them in the chat box.
Optionally, you can use MCP prompts and resources in VS Code.
- MCP servers can define preconfigured prompts for interacting with their tools. You can access these prompts in chat with slash commands, using the format
/mcp.servername.promptname. - MCP servers provide resources, which are any kind of data that the server wants to make available. For example, the GitHub MCP server provides repository content as a resource. To add resources from an MCP server to your chat context, click Add Context... in the chat box, then click MCP Resources.
For more information on using MCP servers in Visual Studio Code, see Use MCP servers in Visual Studio Code in the Visual Studio Code documentation.
Using existing MCP configurations
If you already have an MCP configuration in Claude Desktop, you can use that configuration in Visual Studio Code to access the same MCP servers. To do this, add the following configuration to your settings.json file in Visual Studio Code
"chat.mcp.discovery.enabled": true
"chat.mcp.discovery.enabled": true
Visual Studio Code will automatically find your existing configuration and use it in your Visual Studio Code instance.
先决条件
- 拥有 Copilot 访问权限。请参阅 什么是 GitHub Copilot?。
- Visual Studio version 17.14 or later. For more information on installing Visual Studio, see the Visual Studio downloads page.
- Sign in to GitHub from Visual Studio.
- 如果您是拥有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“Copilot 中的 MCP 服务器”策略才能在 Copilot 中使用 MCP。
Configuring MCP servers in Visual Studio
-
在 Visual Studio 菜单栏中,点击 View (视图),然后点击 GitHub Copilot Chat。
-
在聊天面板底部,从模式下拉列表中选择 Agent。
-
在 Copilot 聊天窗口中,点击工具图标,然后在工具选择器窗口中点击加号图标。
-
In the "Configure MCP server" pop-up window, fill out the fields, including server ID, type, and any additional fields required for the specific MCP server configuration.
Visual Studio supports both remote and local servers. Remote servers, defined with a URL and credentials, are hosted externally for easier setup and sharing, while local servers, defined with command-line invocation, run on your local machine and can access local resources. See example configurations below, using the GitHub MCP server as an example.
-
点击保存。
-
If you are using a remote server with OAuth authentication, in the
mcp.jsonfile, click Auth from the CodeLens above the server to authenticate to the server. A pop-up or new window will appear, allowing you to authenticate with your account. The server will only be able to access the scopes you approve, and that your organization policies allow. -
In the Copilot Chat window, click the tools icon. You should now see additional tools from the MCP server that you configured.
Remote server configuration example with OAuth
-
对于 “Server ID”,输入
github。 -
对于 “Type”,从下拉列表中选择 “HTTP/SSE”。
-
For "URL", type
https://api.githubcopilot.com/mcp/. -
After clicking Save, the configuration in the
mcp.jsonfile should look like thisJSON { "servers": { "github": { "url": "https://api.githubcopilot.com/mcp/" } } }{ "servers": { "github": { "url": "https://api.githubcopilot.com/mcp/" } } } -
In the
mcp.jsonfile, click Auth from the CodeLens above the server to authenticate to the server. A pop-up will come up allowing you to authenticate with your GitHub account.
Local server configuration example
-
对于 “Server ID”,输入
github。 -
For "Type", select "stdio" from the dropdown.
-
For "Command (with optional arguments)", type
docker "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" -
Add an environment variable "GITHUB_PERSONAL_ACCESS_TOKEN" set to your personal access token.
-
After clicking Save, the configuration in the
mcp.jsonfile should look like thisJSON { "servers": { "github": { "type": "stdio", "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT" } } } }{ "servers": { "github": { "type": "stdio", "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT" } } } }
For more information on configuring MCP servers in Visual Studio, see Use MCP servers in Visual Studio (Preview) in the Visual Studio documentation.
先决条件
-
拥有 Copilot 访问权限。请参阅 什么是 GitHub Copilot?。
-
A compatible JetBrains IDE. GitHub Copilot is compatible with the following IDEs
- IntelliJ IDEA (Ultimate, Community, Educational)
- Android Studio
- AppCode
- CLion
- Code With Me Guest
- DataGrip
- DataSpell
- GoLand
- JetBrains Client
- MPS
- PhpStorm
- PyCharm (Professional, Community, Educational)
- Rider
- RubyMine
- RustRover
- WebStorm
- Writerside
请参阅 JetBrains IDEs 工具查找器进行下载。
-
如果您是拥有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“Copilot 中的 MCP 服务器”策略才能在 Copilot 中使用 MCP。
Configuring MCP servers from your MCP registry
- 在您的 JetBrains IDE 中,打开 Copilot Chat。
- 在 Copilot Chat 窗口,单击MCP icon.
- In the MCP Registry window, find the MCP server(s) you want to add from the list of available servers.
- Next to each MCP server you want to add, click Install.
- When you are finished adding MCP servers, click OK.
- In the Copilot Chat window, click the tools icon. You should now see additional tools from the MCP server(s) that you installed.
Configuring MCP servers manually
- 在右下角,点击 .
- 在菜单中选择 “Open Chat”,确保已切换到 Agent 模式,然后点击聊天窗口底部的工具图标(名为 “Configure your MCP server”)。
- 点击 Add MCP Tools。
- In the
mcp.jsonfile, define your MCP servers. JetBrains IDEs support both remote and local servers. Remote servers are hosted externally for easier setup and sharing, while local servers run on your local machine and can access local resources.
You can use the following configurations as examples
Remote server configuration example with PAT
{
"servers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"requestInit": {
"headers": {
"Authorization": "Bearer YOUR_PAT_HERE"
}
}
}
}
}
{
"servers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"requestInit": {
"headers": {
"Authorization": "Bearer YOUR_PAT_HERE"
}
}
}
}
}
Local server configuration example
{
"servers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
{
"servers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
先决条件
- 拥有 Copilot 访问权限。请参阅 什么是 GitHub Copilot?。
- GitHub Copilot for Xcode extension. See Installing the GitHub Copilot extension in your environment.
- 如果您是拥有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“Copilot 中的 MCP 服务器”策略才能在 Copilot 中使用 MCP。
Configuring MCP servers from your MCP registry
- 在 Xcode 中,打开 Copilot Chat。
- 在 Copilot Chat 窗口,单击图标打开设置。
- 在设置窗口,选择 Tools 选项卡。
- Next to MCP Registry URL (Optional), click Browse MCP Servers.
- In the MCP Registry window, find the MCP server(s) you want to add from the list of available servers.
- Next to each MCP server you want to add, click Install.
- When you are finished adding MCP servers, close the MCP Servers Marketplace window.
- In the settings window, under Available MCP Tools, click the > icon to expand the list of available MCP tools. You should now see additional tools from the MCP server(s) that you installed.
Configuring MCP servers manually
- 打开 GitHub Copilot for Xcode 扩展并前往 “Settings”。
- 或者,在已打开的 Xcode 工作区中,点击菜单栏的 Editor,选择 GitHub Copilot,然后点击 Open GitHub Copilot for Xcode Settings。
- 选择 MCP 选项卡,再点击 Edit Config。
- Define your MCP servers, editing
mcp.json. Xcode supports both remote and local servers. Remote servers are hosted externally for easier setup and sharing, while local servers run on your local machine and can access local resources.
You can use the following configurations as examples
Remote server configuration example with PAT
{
"servers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"requestInit": {
"headers": {
"Authorization": "Bearer YOUR_PAT_HERE"
}
}
}
}
}
{
"servers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"requestInit": {
"headers": {
"Authorization": "Bearer YOUR_PAT_HERE"
}
}
}
}
}
Local server configuration example
{
"servers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
{
"servers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
先决条件
- 拥有 Copilot 访问权限。请参阅 什么是 GitHub Copilot?。
- 兼容的 Eclipse 版本。要使用 GitHub Copilot 扩展,您必须拥有 Eclipse 2024-09 或更高版本。请参阅 Eclipse 下载页面。
- 如果您是拥有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“Copilot 中的 MCP 服务器”策略才能在 Copilot 中使用 MCP。
Configuring MCP servers from your MCP registry
- 在 Eclipse 中,打开 Copilot Chat。
- 在 Copilot Chat 窗口,单击MCP icon.
- In the MCP Registry window, find the MCP server(s) you want to add from the list of available servers.
- Next to each MCP server you want to add, click Install.
- When you are finished adding MCP servers, click Close.
- In the Copilot Chat window, click the tools icon. You should now see additional tools from the MCP server(s) that you installed.
Configuring MCP servers manually
- 点击 Copilot 图标 () 在 Eclipse 底部状态栏中。
- 在菜单中选择 Open Chat,在聊天窗口中点击 “Configure Tools...” 图标。
- 或者,您可以选择 Edit preferences,在左侧面板展开 GitHub Copilot 并点击 MCP。
- Under "Server Configurations", define your MCP servers. Eclipse supports both remote and local servers. Remote servers are hosted externally for easier setup and sharing, while local servers run on your local machine and can access local resources.
You can use the following configurations as examples
Remote server configuration example with PAT
{
"servers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"requestInit": {
"headers": {
"Authorization": "Bearer YOUR_PAT_HERE"
}
}
}
}
}
{
"servers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"requestInit": {
"headers": {
"Authorization": "Bearer YOUR_PAT_HERE"
}
}
}
}
}
Local server configuration example
{
"servers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
{
"servers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
Creating a new MCP server
You can create a new MCP server to fulfill your specific needs, and then integrate it with Copilot Chat. For example, you can create an MCP server that connects to a database or a web service, and then use that server in Copilot Chat to perform tasks on that database or web service.
For more information on creating and configuring your own MCP servers, see the official MCP documentation.