This guide connects Claude to your GitHub account so it can list repositories, manage issues, create PRs, work with gists, and more.
- A GitHub account
- A GitHub Personal Access Token (PAT)
- For Claude Desktop: Docker installed and running
- For Claude Code: Claude Code CLI installed
- Go to https://github.com/settings/tokens
- Click "Generate new token" (classic)
- Give it a descriptive name (e.g., "Claude MCP")
- 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
- 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
Claude Code supports HTTP transport, making setup simpler (no Docker required).
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
claude mcp listYou should see github with a checkmark.
Start Claude Code:
claudeThen try:
List my GitHub repositories
or
Show open issues in owner/repo-name
Claude Desktop does not support HTTP transport for GitHub MCP. You must use the Docker-based setup.
If not already installed:
- macOS: https://docs.docker.com/desktop/install/mac-install/
- Windows: https://docs.docker.com/desktop/install/windows-install/
Make sure Docker is running before proceeding.
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.
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"
}
}
}
}Quit and reopen Claude Desktop for changes to take effect.
Ask Claude:
List my GitHub repositories
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" |
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 doesn't support "type": "http" configs. Use the Docker setup shown above.
Try logging out first:
docker logout ghcr.ioThen restart Claude Desktop.
- Check that Docker is running (for Claude Desktop)
- Verify your PAT hasn't expired
- 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.
| 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 |