MCP servers / GitHub
GitHub MCP server: setup for Claude Code, Claude Desktop and Cursor
GitHub's own MCP server lets your AI work with GitHub itself: repositories, issues, pull requests, Actions runs, code scanning results and more. It is published by GitHub as a Docker image.
Its tools are grouped into "toolsets". By default it turns on the context, repos, issues, pull_requests and users toolsets. You can switch on others, or restrict it to just the ones you need.
- Runs with
- Docker
- Package
ghcr.io/github/github-mcp-serveron the GitHub container registry- Needs
- Docker installed and running, plus a GitHub personal access token.
- Tools
- 22 toolsets, 5 on by default
- Source
- github/github-mcp-server
- Last checked
- from the official README
Config for GitHub
Generated by the same code as the free builder, so it matches what you get there. Pick your client, then copy.
Needs Docker installed and running. Create a GitHub personal access token with only the permissions you are comfortable giving the AI.
Claude Code
Save as .mcp.json in your project root. Claude Code asks you to approve it the first time.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}
Set GITHUB_PERSONAL_ACCESS_TOKEN in your environment before starting Claude Code. The config only references the variable, so it is safe to commit.
Or add it from a terminal instead (single quotes work in bash, zsh and PowerShell; more on this command):
claude mcp add github -e 'GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PERSONAL_ACCESS_TOKEN}' -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
Claude Desktop
Merge into claude_desktop_config.json (Settings → Developer → Edit Config), then fully quit and restart 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": "paste-your-key-here"
}
}
}
}
Claude Desktop keeps GITHUB_PERSONAL_ACCESS_TOKEN in this file as plain text. Keep the file private and never share or commit it.
Cursor
Save as .cursor/mcp.json in your project, or ~/.cursor/mcp.json for all projects.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${env:GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}
Set GITHUB_PERSONAL_ACCESS_TOKEN in your environment before launching Cursor. The config only references the variable, so it is safe to commit.
What it can do
GitHub groups its tools into toolsets. These are on by default: context, repos, issues, pull_requests, users. All 22 toolsets in its README: context, actions, code_quality, code_security, copilot, copilot_issue_intents, dependabot, discussions, gists, git, governance, issues, labels, notifications, orgs, projects, pull_requests, repos, secret_protection, security_advisories, stargazers, users.
We did not start this server ourselves, so we have no tool list to show. See the README for the tools in each toolset.
Watch out for
- The token decides what the AI can do. Create one with only the permissions you are comfortable with. GitHub's README recommends minimum scopes, separate tokens per project, and never committing a token.
- The first run downloads the image, so it can take a moment. If the download fails with an authorization error, the README says an expired login to
ghcr.iocan cause it, and runningdocker logout ghcr.iofixes it. - Issues, pull requests and comments written by other people are text your AI will read. GitHub added a "lockdown mode" to reduce the risk of instructions hidden in untrusted content, so read the README's section on it if you work on public repositories.
- We did not run this one ourselves, because our test machine has no Docker. The image exists on the GitHub registry and the settings below come from GitHub's README.
Variations
Read-only mode
GitHub's README documents a read-only mode that only offers tools that cannot change anything, such as creating issues or editing pull requests. It is a good way to start.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITHUB_READ_ONLY=1",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}
Shown in Claude Code format. Cursor uses ${env:NAME} for keys, and Claude Desktop takes the key itself, exactly as in the configs above.
Only the toolsets you need
Fewer tools means less for the AI to choose from and less it can touch. This example turns on only repositories and issues.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITHUB_TOOLSETS=repos,issues",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
}
Shown in Claude Code format. Cursor uses ${env:NAME} for keys, and Claude Desktop takes the key itself, exactly as in the configs above.
Try asking
- “List the open pull requests in my repository that have been waiting more than a week.”
- “Summarize the last 5 issues labelled bug and suggest which to fix first.”
- “Show me why the latest workflow run failed.”
Related servers
- Git: Check status, diffs and history, and make commits and branches in a local repository.
- Filesystem: Let the AI read and edit files in folders you allow.
Building a full setup? Combine this with other servers in the config builder. Trouble connecting? See fixing connection errors.