Spaces:
Build error
Install GitHub MCP Server in Claude Applications
Claude Code CLI
Prerequisites
- Claude Code CLI installed
- GitHub Personal Access Token
- For local setup: Docker installed and running
- Open Claude Code inside the directory for your project (recommended for best experience and clear scope of configuration)
Storing Your PAT Securely
For security, avoid hardcoding your token. One common approach:
- Store your token in
.envfile
GITHUB_PAT=your_token_here
- Add to .gitignore
echo -e ".env\n.mcp.json" >> .gitignore
Remote Server Setup (Streamable HTTP)
- Run the following command in the Claude Code CLI
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_GITHUB_PAT"
With an environment variable:
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer $(grep GITHUB_PAT .env | cut -d '=' -f2)"
- Restart Claude Code
- Run
claude mcp listto see if the GitHub server is configured
Local Server Setup (Docker required)
With Docker
- Run the following command in the Claude Code CLI:
claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
With an environment variable:
claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=$(grep GITHUB_PAT .env | cut -d '=' -f2) -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
- Restart Claude Code
- Run
claude mcp listto see if the GitHub server is configured
With a Binary (no Docker)
- Download release binary
- Add to your
PATH - Run:
claude mcp add-json github '{"command": "github-mcp-server", "args": ["stdio"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"}}'
- Restart Claude Code
- Run
claude mcp listto see if the GitHub server is configured
Verification
claude mcp list
claude mcp get github
Claude Desktop
⚠️ Note: Some users have reported compatibility issues with Claude Desktop and Docker-based MCP servers. We're investigating. If you experience issues, try using another MCP host, while we look into it!
Prerequisites
- Claude Desktop installed (latest version)
- GitHub Personal Access Token
- Docker installed and running
Note: Claude Desktop supports MCP servers that are both local (stdio) and remote ("connectors"). Remote servers can generally be added via Settings → Connectors → "Add custom connector". However, the GitHub remote MCP server requires OAuth authentication through a registered GitHub App (or OAuth App), which is not currently supported. Use the local Docker setup instead.
Configuration File Location
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Local Server Setup (Docker)
Add this codeblock to your claude_desktop_config.json:
{
"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_GITHUB_PAT"
}
}
}
}
Manual Setup Steps
- Open Claude Desktop
- Go to Settings → Developer → Edit Config
- Paste the code block above in your configuration file
- If you're navigating to the configuration file outside of the app:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Open the file in a text editor
- Paste one of the code blocks above, based on your chosen configuration (remote or local)
- Replace
YOUR_GITHUB_PATwith your actual token or $GITHUB_PAT environment variable - Save the file
- Restart Claude Desktop
Troubleshooting
Authentication Failed:
- Verify PAT has
reposcope - Check token hasn't expired
Remote Server:
- Verify URL:
https://api.githubcopilot.com/mcp
Docker Issues (Local Only):
- Ensure Docker Desktop is running
- Try:
docker pull ghcr.io/github/github-mcp-server - If pull fails:
docker logout ghcr.iothen retry
Server Not Starting / Tools Not Showing:
- Run
claude mcp listto view currently configured MCP servers - Validate JSON syntax
- If using an environment variable to store your PAT, make sure you're properly sourcing your PAT using the environment variable
- Restart Claude Code and check
/mcpcommand - Delete the GitHub server by running
claude mcp remove githuband repeating the setup process with a different method - Make sure you're running Claude Code within the project you're currently working on to ensure the MCP configuration is properly scoped to your project
- Check logs:
- Claude Code: Use
/mcpcommand - Claude Desktop:
ls ~/Library/Logs/Claude/andcat ~/Library/Logs/Claude/mcp-server-*.log(macOS) or%APPDATA%\Claude\logs\(Windows)
- Claude Code: Use
Important Notes
- The npm package
@modelcontextprotocol/server-githubis deprecated as of April 2025 - Remote server requires Streamable HTTP support (check your Claude version)
- Configuration scopes for Claude Code:
-s user: Available across all projects-s project: Shared via.mcp.jsonfile- Default:
local(current project only)