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, 20263 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.

Docs reviewed October 17, 2026 from GitHub setup documentation and the official repository. This guide is docs-derived; MCPFind did not authenticate or run a repository task.

The matching GitHub server listing links to the official implementation.

Choose a supported connection

GitHub recommends its hosted server for most users. For remote Claude Code, GitHub's Claude installation guide documents a personal access token (PAT) in the Authorization header. OAuth support depends on the client and its registered application; do not assume a bare endpoint enables OAuth in Claude Code. Local Docker or binary deployment remains a separate choice for customization or specific security requirements.

Review the account, repository access, and organization controls before connecting. Enable only the needed toolsets and read-only mode for lookup work, following GitHub's tool configuration documentation. An organization can restrict OAuth applications, PATs, or MCP access; changing authentication does not bypass those controls.

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_PERSONAL_ACCESS_TOKEN}"
      }
    }
  }
}

Make a least-privilege PAT available as GITHUB_PERSONAL_ACCESS_TOKEN in the environment that launches Claude Code, using your secret manager or local secret setup. The configuration references the variable; never commit the token value. Review the token's repository selection and organization restrictions before use.

Start Claude Code from that environment and project, then open /mcp to inspect the GitHub entry. Follow the current client configuration documentation for environment-variable expansion, project approval, and storage.

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, check the PAT's validity and the environment available to the client. If a repository request fails, review account access, selected repositories, toolsets, 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