Room 42, home

Connect Claude to GitHub with MCP

Set up the GitHub MCP server so Claude reads issues, pull requests, and code from your repos directly, with no more copy and paste between tabs.

MCPadvanced8 min readUpdated 13 Jun 2026

In short

  1. 01The GitHub MCP server lets Claude read your issues, pull requests, and code directly, with no copy and paste.
  2. 02Setup is one claude mcp add command pointed at GitHub's hosted endpoint, plus a fine-grained personal access token.
  3. 03Confirm it worked with claude mcp list and the /mcp panel, then ask a read-only question to prove the data flows.
  4. 04Keep the blast radius small: start read-only, scope the token to named repos, and never commit it to a project config.
Contents · 12 sections
  1. 1What can Claude do with GitHub?
  2. 2The two pieces you connect
  3. 3Step 1: create a GitHub token
  4. 4Step 2: add the server
  5. 5Step 3: confirm it connected
  6. 6How does a GitHub request flow through Claude?
  7. 7Which scope should I use?
  8. 8Daily use
  9. 9Reference an issue or PR by mention
  10. 10How do I keep the token safe?
  11. 11Troubleshooting
  12. 12Where to go next

Add GitHub's remote MCPModel Context Protocol: an open standard that lets AI apps connect to tools and data through one common interface. server to the Claude Code CLI with one claude mcp add command, then authenticate. After that Claude reads your issues, pull requests, and code directly, so you stop pasting issue text and diffs into the chat. This guide shows the exact setup and the checks that confirm it worked.

Add the server, confirm it connected, then ask for a summary of open pull requests. Illustrative session.

If MCP is new to you, read MCP fundamentals first for the host, client, and server model. Here you connect one real server end to end.

What can Claude do with GitHub?

Once the server is connected, you ask Claude to do GitHub work in plain language and it acts on the live data instead of a snapshot you pasted:

  • "Read issue #142 and draft a fix plan."
  • "Review PR #456 and list the risky changes."
  • "Show every open pull request assigned to me."
  • "Find where parseToken is defined across the repo."

Claude calls the server's tools to fetch issues, PRs, file contents, and search results, then works from what comes back. You never leave the terminal.

The two pieces you connect

GitHub publishes a hosted MCP server, so you do not install or run anything locally. You point Claude Code at its URL and prove who you are with a token.

  • The server URL · https://api.githubcopilot.com/mcp/. This is GitHub's remote endpoint. Claude Code reaches it over HTTP.
  • A GitHub token · a personal access tokenA scoped credential you generate in GitHub settings. It stands in for your password and grants only the access you select. that tells GitHub which repos Claude may touch and what it may do with them.

Because the server is remote, the connection uses the HTTP transportThe channel a host and server talk over. HTTP is used for remote servers; stdio is used for local ones the host launches itself., not a local subprocess. That matters for the flags you pass below.

Step 1: create a GitHub token

Open your GitHub token settings and generate a new fine-grained personal access tokenA token scoped to specific repositories and specific permissions, rather than one that can touch your whole account.. Grant it access to only the repositories you want Claude to work with, and only the permissions you need.Common gotchaFor a repo owned by an organisation, a fine-grained token often needs an org admin to approve it before it works, and until then you get a "connected but no tools" or "cannot see the repo" state, not a clear error.Check the org's Personal access tokens settings (or ask an admin) so the token is approved for that org.

For reading and acting on issues, PRs, and code, these repository permissions cover the common cases:

PermissionAccessLets Claude
ContentsReadRead file contents and branches
IssuesRead and writeRead issues, create them, comment
Pull requestsRead and writeRead PRs, open them, review, comment
MetadataReadList repos and basic repo info (required)

Start with Read access everywhere if you only want Claude to look, never change anything. You widen to Read and write later when you want it to open issues or PRs. Copy the token when GitHub shows it. You see it once.

SecretsA credential like an API key or access token. Treat it like a password. belong out of your shell history and out of version control. Paste the token only into the command below, and never commit it to a repo.

Step 2: add the server

Run this in your terminal. Replace YOUR_GITHUB_PAT with the token you just created:

claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"

Reading the command left to right:

  • claude mcp add registers a new server.
  • --transport http selects the HTTP transport for a remote server. Without it, Claude Code does not know how to reach the URL.Common gotchaThe easy slip is leaving off --transport http. The default transport is stdio, so Claude Code treats the GitHub URL as a local program to launch, then fails with a confusing "command not found" or a server stuck on "failed" instead of a clear network error.For any hosted endpoint, pass --transport http (or --transport sse if the server uses it) so the CLI talks over the network rather than spawning a subprocess.
  • github is the name you give the server. You use this name later with claude mcp get github and claude mcp remove github.
  • The URL is GitHub's hosted endpoint.
  • --header "Authorization: Bearer YOUR_GITHUB_PAT" sends your token on every request so GitHub knows it is you.

