← Alle Recipes
Phase 2 · Connectivity·8 min·6 steps

GitHub MCP — read PRs, issues, code from any repo

Official GitHub MCP server gives Claude direct access to PRs, issues, code search, and review workflows. One PAT, 30+ tools.

6 steps0%
Du liest ohne Account. Mit Login speichern wir Step-Fortschritt + Notes.

GitHub MCP

The official ghcr.io/github/github-mcp-server is the most polished MCP server for any third-party service. It exposes 30+ tools: list/read/create/comment on issues + PRs, code search across any repo you can access, branch + commit operations, releases, tags. Read-only access works with public repos out of the box.

Step 1: Create a GitHub Personal Access Token

Go to https://github.com/settings/tokens?type=beta (fine-grained tokens). Create a token with:

  • Repository access: the repos you want Claude to see (or "All repositories" if you trust your client)
  • Permissions: Contents (Read), Issues (Read/Write), Pull requests (Read/Write), Metadata (Read)

Copy the token (it starts with github_pat_). You only see it once.

For more access (private orgs, etc.) use a classic PAT with repo scope.

Step 2: Install via Docker (recommended)

The GitHub MCP server ships as a Docker image. Docker keeps the binary auto-updated and isolates the process:

claude mcp add github -s user \
  -e GITHUB_PERSONAL_ACCESS_TOKEN=github_pat_xxxxxxxxxxxxxxx \
  -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server

The -e flag in claude mcp add passes the env var to the docker container.

Step 3: Codex equivalent

In ~/.codex/config.toml:

[mcp_servers.github]
command = "docker"
args = ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"]

[mcp_servers.github.env]
GITHUB_PERSONAL_ACCESS_TOKEN = "github_pat_xxxxxxxxxxxxxxx"

Step 4: Verify

Run aiguide_validate_step — checks for github in claude mcp list. Then prove it works:

In a fresh Claude Code session:

"list the open issues in anthropics/claude-code"

Claude calls list_issues on the GitHub MCP server. You get the latest 30 issues with titles, authors, labels.

Step 5: Three killer workflows

Now that GitHub is wired up, three workflows pay off immediately:

1. Triage your inbox of PR notifications:

"what PRs from <my-org> need my review and what are they about?"

Claude calls list_pull_requests filtered to the user, then pull_request_read on each, then summarizes.

2. Search code across repos you can read:

"show me how the studiomeyer-io org handles MCP server OAuth"

Claude calls search_code — much faster than git clone + grep.

3. Auto-draft PR descriptions from a diff:

"draft a PR description from the diff of feature-x → main, focused on the why"

Claude reads the diff via get_commit and the writing-voice rules from your CLAUDE.md.

Client check · run on your machine
claude mcp list 2>&1 | grep -i "github" | head -3
Expect: A GitHub MCP is listed.
If stuck: Add it with `claude mcp add github -s user -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_... -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server`.

Step 6: Avoid the rate-limit footgun

The GitHub API has tight rate limits per token. If Claude does 30 sequential API calls in one prompt you can hit the wall. Two mitigations:

  1. Use minimal_output: true parameter for list_* tools — strips out boilerplate fields.
  2. Use search_* over list_* + filter — search returns ranked results in one call instead of paginating.

Add to CLAUDE.md:

## GitHub MCP usage

When using the github MCP server, prefer search_* over list_* + manual filter,
and use minimal_output: true for broad queries. Each tool call counts against
the PAT's rate limit (5000/hour for fine-grained, less for some endpoints).

You now have all five core MCP servers: First MCP, Memory, Web Research, Code Intel, GitHub. Phase 3 onwards uses them — basic workflows in Phase 3, deep memory tricks in Phase 4, daily rituals in Phase 5.

Code intelligence — codebase-mSlash commands and built-in sh