docs/installation-guides/install-claude.md
For security, avoid hardcoding your token. One common approach:
.env fileGITHUB_PAT=your_token_here
echo -e ".env\n.mcp.json" >> .gitignore
Note: For Claude Code versions 2.1.1 and newer, use the
add-jsoncommand format below. For older versions, see the legacy command format.Windows / CLI note:
claude mcp add-jsonmay returnInvalid inputwhen adding an HTTP server. If that happens, use the legacyclaude mcp add --transport http ...command format below.
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}'
With an environment variable:
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer '"$(grep GITHUB_PAT .env | cut -d '=' -f2)"'"}}'
About the
--scopeflag (optional): Use this to specify where the configuration is stored:
local(default): Available only to you in the current project (was calledprojectin older versions)project: Shared with everyone in the project via.mcp.jsonfileuser: Available to you across all projects (was calledglobalin older versions)Example: Add
--scope userto the end of the command to make it available across all projects.
claude mcp list to see if the GitHub server is configuredclaude 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
claude mcp list to see if the GitHub server is configuredPATHclaude mcp add-json github '{"command": "github-mcp-server", "args": ["stdio"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"}}'
claude mcp list to see if the GitHub server is configuredclaude mcp list
claude mcp get github
If you're using Claude Code version 2.1.0 or earlier, use this legacy command format:
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)"
If you see missing required argument 'name', put the server name immediately after claude mcp add:
$pat = "YOUR_GITHUB_PAT"
claude mcp add github --transport http https://api.githubcopilot.com/mcp/ -H "Authorization: Bearer $pat"
⚠️ 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!
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.
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonAdd 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"
}
}
}
}
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonYOUR_GITHUB_PAT with your actual token or $GITHUB_PAT environment variableAuthentication Failed:
repo scopeRemote Server:
https://api.githubcopilot.com/mcpDocker Issues (Local Only):
docker pull ghcr.io/github/github-mcp-serverdocker logout ghcr.io then retryServer Not Starting / Tools Not Showing:
claude mcp list to view currently configured MCP servers/mcp commandclaude mcp remove github and repeating the setup process with a different method/mcp commandls ~/Library/Logs/Claude/ and cat ~/Library/Logs/Claude/mcp-server-*.log (macOS) or %APPDATA%\Claude\logs\ (Windows)@modelcontextprotocol/server-github is deprecated as of April 2025--scope flag documentation in the Remote Server Setup section