Use GitHub's official MCP server to connect Claude Code to repository tools. The old @modelcontextprotocol/server-github npm example in earlier versions of this guide is not the current official implementation.
Source review: September 10, 2026. This is a documented configuration example, not a claim that an authenticated installation was tested for this article.
Choose a supported connection
GitHub documents a hosted server and local deployment options. This guide uses the hosted endpoint with a personal access token, following GitHub's Claude installation guide. Check that guide for local Docker or binary setup and account-specific requirements.
Create a token with access to the repository and only the operations you intend to use. Have your shell or secret manager provide it as GITHUB_TOKEN before starting Claude Code. Do not paste the actual token into this example or a committed file.
Add a project configuration
Save the following as .mcp.json at your project root. If it already exists, merge the github entry into its existing mcpServers object rather than replacing other entries.
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp",
"headers": {
"Authorization": "Bearer ${GITHUB_TOKEN}"
}
}
}
}Claude Code documents project scope in .mcp.json and environment expansion in headers. Start it from this project and review any server approval request. User and local scope use different storage; do not replace ~/.claude.json with this standalone object. Claude Code MCP configuration.
Verify one repository operation
In a terminal, inspect the configuration:
claude mcp get githubWithin Claude Code, open /mcp and inspect the connection. Then use a known issue as the check:
Read issue 12 from OWNER/REPOSITORY using the GitHub MCP tools. Return its title, state, and link. Do not write comments or modify anything.
Replace the repository and number with an issue you can verify yourself. A connected status tests the connection; matching the issue tests the account, repository access, and tool result.
If authentication fails, confirm that the environment variable exists in the process launching Claude Code. If the connection succeeds but a repository request fails, check the token's selected repositories, permissions, and organization restrictions before broadening access.
Keep the workflow small
Start with issue lookup or pull-request reading. Add write permissions only after identifying a task that needs them. If your existing gh workflow already handles a job well, there is no requirement to replace it; evaluate MCP against the same known repository task.
For a different client, see the Cursor guide. For platform choice, use the GitHub versus GitLab comparison.