← Level 1
Level 1· Lektion 10 von 13

Git for AI 3, the GitHub MCP server

How to give Claude direct access to your GitHub. Issues, pull requests, workflows, all by voice.

What this is about

So far you have used Git as a safety net. You make save states, you create branches, you let Claude Code build inside the editor.

This lesson is the next step. You give Claude direct access to your GitHub. Claude can then read issues, open pull requests for you, look at why your last CI pipeline was red, or sort through Dependabot warnings.

This works through the GitHub MCP Server. It is an official tool by GitHub, free, well maintained.

What MCP actually is (briefly)

MCP stands for Model Context Protocol. It is an open standard that lets AI tools like Claude Code talk to other services. Instead of Claude having to guess what is in your GitHub, it can ask an MCP server which answers with real data.

You do not need to understand MCP in detail to use it. Think of it as a USB port. GitHub provides a plug, Claude accepts the plug, done.

What the GitHub MCP Server actually does (official list from github/github-mcp-server):

  • Browse repos, search code, read commits
  • Create, comment, close issues
  • Create, review, merge pull requests
  • Trigger and read GitHub Actions pipelines
  • Walk through Dependabot alerts and security findings
  • Notifications, discussions, gists, projects, labels, stargazers, users

19 toolsets in total. The most important ones for the start are repositories, issues, pull_requests, actions and code_security.

Why this is actually useful

Three concrete examples that make the value obvious.

Example 1: issue as task. Someone opened an issue in your repo: "Login does not work in Safari". You say to Claude: "Read issue 42 in my repo and propose an implementation." Claude reads the issue, looks at the linked code, writes a plan. You make the changes, Claude opens a pull request at the end with a description that closes the issue.

Example 2: debug CI without a browser. Your pipeline is red. Instead of switching to github.com and digging through logs, you tell Claude: "What went wrong in the last main branch workflow run?" Claude reads the logs, gives you the exact error, suggests a fix.

Example 3: security sweep. "Which Dependabot alerts are open in my repos, and which are critical?" Claude walks through, sorts by severity, tells you where to start. Saves you the manual scrolling through every repo.

Create a personal access token

Before you install the server you need a Personal Access Token (PAT). That is a key that lets Claude impersonate you on GitHub.

Important: give as few permissions as possible. If you only want to read, only give read permissions.

On github.com login, top right click your avatar, "Settings", left bottom "Developer settings", "Personal access tokens", "Tokens (classic)", "Generate new token".

Set these values:

  • Note: "Claude MCP Server" (so you know later what the token was for)
  • Expiration: 90 days (NOT "no expiration")
  • Scopes: at minimum repo and read:org. If you also want to manage workflows add workflow.

Click "Generate token". GitHub shows you a long string starting with ghp_. Copy it NOW, GitHub never shows it again. Put it in a password manager.

Install in Claude Code

You need Claude Code installed as CLI. In your terminal:

claude mcp add --transport http github https://api.githubcopilot.com/mcp \
  --header "Authorization: Bearer ghp_YOUR_TOKEN_HERE"

That is the official syntax from the Claude Code docs (code.claude.com/docs/en/mcp). Replace ghp_YOUR_TOKEN_HERE with the token you copied above.

That is it. Restart Claude Code, ask "list my repositories" or "what issues are open in MY-REPO", you get real data back.

URL note: the hosted server lives on api.githubcopilot.com/mcp. It works even if you do not have GitHub Copilot subscription. The name is confusing, but the MCP endpoint is free with any GitHub account.

Install in Claude Desktop

As of 2026, Claude Desktop does not yet support the hosted variant via OAuth. You need the local Docker variant.

Prerequisite: Docker Desktop installed (free at docker.com). If you have never used Docker, that is its own topic. For the start, going via Claude Code is enough.

If Docker is installed, open the Claude Desktop config file:

  • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add this (or extend the mcpServers section if other servers are already in there):

{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_YOUR_TOKEN_HERE"
      }
    }
  }
}

Restart Claude Desktop. In the tools list you should see "github" now.

Security notes

Three things to remember.

First: the PAT is like a password. Do not post it in Slack, do not commit it, do not show it in screenshots. If the token leaks, immediately revoke it on github.com and generate a new one.

Second: keep scopes minimal. If you only want to read issues, do not give repo (full access) but public_repo or a fine-grained token with read-only on specific repos.

Third: fine-grained personal access tokens are better than classic tokens, because they are configurable per repo and expire automatically. There is a "Fine-grained tokens" tab on the token page, that is the better option once you are comfortable with the basics.

What you avoid now

Without the GitHub MCP Server the typical beginner flow is constant context switching between editor, browser, terminal. Read issue in browser, switch to editor, switch back to open the pull request, third tab for CI.

With the MCP Server that goes away. Claude can do all of this from the conversation, you stay focused on what you actually want to build.

The psychological effect is bigger than people expect. I know people who only after MCP felt that Claude is a real teammate and not just a fast typing helper.

What you can do now

  • Understand roughly what MCP is and what the GitHub MCP Server is for
  • Create a personal access token with minimal scopes
  • Configure the GitHub MCP Server in Claude Code or Claude Desktop
  • Three concrete workflows that run noticeably smoother with MCP
  • The most important security notes around PATs

That ends the "Git for AI" mini-module. You now have the safety net, the routine, and the pro tooling. You do not need more as an operator. If you want to go deeper, look at Level 4 about memory systems. With memory plus Git plus GitHub MCP you have the core stack pros really use in 2026.

You're reading without an account. Login saves your progress so you can pick up where you left off. Log in →