That writes the server into your config. By default it lands at local scopeThe scope a server is stored in. Local is the default: private to you, active only in the current project., which means it is private to you and active only in the project where you ran the command.

Step 3: confirm it connected

List your servers to confirm the entry exists:

claude mcp list

Then start Claude Code and open the MCP panel:

claude
/mcp

The /mcp panel shows each connected server and the number of tools it exposes. A healthy GitHub entry shows a connected status and a tool count above zero. If the server needs a browser sign-in, the panel walks you through it.

Now ask Claude a read-only question to prove the data flows:

Try this prompt
List the five most recently updated open issues in this repository, with their numbers and titles.

If Claude returns real issue numbers and titles from your repo, the connection works. If it cannot reach GitHub, jump to Troubleshooting below.

How does a GitHub request flow through Claude?

When you ask Claude something that needs GitHub, this is the round trip:

Claude decides which tool to call, the CLI sends the call to the GitHub server with your token attached, the server returns the data, and Claude works from that result. You see the answer, not the wiring.

Which scope should I use?

The scope decides which projects see the server and whether your team shares it. You set it with --scope:

ScopeLoads inShared with teamStored in
local (default)Current project onlyNoYour home config
projectCurrent project onlyYes, via version control.mcp.json in the repo
userAll your projectsNoYour home config

For a token tied to your own account, keep the default local scope or use user scope so the server follows you across projects:

claude mcp add --transport http github --scope user https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"

Avoid project scope for this server. Project scope writes a shared .mcp.json into the repo, and you do not want a personal token committed there. If you want a team-shared .mcp.json, reference the token through an environment variable instead of pasting it. Claude Code expands ${VAR} inside .mcp.json:

{
  "mcpServers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${GITHUB_PAT}"
      }
    }
  }
}

With that file in the repo, each teammate sets their own GITHUB_PAT in their environment and the secret stays out of version control.

Daily use

With the server connected, you give GitHub work to Claude the same way you give it any task. Concrete prompts get concrete answers.

Read and plan from an issue:

Try this prompt
Read issue #142 in this repo. Summarize the bug in two lines, then list the files you would change to fix it. Do not edit anything yet.

Review a pull request:

Try this prompt
Review PR #456. List correctness risks first, then style notes. For each item give the file and a one-line reason.

Triage your queue:

Try this prompt
Show every open pull request assigned to me, sorted by oldest first, with the repo name and title for each.

You combine GitHub with your local checkout in one request. Claude reads the issue from GitHub, then edits files in your working tree:

Try this prompt
Read issue #142, apply the fix to src/auth/session.ts, run the test suite, and tell me what changed. Stop before committing.

Reference an issue or PR by mention

If the server exposes its data as resources, you pull a specific item into context with an @ mention instead of describing it. Type @ in your prompt to browse what is available, then reference one directly:

Analyze @github:issue://142 and suggest a fix.

The referenced item is fetched and attached to your message, so Claude reads the real issue rather than your paraphrase of it.

How do I keep the token safe?

A token is a key to your repos. For the broader picture of what to allow and what to block, see MCP security basics. Two habits keep the risk low:

  • Start read-only. Grant Read access first. Confirm Claude reads issues and PRs the way you expect before you grant write access. You widen permissions when you have a reason, not by default.
  • Scope to repos you name. A fine-grained token can list the exact repositories it reaches. Pick them by hand. A token that touches one repo cannot harm the rest of your account.

A server that pulls in outside text, like issue bodies written by other people, can carry instructions aimed at the model. This is prompt injectionHidden instructions placed in content the model reads, written to make it act against your intent.. Read what Claude proposes before you let it write to GitHub or push changes, the same way you review a teammate's pull request before merging.

Troubleshooting

The token is rejected. If you set the Authorization header and GitHub rejects it, Claude Code reports the connection as failed rather than retrying. Check that the token has not expired and that it grants access to the repo you are asking about. Regenerate the token and run claude mcp remove github, then add it again.

The panel shows no tools. A connected server with zero tools usually means the token lacks permission for any toolset. Confirm the token includes at least Metadata read plus the permissions in Step 1.

Claude cannot see a repo. Fine-grained tokens reach only the repositories you selected when you created them. Edit the token in GitHub settings to add the repo, or generate a new token that includes it.

Check or remove the server. Inspect the saved configuration or remove it entirely with these:

claude mcp get github
claude mcp remove github

Where to go next

You now have one real server connected and verified. The same claude mcp add pattern connects other services: an error tracker, a database, a folder of notes or docs. Each follows the steps you just ran, pick the transport, name the server, pass the credential, then confirm with /mcp. For the model behind all of it, the host, client, and server roles, see MCP fundamentals.