MCP
GitHub
Complete Guide

GitHub MCP Server: Complete Setup & Usage Guide 2026

The most popular developer MCP. Manage GitHub repos, issues, PRs, and Actions from natural language — all from your AI assistant.

March 6, 202610 min read

Quick Setup (3 Steps)

  1. Get a GitHub Personal Access Token at github.com/settings/tokens
  2. Add the MCP config to your AI tool (see below)
  3. Restart your AI tool

Step 1: Get a GitHub Personal Access Token

Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic). Click "Generate new token".

Select these scopes:

  • repo — Full repository access (or just public_repo for public repos only)
  • read:org — Read org membership
  • read:user — Read user profile
  • workflow — If you want to trigger Actions

Copy the token — you'll only see it once.

Step 2: Add GitHub MCP to Your Config

For Claude Code (~/.claude.json):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_YOUR_TOKEN_HERE"
      }
    }
  }
}

For Cursor (.cursor/mcp.json in your project):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_YOUR_TOKEN_HERE"
      }
    }
  }
}

Step 3: Test It

Restart your AI tool, then try these prompts:

  • "List my most recent GitHub repositories"
  • "Show open issues in [owner]/[repo]"
  • "Create an issue titled 'Fix login bug' in my project"

Full Capabilities

Repository Management

  • Create and fork repositories
  • List repos in your account or org
  • Get repo details, topics, languages
  • Update repo settings

Issues & PRs

  • Create, update, close issues
  • Add labels, assignees, milestones
  • Create and review pull requests
  • Merge PRs with different strategies

Code & Search

  • Search across all of GitHub
  • Read file contents at any commit
  • Get blame and history for files
  • Search code with regex

Branches & Commits

  • Create and delete branches
  • Compare branches
  • Get commit history
  • Create commits directly via API

Workflow & Actions

  • List workflow runs
  • Trigger workflow dispatch events
  • Download artifacts
  • Get job logs

Notifications & Activity

  • List and mark notifications
  • Get user activity
  • Watch/unwatch repositories
  • Star and unstar repos

Powerful Example Prompts

"Find all open bugs in my repo from this week and create a priority list"

Searches issues + formats by priority

"Review the open PR from @teammate and suggest improvements"

Reads diff, comments with suggestions

"Create a GitHub release for version 2.0 with these changelog notes: [paste notes]"

Creates tag + release automatically

"What files changed most in the last 20 commits in main?"

Analyzes commit history, groups by file

"Create a PR from my current branch to main with a description of what changed"

Reads local changes, creates PR with AI-written description

Security: Protecting Your Token

  • Use fine-grained PATs (new format) over classic tokens when possible — they scope to specific repos
  • Set an expiration date on your token (90 days is a good default)
  • Store the token in env in your config, never in args
  • Add your config file to .gitignore if it contains the token
  • Prefer project-scoped configs over global so you only expose tokens for repos you're actively working on

Frequently Asked Questions

Does GitHub MCP work with GitHub Enterprise?

Yes. Set the GITHUB_PERSONAL_ACCESS_TOKEN and optionally GITHUB_API_URL env var to your GitHub Enterprise URL.

Can it create commits directly?

Yes — GitHub MCP can create file contents and commits via the GitHub API without needing a local git clone. However, for local development the Filesystem MCP + git commands is usually more reliable.

What's the rate limit?

GitHub API rate limit is 5,000 requests/hour for authenticated requests. In practice, this is never a constraint for typical developer use.

GitHub MCP is Just the Start

Combine it with Filesystem, Search, and Linear MCPs for a complete developer setup.