Nota:
The GitHub MCP server is currently in versión preliminar pública and subject to change.
About the GitHub MCP server
The GitHub MCP server is a Model Context Protocol (MCP) server provided and maintained by GitHub. MCP allows you to integrate AI capabilities with other tools and services, enhancing your development experience by providing context-aware AI assistance.
For more information on MCP, see the official MCP documentation.
You can access the GitHub MCP server remotely through Visual Studio Code, or other editors that support remote MCP; or you can run it locally in any MCP-compatible editor, allowing you to choose between the convenience of a hosted solution or the customizability of a self-hosted setup.
If you want to utilize the remote GitHub MCP server, you can do so in a few steps, without any local setup. This is particularly useful for users who want to quickly leverage GitHub’s AI capabilities without the overhead of managing a local MCP server.
Running the GitHub MCP server locally requires a bit more setup, but it allows for greater customization and control over your AI interactions.
GitHub MCP server can be used to:
- Automate and streamline code-related tasks.
- Connect third-party tools (like Cursor, Windsurf, or future integrations) to leverage GitHub’s context and AI capabilities.
- Enable cloud-based workflows that work from any device, without local setup.
Availability
There is currently broad support for local MCP servers in clients such as Visual Studio Code, JetBrains IDEs, XCode, and others.
Support for remote MCP servers is growing, with editors like Visual Studio Code (with OAuth or PAT), Visual Studio (PAT only), Windsurf (PAT only), and Cursor (PAT only) already providing this functionality.
To find out if your preferred editor supports remote MCP servers, check the documentation for your specific editor.
Prerequisites
- A GitHub account.
- Visual Studio Code, or another MCP-compatible editor.
Setting up the GitHub MCP server in Visual Studio Code
The instructions below guide you through setting up the GitHub MCP server in Visual Studio Code. Other MCP-compatible editors may have similar steps, but the exact process may vary.
You can choose to set up the GitHub MCP server either remotely or locally, depending on your needs and preferences. You can also configure your GitHub MCP server 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.json
file 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.json
file in Visual Studio Code. MCP servers configured this way will be available in all workspaces.
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 will have the same access as your personal account. If you use a PAT, the MCP server will have access to the scopes granted by the PAT.
Nota:
If you are an Enterprise Managed User with PAT restrictions, you won't be able to use PAT authentication. If you have OAuth access policy restrictions, you will need the OAuth apps for each client to be enabled (except Visual Studio Code and Visual Studio).
- Remote MCP server configuration with OAuth
- Remote MCP server configuration with PAT
- Local MCP server setup
Remote MCP server configuration with OAuth
Nota:
The remote GitHub MCP server is not available to GitHub Enterprise Server users. If you are using GitHub Enterprise Server, you can install the GitHub MCP server locally. See Local MCP server setup.
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 Code. You can also install individual toolsets, either in read-only mode or with full read/write access, allowing you to tailor the server's capabilities to your specific needs. For more information, see Tool configuration.
-
In Visual Studio Code, open the command palette by pressing Ctrl+Shift+P (Windows/Linux) / Command+Shift+P (Mac).
-
Type:
mcp: add server
and then press Enter. -
From the list, select HTTP (HTTP or Server-Sent Events).
-
In the Server URL field, enter
https://api.githubcopilot.com/mcp/
, and press Enter. -
Under Enter Server ID, press Enter to use the default server ID, or enter a custom server ID.
-
Under Choose where to save the configuration, select where you want to save the MCP server configuration.
- Visual Studio Code will open and add the configuration to the selected file in the editor, or create a new file if it doesn't exist.
-
In the Visual Studio Code popup, to authorize the MCP server with OAuth, click Allow and select your personal account from the list.
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 Administración de tokens de acceso personal.
You will need to manually configure the MCP server in Visual Studio Code to use the PAT for authorization.
-
In Visual Studio Code, open the command palette by pressing Ctrl+Shift+P (Windows/Linux) / Command+Shift+P (Mac).
-
Type:
mcp: add server
and then press Enter. -
From the list, select HTTP (HTTP or Server-Sent Events).
-
In the Server URL field, enter
https://api.githubcopilot.com/mcp/
, and press Enter. -
Under Enter Server ID, press Enter to use the default server ID, or enter a custom server ID.
-
Under Choose where to save the configuration, select where you want to save the MCP server configuration.
- Visual Studio Code will open and add the configuration to the selected file in the editor, or create a new file if it doesn't exist.
-
In the Visual Studio Code popup, to decline OAuth authorization, click Cancel.
-
You will need to manually edit the configuration file to use a PAT. In the configuration file, at the end of the
url
line, add the following:JSON , "headers": { "Authorization": "Bearer ${input:github_token}" } }, }, "inputs": [ { "id": "github_token", "type": "promptString", "description": "GitHub Personal Access Token", "password": true } ] }
, "headers": { "Authorization": "Bearer ${input:github_token}" } }, }, "inputs": [ { "id": "github_token", "type": "promptString", "description": "GitHub Personal Access Token", "password": true } ] }
-
A "Restart" button will appear in the file. Click "Restart" to restart the MCP server with the new configuration.
-
In the command palette, you will see a prompt to enter your GitHub token. Enter the PAT you created earlier, and press Enter.
- The MCP server will now be configured to use the PAT for authorization.
Local MCP server setup
Nota:
If you are a GitHub Enterprise Server user, and your enterprise has PAT restrictions enabled, you can only use API endpoints for scopes that are allowed by your enterprise's PAT policy. If all API endpoints are restricted, you will not be able to use the MCP server. If you are unsure about your enterprise's PAT policy, contact your enterprise administrator for more information.
Using the GitHub MCP server locally requires you to have Docker installed and running on your machine. Additionally, you can only authenticate with a PAT, as OAuth is not supported for local MCP servers.
-
Ensure you have Docker installed and running on your machine. See Docker installation instructions.
-
Create a PAT with (at least) the
read:packages
andrepo
scopes. For more information, see Administración de tokens de acceso personal. -
Decide whether you want to configure the MCP server for a specific repository or for your personal instance of Visual Studio Code.
- If you are using a specific repository, open the
.vscode/mcp.json
file in Visual Studio Code, and add the following configuration:
JSON { "inputs": [ { "type": "promptString", "id": "github_token", "description": "GitHub Personal Access Token", "password": true } ], "servers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" } } } }
{ "inputs": [ { "type": "promptString", "id": "github_token", "description": "GitHub Personal Access Token", "password": true } ], "servers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" } } } }
- If you are using your personal instance of Visual Studio Code, open your
settings.json
file in Visual Studio Code:- Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS).
- Type Preferences: Open Settings (JSON) and select it.
- Add the following configuration:
JSON { "mcp": { "inputs": [ { "type": "promptString", "id": "github_token", "description": "GitHub Personal Access Token", "password": true } ], "servers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" } } } } }
{ "mcp": { "inputs": [ { "type": "promptString", "id": "github_token", "description": "GitHub Personal Access Token", "password": true } ], "servers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" } } } } }
- If you are using a specific repository, open the
-
Save the file.
-
In the command palette, you will see a prompt to enter your GitHub token. Enter the PAT you created earlier, and press Enter.
- The MCP server will now be configured to run locally with the PAT for authorization.
Tool configuration
The GitHub MCP server supports installing individual toolsets, either in read-only mode or with full read/write access, allowing you to tailor the server's capabilities to your specific needs. For one-click installation options of each toolset, see the GitHub MCP server repository.
Using the GitHub MCP server in Visual Studio Code
The GitHub MCP server enables you to perform a wide range of actions on GitHub, via Copilot Chat in Visual Studio Code.
- Para abrir la vista de chat, haga clic en el icono de chat de la barra de actividad o presione Control+Comando+i (Mac)/Ctrl+Alt+i (Windows/Linux).
- In the Copilot Chat box, select Agent from the popup menu.
- To see the available actions, in the Copilot Chat box, click the Select tools icon.
- In the Tools dropdown, under MCP Server:GitHub, you will see a list of available actions.
- In the Copilot Chat box, type a command or question related to the action you want to perform, and press Enter.
- For example, you can ask the GitHub MCP server to create a new issue, list pull requests, or retrieve repository information.
- The GitHub MCP server will process your request and provide a response in the chat interface.
- In the Copilot Chat box, you may be asked to give additional permissions or provide more information to complete the action.
- Follow the prompts to complete the action.
Troubleshooting
If you encounter issues while using the GitHub MCP server, there are a few common troubleshooting steps you can take.
Authorization issues
If you are having trouble authorizing the MCP server, ensure that:
- You are signed in to GitHub in your choice of IDE.
If you are authenticating with a personal access token (PAT), ensure that:
- Your GitHub PAT is valid and has the necessary scopes for the actions you want to perform.
- You have entered the correct PAT when prompted in Visual Studio Code.
Copilot agent mode problems
If you are having trouble with the Copilot Chat agent mode, ensure that:
- You have selected the correct agent in the Copilot Chat box.
- You have configured the MCP server correctly in Visual Studio Code.
- You have the necessary permissions to perform the actions you are trying to execute.
General tips
If you are experiencing other issues with the GitHub MCP server, here are some general tips to help you troubleshoot:
- Check the output logs of the MCP server for any error messages.
- If you are running the MCP server locally, ensure that your local environment is set up correctly for running Docker containers.
- Try restarting the MCP server or your IDE.