github-mcp-server

Install GitHub MCP Server in Claude Applications

Claude Code CLI

Prerequisites

Storing Your PAT Securely
For security, avoid hardcoding your token. One common approach: 1. Store your token in `.env` file ``` GITHUB_PAT=your_token_here ``` 2. Add to .gitignore ```bash echo -e ".env\n.mcp.json" >> .gitignore ```

Remote Server Setup (Streamable HTTP)

  1. 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)"
  1. Restart Claude Code
  2. Run claude mcp list to see if the GitHub server is configured

Local Server Setup (Docker required)

With Docker

  1. 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
  1. Restart Claude Code
  2. Run claude mcp list to see if the GitHub server is configured

With a Binary (no Docker)

  1. Download release binary
  2. Add to your PATH
  3. Run:
    claude mcp add-json github '{"command": "github-mcp-server", "args": ["stdio"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"}}'
    
  4. Restart Claude Code
  5. Run claude mcp list to 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

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

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

  1. Open Claude Desktop
  2. Go to Settings → Developer → Edit Config
  3. Paste the code block above in your configuration file
  4. 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
  5. Open the file in a text editor
  6. Paste one of the code blocks above, based on your chosen configuration (remote or local)
  7. Replace YOUR_GITHUB_PAT with your actual token or $GITHUB_PAT environment variable
  8. Save the file
  9. Restart Claude Desktop

Troubleshooting

Authentication Failed:

Remote Server:

Docker Issues (Local Only):

Server Not Starting / Tools Not Showing:


Important Notes