anthropics/github-mcp-server
forked from github/github-mcp-server
Captured source
source ↗anthropics/github-mcp-server
Description: GitHub's official MCP Server
Language: Go
License: MIT
Stars: 110
Forks: 44
Open issues: 0
Created: 2025-05-01T20:15:59Z
Pushed: 2025-12-09T19:28:54Z
Default branch: main
Fork: yes
Parent repository: github/github-mcp-server
Archived: no
README:
GitHub MCP Server
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.
Use Cases
- Automating GitHub workflows and processes.
- Extracting and analyzing data from GitHub repositories.
- Building AI powered tools and applications that interact with GitHub's ecosystem.
Prerequisites
1. To run the server in a container, you will need to have Docker installed. 2. 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. 3. 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).
Installation
Usage with VS Code
For quick installation, use one of the one-click install buttons at the top of this README. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open User Settings (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}"
}
}
}
}
}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.
Usage with Claude Desktop
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": ""
}
}
}
}Build from source
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": ""
}
}
}
}
}Tool Configuration
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.
Available Toolsets
The following sets of tools are available (all are on by default):
| Toolset | Description | | ----------------------- | ------------------------------------------------------------- | | repos | Repository-related tools (file operations, branches, commits) | | issues | Issue-related tools (create, read, update, comment) | | users | Anything relating to GitHub Users | | pull_requests | Pull request operations (create, merge, review) | | code_security | Code scanning alerts and security features | | experiments | Experimental features (not considered stable) |
Specifying Toolsets
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
1. Using Command Line Argument:
github-mcp-server --toolsets repos,issues,pull_requests,code_security
2. 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.
Using Toolsets With Docker
When using Docker, you can pass the toolsets as environment variables:
docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_TOOLSETS="repos,issues,pull_requests,code_security,experiments" \ ghcr.io/github/github-mcp-server
The "all" Toolset
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
Dynamic Tool Discovery
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 shear number of tools available.
Using Dynamic Tool Discovery
When using the binary, you can pass the --dynamic-toolsets flag.
./github-mcp-server --dynamic-toolsets
When using…
Excerpt shown — open the source for the full document.
Notability
notability 3.0/10Routine fork with moderate stars