Skip to content

Guide for setting up GitHub MCP Server with Claude Code and Claude Desktop

Notifications You must be signed in to change notification settings

pcantalupo/github-mcp-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Setting Up GitHub MCP Server with Claude Code and Claude Desktop

This guide connects Claude to your GitHub account so it can list repositories, manage issues, create PRs, work with gists, and more.

Prerequisites

  • A GitHub account
  • A GitHub Personal Access Token (PAT)
  • For Claude Desktop: Docker installed and running
  • For Claude Code: Claude Code CLI installed

Step 1: Create a GitHub Personal Access Token

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token" (classic)
  3. Give it a descriptive name (e.g., "Claude MCP")
  4. Select scopes based on your needs:
Scope Purpose
repo Access private repos, create issues/PRs (recommended)
public_repo Access public repos only (minimal option)
read:org Read organization membership
read:user Read user profile data
gist Create and manage gists

Recommended minimum: repo + read:org

  1. Click "Generate token" and copy it immediately (you won't see it again)

Security note: Never share your PAT. If exposed, revoke it immediately at https://github.com/settings/tokens


Option A: Claude Code Setup

Claude Code supports HTTP transport, making setup simpler (no Docker required).

Add the GitHub MCP Server

In your terminal (not in Claude Code):

claude mcp add -s user --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_PAT_HERE"

Replace YOUR_PAT_HERE with your actual token.

Scope options:

  • -s user = available across all projects (recommended)
  • -s local = current project only (default)
  • -s project = shared with team via .mcp.json

Verify It Worked

claude mcp list

You should see github with a checkmark.

Test It

Start Claude Code:

claude

Then try:

List my GitHub repositories

or

Show open issues in owner/repo-name

Option B: Claude Desktop Setup

Claude Desktop does not support HTTP transport for GitHub MCP. You must use the Docker-based setup.

Install Docker

If not already installed:

Make sure Docker is running before proceeding.

Edit Claude Desktop Config

Open the config file:

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

Add or merge the github server configuration:

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

Replace YOUR_PAT_HERE with your actual token.

Example: Combined Config with btw

If you also have btw configured:

{
  "mcpServers": {
    "r-btw": {
      "command": "Rscript",
      "args": ["-e", "btw::btw_mcp_server()"]
    },
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_PAT_HERE"
      }
    }
  }
}

Restart Claude Desktop

Quit and reopen Claude Desktop for changes to take effect.

Test It

Ask Claude:

List my GitHub repositories

Common Tasks

Once connected, try these prompts:

Task Example Prompt
List repos "List my GitHub repositories"
View issues "Show open issues in owner/repo"
Create issue "Create an issue in owner/repo titled 'Bug report'"
List PRs "Show open PRs assigned to me"
Review PR "Review PR #123 in owner/repo"
View commits "Show recent commits in owner/repo"
Create gist "Create a gist called test.R with a hello world script"
List gists "List my gists"

Troubleshooting

Claude Code: "Incompatible auth server: does not support dynamic client registration"

This happens if you try to use OAuth authentication. Use the PAT method instead:

claude mcp remove github
claude mcp add -s user --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_PAT"

Claude Desktop: "command is undefined"

Claude Desktop doesn't support "type": "http" configs. Use the Docker setup shown above.

Docker: "ghcr.io pull error"

Try logging out first:

docker logout ghcr.io

Then restart Claude Desktop.

Server shows "failed" in /mcp

  1. Check that Docker is running (for Claude Desktop)
  2. Verify your PAT hasn't expired
  3. Remove and re-add the server:

Claude Code:

claude mcp remove github
claude mcp add -s user --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_PAT"

Claude Desktop: Edit the config file and restart.


Useful Commands (Claude Code)

Command Description
claude mcp list List all MCP servers and status
claude mcp get github Show github server details
claude mcp remove github Remove the github server
/mcp (inside Claude Code) Interactive MCP status and tools

References

About

Guide for setting up GitHub MCP Server with Claude Code and Claude Desktop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published