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-server on 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.

Claude Code config
{
  "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):

Terminal 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.

Claude Desktop config
{
  "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.

Cursor config
{
  "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

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.

Variation: Read-only mode
{
  "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.

Variation: Only the toolsets you need
{
  "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

Related servers

Building a full setup? Combine this with other servers in the config builder. Trouble connecting? See fixing connection errors.

Open the config builder Get early access to Pro