Back to Blog/devtools

How to Use the GitHub MCP Server with Claude Code

Connect the official GitHub MCP server to Claude Code using a remote endpoint and project configuration, then verify a read-only repository task.

Gus MarquezGus MarquezMay 7, 20262 min read
#mcp#developer#github#devtools#claude-code

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.

json
{
  "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:

bash
claude mcp get github

Within 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.

Frequently Asked Questions

Is @modelcontextprotocol/server-github the current official GitHub server?

No. Use github/github-mcp-server and its installation documentation for the official server.

Where does a shared Claude Code MCP configuration go?

A project configuration belongs in .mcp.json at the project root. Keep actual token values out of that file.

How should I verify access?

Inspect the MCP connection, then request one known issue from a repository you can access and compare its title and link with GitHub.

Related Articles