The GitHub MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with GitHub APIs, enabling advanced automation and interaction capabilities for developers and tools.
- Automating GitHub workflows and processes.
- Extracting and analyzing data from GitHub repositories.
- Building AI powered tools and applications that interact with GitHub's ecosystem.
The remote GitHub MCP Server is hosted by GitHub and provides the easiest method for getting up and running. If your MCP host does not support remote MCP servers, don't worry! You can use the local version of the GitHub MCP Server instead.
- An MCP host that supports the latest MCP specification and remote servers, such as VS Code.
For quick installation, use one of the one-click install buttons above. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start. Make sure you're using VS Code 1.101 or later for remote MCP and OAuth support.
Alternatively, to manually configure VS Code, choose the appropriate JSON block from the examples below and add it to your host configuration:
Using OAuth | Using a GitHub PAT |
---|---|
VS Code (version 1.101 or greater) | |
{
"servers": {
"github-remote": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/"
}
}
} |
{
"servers": {
"github-remote": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${input:github_mcp_pat}",
}
}
},
"inputs": [
{
"type": "promptString",
"id": "github_mcp_pat",
"description": "GitHub Personal Access Token",
"password": true
}
]
} |
For MCP Hosts that are Remote MCP-compatible, choose the appropriate JSON block from the examples below and add it to your host configuration:
Using OAuth | Using a GitHub PAT |
---|---|
{
"mcpServers": {
"github-remote": {
"url": "https://api.githubcopilot.com/mcp/"
}
}
} |
{
"mcpServers": {
"github-remote": {
"url": "https://api.githubcopilot.com/mcp/",
"authorization_token": "Bearer <your GitHub PAT>"
}
}
} |
Note: The exact configuration format may vary by host. Refer to your host's documentation for the correct syntax and location for remote MCP server setup.
See Remote Server Documentation on how to pass additional configuration settings to the remote GitHub MCP Server.
- To run the server in a container, you will need to have Docker installed.
- Once Docker is installed, you will also need to ensure Docker is running. The image is public; if you get errors on pull, you may have an expired token and need to
docker logout ghcr.io
. - Lastly you will need to Create a GitHub Personal Access Token. The MCP server can use many of the GitHub APIs, so enable the permissions that you feel comfortable granting your AI tools (to learn more about access tokens, please check out the documentation).
For quick installation, use one of the one-click install buttons. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.
Add the following JSON block to your IDE MCP settings.
{
"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}"
}
}
}
}
}
Optionally, you can add a similar example (i.e. without the mcp key) to a file called .vscode/mcp.json
in your workspace. This will allow you to share the configuration with others.
{
"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}"
}
}
}
}
More about using MCP server tools in VS Code's agent mode documentation.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
If you don't have Docker, you can use go build
to build the binary in the
cmd/github-mcp-server
directory, and use the github-mcp-server stdio
command with the GITHUB_PERSONAL_ACCESS_TOKEN
environment variable set to your token. To specify the output location of the build, use the -o
flag. You should configure your server to use the built executable as its command
. For example:
{
"mcp": {
"servers": {
"github": {
"command": "/path/to/github-mcp-server",
"args": ["stdio"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
}
The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the --toolsets
flag. This allows you to control which GitHub API capabilities are available to your AI tools. Enabling only the toolsets that you need can help the LLM with tool choice and reduce the context size.
Toolsets are not limited to Tools. Relevant MCP Resources and Prompts are also included where applicable.
The following sets of tools are available (all are on by default):
Toolset | Description |
---|---|
context |
Strongly recommended: Tools that provide context about the current user and GitHub context you are operating in |
code_security |
Code scanning alerts and security features |
issues |
Issue-related tools (create, read, update, comment) |
notifications |
GitHub Notifications related tools |
pull_requests |
Pull request operations (create, merge, review) |
repos |
Repository-related tools (file operations, branches, commits) |
secret_protection |
Secret protection related tools, such as GitHub Secret Scanning |
users |
Anything relating to GitHub Users |
experiments |
Experimental features (not considered stable) |
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
-
Using Command Line Argument:
github-mcp-server --toolsets repos,issues,pull_requests,code_security
-
Using Environment Variable:
GITHUB_TOOLSETS="repos,issues,pull_requests,code_security" ./github-mcp-server
The environment variable GITHUB_TOOLSETS
takes precedence over the command line argument if both are provided.
When using Docker, you can pass the toolsets as environment variables:
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
-e GITHUB_TOOLSETS="repos,issues,pull_requests,code_security,experiments" \
ghcr.io/github/github-mcp-server
The special toolset all
can be provided to enable all available toolsets regardless of any other configuration:
./github-mcp-server --toolsets all
Or using the environment variable:
GITHUB_TOOLSETS="all" ./github-mcp-server
Note: This feature is currently in beta and may not be available in all environments. Please test it out and let us know if you encounter any issues.
Instead of starting with all tools enabled, you can turn on dynamic toolset discovery. Dynamic toolsets allow the MCP host to list and enable toolsets in response to a user prompt. This should help to avoid situations where the model gets confused by the sheer number of tools available.
When using the binary, you can pass the --dynamic-toolsets
flag.
./github-mcp-server --dynamic-toolsets
When using Docker, you can pass the toolsets as environment variables:
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
-e GITHUB_DYNAMIC_TOOLSETS=1 \
ghcr.io/github/github-mcp-server
To run the server in read-only mode, you can use the --read-only
flag. This will only offer read-only tools, preventing any modifications to repositories, issues, pull requests, etc.
./github-mcp-server --read-only
When using Docker, you can pass the read-only mode as an environment variable:
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
-e GITHUB_READ_ONLY=1 \
ghcr.io/github/github-mcp-server
The flag --gh-host
and the environment variable GITHUB_HOST
can be used to set
the hostname for GitHub Enterprise Server or GitHub Enterprise Cloud with data residency.
- For GitHub Enterprise Server, prefix the hostname with the
https://
URI scheme, as it otherwise defaults tohttp://
, which GitHub Enterprise Server does not support. - For GitHub Enterprise Cloud with data residency, use
https://YOURSUBDOMAIN.ghe.com
as the hostname.
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITHUB_HOST",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}",
"GITHUB_HOST": "https://<your GHES or ghe.com domain name>"
}
}
The descriptions of the tools can be overridden by creating a
github-mcp-server-config.json
file in the same directory as the binary.
The file should contain a JSON object with the tool names as keys and the new descriptions as values. For example:
{
"TOOL_ADD_ISSUE_COMMENT_DESCRIPTION": "an alternative description",
"TOOL_CREATE_BRANCH_DESCRIPTION": "Create a new branch in a GitHub repository"
}