MCP GitHub Server¶
What it provides¶
The Model Context Protocol (MCP) GitHub server
gives Claude Code native access to GitHub APIs without shelling out to gh. This
includes:
- Issues -- list, create, update, comment
- Pull Requests -- list, create, review, merge
- Repositories -- search, read files, list branches
- Projects v2 -- read and update project board items
Configuration¶
The server is configured in .mcp.json at the project root. It reads the
GH_TOKEN environment variable from your .env file:
# .env (never commit this file)
GH_TOKEN=ghp_xxxxxxxxxxxxx
No additional setup is needed. Claude Code detects .mcp.json automatically
and starts the server on demand.
How it complements gh CLI¶
| Capability | gh CLI | MCP GitHub |
|---|---|---|
| Shell scripting | Native | Not applicable |
| Structured API data | JSON via --json | Native objects |
| Claude Code native | Via Bash tool | Direct tool calls |
| Offline fallback | Yes | No |
Both approaches work. The MCP server provides a more integrated experience
inside Claude Code, while gh CLI remains the fallback for scripting and
when MCP is not available.
Troubleshooting¶
- Ensure
GH_TOKENis set in.envwithrepo,project, andread:orgscopes. - Run
npx @modelcontextprotocol/server-githubmanually to verify the server starts. - If MCP is unavailable, all commands gracefully fall back to
ghCLI.