Skip to main content

Setting up the GitHub MCP Server

Learn how to configure the GitHub Model Context Protocol (MCP) server.

The GitHub MCP server is available to all GitHub users regardless of plan type. However, specific tools within the MCP server inherit the same access requirements as their corresponding GitHub features. If a feature requires a paid GitHub or Copilot license, the equivalent MCP tool will require the same subscription. For example, tools that interact with Copilot Coding Agent require a paid Copilot license.

关于 GitHub MCP 服务器

GitHub MCP 服务器是由 GitHub 提供并维护的模型上下文协议 (MCP) 服务器。 MCP 使你可以将 AI 功能集成到其他工具和服务中,通过提供基于上下文的 AI 辅助,提升你的开发体验。

有关 GitHub MCP 服务器的完整简介和 MCP 概述,请参阅“关于模型上下文协议 (MCP)”。

Prerequisites

  • A GitHub account.
  • Visual Studio Code.
  • 如果你是具有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“MCP servers in Copilot”策略才能将 MCP 与 Copilot 配合使用。

Setting up the GitHub MCP server in Visual Studio Code

The GitHub MCP server in Visual Studio Code can be configured remotely or locally. The remote GitHub MCP server is hosted by GitHub and is the recommended option for most users. The local GitHub MCP server is hosted on your machine and is recommended for users who want to customize their setup or have specific security requirements.

The steps below describe remote configuration with one-click OAuth authentication. For information on manually configuring the remote or local GitHub MCP server, see the GitHub MCP server documentation.

  1. Go to the GitHub page of the MCP Registry.
  2. Click Install MCP server and select Install in Visual Studio Code.
  3. In Visual Studio Code, on the GitHub MCP Server configuration page, click Install.
  4. In the popup, when prompted to authenticate, click Allow.
  5. In your browser, you will be prompted to authorize. To the right of your profile picture, click Continue.
  6. Follow the prompts on screen to complete the authorization process.
  7. To check that the GitHub MCP server is configured correctly, open the command palette by pressing Ctrl+Shift+P (Windows/Linux) / Command+Shift+P (Mac).
  8. Type and select MCP: List Servers. You should see github listed as a configured server.

Tool configuration

The GitHub MCP server supports installing individual toolsets, either in read-only mode or with full read/write access, via the --toolsets flag. For more information, see Tool Configuration in the GitHub MCP server documentation.

关于 GitHub MCP 服务器

GitHub MCP 服务器是由 GitHub 提供并维护的模型上下文协议 (MCP) 服务器。 MCP 使你可以将 AI 功能集成到其他工具和服务中,通过提供基于上下文的 AI 辅助,提升你的开发体验。

有关 GitHub MCP 服务器的完整简介和 MCP 概述,请参阅“关于模型上下文协议 (MCP)”。

Prerequisites

  • Access to 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 计划的组织或企业的成员,则必须启用“MCP servers in Copilot”策略才能将 MCP 与 Copilot 配合使用。

Setting up the GitHub MCP server in Visual Studio

The instructions below guide you through setting up the GitHub MCP server in Visual Studio. Other MCP-compatible editors may have similar steps, but the exact process may vary.

The remote GitHub MCP server uses one-click OAuth authentication by default, but you can also manually configure it to use a personal access token (PAT) for authentication. If you use OAuth, the MCP server can only access the scopes you approve during sign-in. In organization-owned contexts, access may also be limited by admin policies that control which scopes and apps are permitted. If you use a PAT, the MCP server will have access to the scopes granted by the PAT, which is also subject to any PAT restrictions configured by the organization.

注意

If you are an Enterprise Managed User, then PAT is disabled by default, unless enabled by an enterprise administrator. If PAT is disabled, you won't be able to use PAT authentication. If you have OAuth access policy restrictions, you will need the OAuth App for each client (MCP host application) to be enabled (except Visual Studio Code and Visual Studio).

For information on setting up the GitHub MCP server locally, see the GitHub MCP server documentation.

Remote MCP server configuration with OAuth

You do not need to create a PAT or install any additional software to use the remote GitHub MCP server with OAuth. You can set it up directly in Visual Studio.

  1. In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.

  2. At the bottom of the chat panel, select Agent from the mode dropdown.

  3. In the Copilot 对话助手 window, click the tools icon, then click the plus icon in the tool picker window.

  4. In the "Configure MCP server" pop-up window, fill out the fields.

    1. For "Server ID", type github.
    2. For "Type", select "HTTP/SSE" from the dropdown.
    3. For "URL", type https://api.githubcopilot.com/mcp/.
  5. Click Save. The configuration in the mcp.json file should look like this:

    JSON
        {
          "servers": {
            "github": {
              "url": "https://api.githubcopilot.com/mcp/"
            }
          }
        }
    
  6. In the mcp.json file, 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.

