|
| 1 | +# Install GitHub MCP Server in Claude Applications |
| 2 | + |
| 3 | +This guide covers installation of the GitHub MCP server for Claude Code CLI, Claude Desktop, and Claude Web applications. |
| 4 | + |
| 5 | +## Claude Web (claude.ai) |
| 6 | + |
| 7 | +Claude Web supports remote MCP servers through the Integrations built-in feature. |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +1. Claude Pro, Team, or Enterprise account (Integrations not available on free plan) |
| 12 | +2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) |
| 13 | + |
| 14 | +### Installation |
| 15 | + |
| 16 | +**Note**: As of July 2025, the remote GitHub MCP Server has known compatibility issues with Claude Web. While Claude Web supports remote MCP servers from other providers (like Atlassian, Zapier, Notion), the GitHub MCP Server integration may not work reliably. |
| 17 | + |
| 18 | +For other remote MCP servers that do work with Claude Web: |
| 19 | + |
| 20 | +1. Go to [claude.ai](https://claude.ai) and log in |
| 21 | +2. Click your profile icon → **Settings** |
| 22 | +3. Navigate to **Integrations** section |
| 23 | +4. Click **+ Add integration** or **Add More** |
| 24 | +5. Enter the remote server URL |
| 25 | +6. Follow the OAuth authentication flow when prompted |
| 26 | + |
| 27 | +**Alternative**: Use Claude Desktop or Claude Code CLI for reliable GitHub MCP Server integration. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Claude Code CLI |
| 32 | + |
| 33 | +Claude Code CLI provides command-line access to Claude with MCP server integration. |
| 34 | + |
| 35 | +### Prerequisites |
| 36 | + |
| 37 | +1. Claude Code CLI installed |
| 38 | +2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) |
| 39 | +3. [Docker](https://www.docker.com/) installed and running |
| 40 | + |
| 41 | +### Installation |
| 42 | + |
| 43 | +Run the following command to add the GitHub MCP server using Docker: |
| 44 | + |
| 45 | +```bash |
| 46 | +claude mcp add github -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server |
| 47 | +``` |
| 48 | + |
| 49 | +Then set the environment variable: |
| 50 | +```bash |
| 51 | +claude mcp update github -e GITHUB_PERSONAL_ACCESS_TOKEN=your_github_pat |
| 52 | +``` |
| 53 | + |
| 54 | +Or as a single command with the token inline: |
| 55 | +```bash |
| 56 | +claude mcp add-json 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"}}' |
| 57 | +``` |
| 58 | + |
| 59 | +**Important**: The npm package `@modelcontextprotocol/server-github` is no longer supported as of April 2025. Use the official Docker image `ghcr.io/github/github-mcp-server` instead. |
| 60 | + |
| 61 | +### Configuration Options |
| 62 | + |
| 63 | +- Use `-s user` to add the server to your user configuration (available across all projects) |
| 64 | +- Use `-s project` to add the server to project-specific configuration (shared via `.mcp.json`) |
| 65 | +- Default scope is `local` (available only to you in the current project) |
| 66 | + |
| 67 | +### Verification |
| 68 | + |
| 69 | +Run the following command to verify the installation: |
| 70 | +```bash |
| 71 | +claude mcp list |
| 72 | +``` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Claude Desktop |
| 77 | + |
| 78 | +Claude Desktop provides a graphical interface for interacting with the GitHub MCP Server. |
| 79 | + |
| 80 | +### Prerequisites |
| 81 | + |
| 82 | +1. Claude Desktop installed |
| 83 | +2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) |
| 84 | +3. [Docker](https://www.docker.com/) installed and running |
| 85 | + |
| 86 | +### Configuration File Location |
| 87 | + |
| 88 | +- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` |
| 89 | +- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` |
| 90 | +- **Linux**: `~/.config/Claude/claude_desktop_config.json` (unofficial support) |
| 91 | + |
| 92 | +### Installation |
| 93 | + |
| 94 | +Add the following to your `claude_desktop_config.json`: |
| 95 | + |
| 96 | +```json |
| 97 | +{ |
| 98 | + "mcpServers": { |
| 99 | + "github": { |
| 100 | + "command": "docker", |
| 101 | + "args": [ |
| 102 | + "run", |
| 103 | + "-i", |
| 104 | + "--rm", |
| 105 | + "-e", |
| 106 | + "GITHUB_PERSONAL_ACCESS_TOKEN", |
| 107 | + "ghcr.io/github/github-mcp-server" |
| 108 | + ], |
| 109 | + "env": { |
| 110 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat" |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +**Important**: The npm package `@modelcontextprotocol/server-github` is no longer supported as of April 2025. Use the official Docker image `ghcr.io/github/github-mcp-server` instead. |
| 118 | + |
| 119 | +### Using Environment Variables |
| 120 | + |
| 121 | +Claude Desktop supports environment variable references. You can use: |
| 122 | + |
| 123 | +```json |
| 124 | +{ |
| 125 | + "mcpServers": { |
| 126 | + "github": { |
| 127 | + "command": "docker", |
| 128 | + "args": [ |
| 129 | + "run", |
| 130 | + "-i", |
| 131 | + "--rm", |
| 132 | + "-e", |
| 133 | + "GITHUB_PERSONAL_ACCESS_TOKEN", |
| 134 | + "ghcr.io/github/github-mcp-server" |
| 135 | + ], |
| 136 | + "env": { |
| 137 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT" |
| 138 | + } |
| 139 | + } |
| 140 | + } |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +Then set the environment variable in your system before starting Claude Desktop. |
| 145 | + |
| 146 | +### Installation Steps |
| 147 | + |
| 148 | +1. Open Claude Desktop |
| 149 | +2. Go to Settings (from the Claude menu) → Developer → Edit Config |
| 150 | +3. Add your chosen configuration |
| 151 | +4. Save the file |
| 152 | +5. Restart Claude Desktop |
| 153 | + |
| 154 | +### Verification |
| 155 | + |
| 156 | +After restarting, you should see: |
| 157 | +- An MCP icon in the Claude Desktop interface |
| 158 | +- The GitHub server listed as "running" in Developer settings |
| 159 | + |
| 160 | +--- |
| 161 | + |
| 162 | +## Troubleshooting |
| 163 | + |
| 164 | +### Claude Web |
| 165 | +- Currently experiencing compatibility issues with the GitHub MCP Server |
| 166 | +- Try other remote MCP servers (Atlassian, Zapier, Notion) which work reliably |
| 167 | +- Use Claude Desktop or Claude Code CLI as alternatives for GitHub integration |
| 168 | + |
| 169 | +### Claude Code CLI |
| 170 | +- Verify the command syntax is correct (note the single quotes around the JSON) |
| 171 | +- Ensure Docker is running: `docker --version` |
| 172 | +- Use `/mcp` command within Claude Code to check server status |
| 173 | + |
| 174 | +### Claude Desktop |
| 175 | +- Check logs at: |
| 176 | + - **macOS**: `~/Library/Logs/Claude/` |
| 177 | + - **Windows**: `%APPDATA%\Claude\logs\` |
| 178 | +- Look for `mcp-server-github.log` for server-specific errors |
| 179 | +- Ensure configuration file is valid JSON |
| 180 | +- Try running the Docker command manually in terminal to diagnose issues |
| 181 | + |
| 182 | +### Common Issues |
| 183 | +- **Invalid JSON**: Validate your configuration at [jsonlint.com](https://jsonlint.com) |
| 184 | +- **PAT issues**: Ensure your GitHub PAT has required scopes |
| 185 | +- **Docker not found**: Install Docker Desktop and ensure it's running |
| 186 | +- **Docker image pull fails**: Try `docker logout ghcr.io` then retry |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## Security Best Practices |
| 191 | + |
| 192 | +- **Protect configuration files**: Set appropriate file permissions |
| 193 | +- **Use environment variables** when possible instead of hardcoding tokens |
| 194 | +- **Limit PAT scope** to only necessary permissions |
| 195 | +- **Regularly rotate** your GitHub Personal Access Tokens |
| 196 | +- **Never commit** configuration files containing tokens to version control |
| 197 | + |
| 198 | +--- |
| 199 | + |
| 200 | +## Additional Resources |
| 201 | + |
| 202 | +- [Model Context Protocol Documentation](https://modelcontextprotocol.io) |
| 203 | +- [Claude Code MCP Documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) |
| 204 | +- [Claude Web Integrations Support](https://support.anthropic.com/en/articles/11175166-about-custom-integrations-using-remote-mcp) |
0 commit comments