Nota:
The GitHub MCP server is currently in versión preliminar pública and subject to change.
Acerca del servidor MCP de GitHub
El servidor MCP de GitHub es un servidor del Protocolo de contexto de modelo (MCP) proporcionado y mantenido por GitHub. MCP te permite integrar funcionalidades de inteligencia artificial con otras herramientas y servicios, lo que mejora la experiencia de desarrollo al proporcionar asistencia de inteligencia artificial con reconocimiento del contexto.
Para más información sobre MCP, consulta la documentación oficial de MCP.
Puedes acceder al servidor MCP de GitHub de forma remota a través de Visual Studio Code, u otros editores que admitan MCP remoto; o bien, puedes ejecutarlo localmente en cualquier editor compatible con MCP, lo que te permite elegir entre la comodidad de una solución hospedada o la personalización de una configuración autohospedada.
Si deseas usar el servidor MCP remoto de GitHub, puedes hacerlo en unos pocos pasos, sin ninguna configuración local. Esto es especialmente útil para los usuarios que desean aprovechar rápidamente las funcionalidades de inteligencia artificial de GitHub sin la sobrecarga de administrar un servidor MCP local.
La ejecución local del servidor MCP de GitHub requiere un poco más de configuración, pero permite una mayor personalización y control sobre las interacciones de IA.
El servidor MCP de GitHub se puede usar para:
- Automatizar y optimizar las tareas relacionadas con el código.
- Conectar herramientas de terceros (como cursor, windsurf o futuras integraciones) para aprovechar las funcionalidades de contexto e inteligencia artificial de GitHub.
- Habilitar los flujos de trabajo basados en la nube que funcionan desde cualquier dispositivo, sin configuración local.
Disponibilidad
Actualmente hay una amplia compatibilidad con servidores MCP locales en clientes como Visual Studio Code, IDE de JetBrains, XCode y otros.
La compatibilidad con servidores MCP remotos está creciendo, con editores como Visual Studio Code (con OAuth o PAT), Visual Studio (solo PAT), Windsurf (solo PAT) y Cursor (solo PAT) que proporcionan esta funcionalidad.
Para averiguar si tu editor preferido admite servidores MCP remotos, consulta la documentación del editor específico.
Requisitos previos
- Una cuenta de GitHub.
- Visual Studio Code, u otro editor compatible con MCP.
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:
- Un repositorio específico. Esto te permitirá compartir los servidores MCP con cualquiera que abra el proyecto en Visual Studio Code. Para ello, crea un archivo
.vscode/mcp.json
en la raíz del repositorio. - Tu instancia personal de Visual Studio Code. Serás la única persona que tenga acceso a los servidores MCP configurados. Para ello, agrega la configuración al archivo
settings.json
en Visual Studio Code. Los servidores MCP configurados de esta manera estarán disponibles en todas las áreas de trabajo.
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 Copilot Chat haz clic en el icono de la barra de título de Visual Studio Code.
- En el cuadro Copilot Chat, selecciona Agent en el menú emergente.
- 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.
Solución de problemas
Si tienes problemas al usar el servidor MCP de GitHub, hay algunos pasos comunes de solución de problemas que puedes seguir.
Problemas de autorización
Si tienes problemas para autorizar el servidor MCP, asegúrate de que:
- Has iniciado sesión en GitHub en el IDE de tu elección.
Si te estás autenticando con un personal access token (PAT), asegúrate de que:
- El PAT de GitHub es válido y tiene los ámbitos necesarios para las acciones que deseas realizar.
- Has escrito el PAT correcto cuando se te solicita en Visual Studio Code.
Problemas del modo de agente de Copilot
Si tienes problemas con el modo de agente de Copilot Chat, asegúrate de que:
- Has seleccionado el agente correcto en el cuadro Copilot Chat.
- Has configurado correctamente el servidor MCP en Visual Studio Code.
- Tienes los permisos necesarios para realizar las acciones que intentas ejecutar.
Sugerencias generales
Si tienes otros problemas con el servidor MCP de GitHub, estas son algunas sugerencias generales que te ayudarán a solucionar los problemas:
- Comprueba los registros de salida del servidor MCP para ver los mensajes de error.
- Si ejecutas el servidor MCP localmente, asegúrate de que el entorno local esté configurado correctamente para ejecutar contenedores de Docker.
- Intenta reiniciar el servidor MCP o el IDE.