Remote MCP server configuration with PAT

To configure the remote GitHub MCP server with a PAT, ensure you have created a PAT with the necessary scopes for the access you want to grant to the MCP server. For more information, see 管理个人访问令牌.

  1. In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.

  2. At the bottom of the chat panel, select Agent from the mode dropdown.

  3. In the Copilot 对话助手 window, click the tools icon, then click the plus icon in the tool picker window.

  4. In the "Configure MCP server" pop-up window, fill out the fields.

    1. For "Server ID", type github.
    2. For "Type", select "HTTP/SSE" from the dropdown.
    3. For "URL", type https://api.githubcopilot.com/mcp/.
    4. Add a new header under "Headers", called "Authorization" and set to the value Bearer YOUR_GITHUB_PAT, replacing "YOUR_GITHUB_PAT" with your PAT.
  5. Click Save. The configuration in the mcp.json file should look like this:

    JSON
      {
        "servers": {
            "github": {
                "url": "https://api.githubcopilot.com/mcp/",
                "requestInit": {
                    "headers": {
                        "Authorization": "Bearer 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.

关于 GitHub MCP 服务器

GitHub MCP 服务器是由 GitHub 提供并维护的模型上下文协议 (MCP) 服务器。 MCP 使你可以将 AI 功能集成到其他工具和服务中,通过提供基于上下文的 AI 辅助,提升你的开发体验。

有关 GitHub MCP 服务器的完整简介和 MCP 概述,请参阅“关于模型上下文协议 (MCP)”。

Prerequisites

  • Access to Copilot. 请参阅“什么是 GitHub Copilot?”。

  • A compatible JetBrains IDE. GitHub Copilot is compatible with the following IDEs:

    • IntelliJ IDEA(旗舰版、社区版、教育版)
    • Android Studio
    • AppCode
    • CLion
    • Code With Me Guest
    • DataGrip
    • DataSpell
    • GoLand
    • JetBrains Client
    • MPS
    • PhpStorm
    • PyCharm(专业版、社区版、教育版)
    • Rider
    • RubyMine
    • RustRover
    • WebStorm
    • Writerside

    请参阅 JetBrains IDE 工具查找器进行下载。

  • 最新版本的 GitHub Copilot 扩展****。 请参阅 JetBrains Marketplace 中的 GitHub Copilot 插件。 有关安装说明,请参阅“在环境中安装 GitHub Copilot 扩展”。

  • 在 JetBrains IDE 中登录到 GitHub****。 有关身份验证说明,请参阅“在环境中安装 GitHub Copilot 扩展”。

  • 如果你是具有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“MCP servers in Copilot”策略才能将 MCP 与 Copilot 配合使用。

Setting up the GitHub MCP server in JetBrains IDEs

The instructions below guide you through setting up the GitHub MCP server in JetBrains IDEs. Other MCP-compatible editors may have similar steps, but the exact process may vary.

The remote GitHub MCP server uses one-click OAuth authentication by default, but you can also manually configure it to use a personal access token (PAT) for authentication. If you use OAuth, the MCP server can only access the scopes you approve during sign-in. In organization-owned contexts, access may also be limited by admin policies that control which scopes and apps are permitted. If you use a PAT, the MCP server will have access to the scopes granted by the PAT, which is also subject to any PAT restrictions configured by the organization.

注意

If you are an Enterprise Managed User, then PAT is disabled by default, unless enabled by an enterprise administrator. If PAT is disabled, you won't be able to use PAT authentication. If you have OAuth access policy restrictions, you will need the OAuth App for each client (MCP host application) to be enabled (except Visual Studio Code and Visual Studio).

For information on setting up the GitHub MCP server locally, see the GitHub MCP server documentation.

Remote MCP server configuration with OAuth

You do not need to create a PAT or install any additional software to use the remote GitHub MCP server with OAuth. You can set it up directly in JetBrains IDEs.

  1. 在右下角,单击“”****。

  2. 在菜单中,选择“Open Chat”,确保处于代理模式,然后单击聊天窗口底部的工具图标(称为“配置 MCP 服务器”)。

  3. 单击“Add MCP Tools”****。

  4. In the mcp.json file, add the following configuration:

    JSON
    {
      "servers": {
          "github": {
              "type": "http",
              "url": "https://api.githubcopilot.com/mcp/"
          }
      }
    }
    
  5. In the "GitHub Copilot" popup that says the "MCP server definition wants to authenticate to GitHub, click Allow.

  6. If you have not yet authorized the GitHub Copilot plugin, in the browser popup, click Continue next to your personal account.

Remote MCP server configuration with PAT

To configure the remote GitHub MCP server with a PAT, ensure you have created a PAT with the necessary scopes for the access you want to grant to the MCP server. For more information, see 管理个人访问令牌.

  1. 在右下角,单击“”****。
  2. 在菜单中,选择“Open Chat”,确保处于代理模式,然后单击聊天窗口底部的工具图标(称为“配置 MCP 服务器”)。
  3. 单击“Add MCP Tools”****。
  4. In the mcp.json file, add the following configuration, replacing YOUR_GITHUB_PAT with the PAT you created:
JSON
  {
    "servers": {
        "github": {
            "url": "https://api.githubcopilot.com/mcp/",
            "requestInit": {
                "headers": {
                    "Authorization": "Bearer YOUR_GITHUB_PAT"
                }
            }
        }
    }
  }

关于 GitHub MCP 服务器

GitHub MCP 服务器是由 GitHub 提供并维护的模型上下文协议 (MCP) 服务器。 MCP 使你可以将 AI 功能集成到其他工具和服务中,通过提供基于上下文的 AI 辅助,提升你的开发体验。

有关 GitHub MCP 服务器的完整简介和 MCP 概述,请参阅“关于模型上下文协议 (MCP)”。

Prerequisites

Setting up the GitHub MCP server in Xcode

The instructions below guide you through setting up the GitHub MCP server in Xcode. Other MCP-compatible editors may have similar steps, but the exact process may vary.

The remote GitHub MCP server uses one-click OAuth authentication by default, but you can also manually configure it to use a personal access token (PAT) for authentication. If you use OAuth, the MCP server can only access the scopes you approve during sign-in. In organization-owned contexts, access may also be limited by admin policies that control which scopes and apps are permitted. If you use a PAT, the MCP server will have access to the scopes granted by the PAT, which is also subject to any PAT restrictions configured by the organization.

注意

If you are an Enterprise Managed User, then PAT is disabled by default, unless enabled by an enterprise administrator. If PAT is disabled, you won't be able to use PAT authentication. If you have OAuth access policy restrictions, you will need the OAuth App for each client (MCP host application) to be enabled (except Visual Studio Code and Visual Studio).

For information on setting up the GitHub MCP server locally, see the GitHub MCP server documentation.

Remote MCP server configuration with OAuth

You do not need to create a PAT or install any additional software to use the remote GitHub MCP server with OAuth. You can set it up directly in Xcode.

  1. 打开适用于 Xcode 的 GitHub Copilot 扩展,并转到“Settings”。

    • 或者,可以在活动的 Xcode 工作区中,通过以下方式找到设置:单击菜单栏中的“Editor”,选择“GitHub Copilot”,然后单击“Open GitHub Copilot for Xcode Settings”****。
  2. 选择“MCP”选项卡,然后单击“Edit Config”********。

  3. Add the following configuration:

    JSON
    {
      "servers": {
          "github": {
              "type": "http",
              "url": "https://api.githubcopilot.com/mcp/"
          }
      }
    }
    
  4. In the "GitHub Copilot" popup that says the "MCP Server Definition wants to authenticate to GitHub", click Continue.

  5. If you have not yet authorized the GitHub Copilot plugin, in the browser popup, click Continue next to your personal account.

Remote MCP server configuration with PAT

To configure the remote GitHub MCP server with a PAT, ensure you have created a PAT with the necessary scopes for the access you want to grant to the MCP server. For more information, see 管理个人访问令牌.

  1. 打开适用于 Xcode 的 GitHub Copilot 扩展,并转到“Settings”。
    • 或者,可以在活动的 Xcode 工作区中,通过以下方式找到设置:单击菜单栏中的“Editor”,选择“GitHub Copilot”,然后单击“Open GitHub Copilot for Xcode Settings”****。
  2. 选择“MCP”选项卡,然后单击“Edit Config”********。
  3. Add the following configuration, replacing YOUR_GITHUB_PAT with the PAT you created:
JSON
  {
    "servers": {
        "github": {
            "url": "https://api.githubcopilot.com/mcp/",
            "requestInit": {
                "headers": {
                    "Authorization": "Bearer YOUR_GITHUB_PAT"
                }
            }
        }
    }
  }

关于 GitHub MCP 服务器

GitHub MCP 服务器是由 GitHub 提供并维护的模型上下文协议 (MCP) 服务器。 MCP 使你可以将 AI 功能集成到其他工具和服务中,通过提供基于上下文的 AI 辅助,提升你的开发体验。

有关 GitHub MCP 服务器的完整简介和 MCP 概述,请参阅“关于模型上下文协议 (MCP)”。

Prerequisites

  • 对 Copilot 的访问权限****。 请参阅“什么是 GitHub Copilot?”。
  • 兼容的 Eclipse 版本****。 若要使用 GitHub Copilot 扩展,必须拥有 Eclipse 版本 2024-09 或更高版本。 请参阅 Eclipse 下载页
  • 如果你是具有 Copilot Business 或 Copilot Enterprise 计划的组织或企业的成员,则必须启用“MCP servers in Copilot”策略才能将 MCP 与 Copilot 配合使用。
  • Latest version of the GitHub Copilot extension. Download this from the Eclipse Marketplace. For more information, see 在环境中安装 GitHub Copilot 扩展.
  • Sign in to GitHub from Eclipse.

Setting up the GitHub MCP server in Eclipse

The instructions below guide you through setting up the GitHub MCP server in Eclipse. Other MCP-compatible editors may have similar steps, but the exact process may vary.

The remote GitHub MCP server uses one-click OAuth authentication by default, but you can also manually configure it to use a personal access token (PAT) for authentication. If you use OAuth, the MCP server can only access the scopes you approve during sign-in. In organization-owned contexts, access may also be limited by admin policies that control which scopes and apps are permitted. If you use a PAT, the MCP server will have access to the scopes granted by the PAT, which is also subject to any PAT restrictions configured by the organization.

注意

If you are an Enterprise Managed User, then PAT is disabled by default, unless enabled by an enterprise administrator. If PAT is disabled, you won't be able to use PAT authentication. If you have OAuth access policy restrictions, you will need the OAuth App for each client (MCP host application) to be enabled (except Visual Studio Code and Visual Studio).

For information on setting up the GitHub MCP server locally, see the GitHub MCP server repository.

Remote MCP server configuration with OAuth

You do not need to create a PAT or install any additional software to use the remote GitHub MCP server with OAuth. You can set it up directly in Eclipse.

  1. 在 Eclipse 底部的状态栏中,单击 Copilot 图标 ()。

  2. 在菜单中选择“Open Chat”****,然后在聊天窗口中单击“Configure Tools...”图标。

    • 或者,可以选择“Edit preferences”,然后在左窗格中展开 GitHub Copilot 并单击“MCP”
  3. Add the following configuration under "Server Configurations":

    JSON
    {
      "servers": {
          "github": {
              "type": "http",
              "url": "https://api.githubcopilot.com/mcp/"
          }
      }
    }
    
  4. Click Apply.

  5. In the "GitHub Copilot" popup that says the "MCP Server Definition wants to authenticate to GitHub", click OK.

  6. If you have not yet authorized the GitHub Copilot plugin, in the browser popup, click Continue next to your personal account.

Remote MCP server configuration with PAT

To configure the remote GitHub MCP server with a PAT, ensure you have created a PAT with the necessary scopes for the access you want to grant to the MCP server. For more information, see 管理个人访问令牌.

  1. 在 Eclipse 底部的状态栏中,单击 Copilot 图标 ()。
  2. 在菜单中选择“Open Chat”****,然后在聊天窗口中单击“Configure Tools...”图标。
    • 或者,可以选择“Edit preferences”,然后在左窗格中展开 GitHub Copilot 并单击“MCP”
  3. Add the following configuration under "Server Configurations", replacing YOUR_GITHUB_PAT with the PAT you created:
JSON
  {
    "servers": {
        "github": {
            "url": "https://api.githubcopilot.com/mcp/",
            "requestInit": {
                "headers": {
                    "Authorization": "Bearer YOUR_GITHUB_PAT"
                }
            }
        }
    }
  }

Next steps

To learn how to use the GitHub MCP server in Visual Studio Code, see 使用 GitHub MCP 服务器.