Skip to content

GitHub MCP Server for Claude Code: Setup on Windows and WSL

Connect the GitHub MCP server to Claude Code on Windows and WSL. Token auth, what it unlocks — issues, PRs, code search — example workflows, and scope cautions.

MGMCSA Guru Team June 13, 2026 5 min read
Claude Code connected to the GitHub MCP server showing issues and pull requests

The GitHub MCP server is the connection most Claude Code users get the most out of. Once it’s wired up, you stop pasting issue text and PR diffs into the terminal — Claude reads them directly, searches your code, and can open or review pull requests on your behalf.

This walks through the whole thing on Windows and WSL: creating a scoped token, adding the server, confirming the connection, and a couple of workflows that show why it’s worth it. It also covers the permission traps, because a GitHub token is a real credential and the server runs with whatever you give it.

If you haven’t set up any MCP servers yet, the MCP setup guide for Windows and WSL covers the basics this article assumes.

What you get when it’s connected

With the server running and a token in place, Claude can:

  • Read, create, and comment on issues
  • Open, review, and comment on pull requests
  • Search code across the repos your token can see
  • Read file contents and branch state without a local clone
  • Inspect workflow runs and their status

How much of that it can actually do depends entirely on the token scope. A read-only token gives you triage and search; write access adds creating issues and PRs. Start narrow.

Create a scoped token first

Do this before adding the server. In GitHub, go to Settings → Developer settings → Personal access tokens → Fine-grained tokens and create one.

  • Resource owner: your account or org
  • Repository access: only the repos you want Claude to touch
  • Permissions: start with read for Contents, Issues, Pull requests, and Metadata; add write only if you want Claude creating issues or PRs

Copy the token once — GitHub won’t show it again. The full permission reference is in the GitHub token docs.

Add the server

Store the token in an environment variable so it stays out of your shell history and config files.

On WSL or Linux:

export GITHUB_TOKEN="github_pat_your_token_here"
claude mcp add --transport http github https://api.githubcopilot.com/mcp \
  --header "Authorization: Bearer ${GITHUB_TOKEN}"

On native Windows PowerShell:

$env:GITHUB_TOKEN = "github_pat_your_token_here"
claude mcp add --transport http github https://api.githubcopilot.com/mcp --header "Authorization: Bearer $env:GITHUB_TOKEN"

To make the token persist across PowerShell sessions, set it once with setx GITHUB_TOKEN "..." and reopen the terminal. The exact endpoint and header flags can change between releases, so cross-check the official MCP page if the add command errors.

Confirm it connected

Two ways to check:

claude mcp list

That prints configured servers and whether each one connected. Inside a session, run /mcp to see the GitHub server and the tools it exposes. If it shows as failed, the token or — on native Windows — a missing command wrapper is almost always the reason.

Example workflows

Once it’s live, you talk to Claude in plain language and it uses the GitHub tools itself.

Triage an issue and propose a fix. Point it at an issue and let it pull the context:

Read issue #482, find the relevant code in this repo, and draft a fix on a new branch.

Claude reads the issue, searches the codebase through the server, and works from the real text instead of a summary you typed.

Review a pull request. Ask for a review of an open PR:

Review PR #91. Check for missing error handling and flag anything that needs a test.

It reads the diff and discussion and comes back with specific comments, which it can post if your token has write access.

Search across repos. Code search is one of the quiet wins:

Find every place we call the old auth helper across our repos.

That’s the kind of question that’s slow to answer by hand and fast through the server.

Permissions and cautions

The convenience comes with real reach. A few habits keep it safe:

Token scope by workflow

Read issues / PRs, search code Read: Contents, Issues, Pull requests, Metadata
Create issues and PRs Add Write: Issues, Pull requests
Triage only, no writes Read-only across the board
One repo only Scope token to that repository, not all repos

Beyond scope, treat issue and PR text as untrusted input. A comment can contain text that reads like an instruction to the agent — Claude should treat it as data, but you should still review actions before approving writes. For the broader picture, see Claude Code MCP security risks and best practices.

GitHub MCP setup checklist

  • Create a fine-grained token scoped to specific repos
  • Grant read first; add write only if you need it
  • Set an expiration on the token
  • Store the token in an environment variable, not in config
  • Add the server with claude mcp add (HTTP transport)
  • Verify with claude mcp list or /mcp
  • Choose project scope for teams, but keep the token out of git

Wrapping up

The GitHub MCP server pays for itself the first time Claude reads an issue, finds the code, and drafts a fix without you leaving the terminal. The setup is short: a scoped fine-grained token, one claude mcp add command, and a quick /mcp check. The discipline is all in the token — grant the least access that covers your workflow, keep it in an environment variable, and never commit it.

Next, see which other servers are worth your context in the best MCP servers for Claude Code in 2026.

Frequently asked questions

Do I need a personal access token for the GitHub MCP server?

Yes, unless you use an OAuth flow the server offers. A fine-grained personal access token is the most common method. Create it in GitHub developer settings, grant only the repositories and permissions you need, and pass it to the server as an environment variable rather than hard-coding it.

What can Claude do with the GitHub MCP server connected?

It can read and comment on issues, open and review pull requests, search code across your repos, read file contents, and inspect workflow runs — depending on the token scope you grant. With a read-only token it can triage and search; with write scope it can create issues and PRs.

Does the GitHub MCP server work the same on Windows and WSL?

The hosted HTTP server behaves identically. A locally launched server may need a cmd /c wrapper on native Windows that WSL doesn't, and the token environment variable is set with setx or $env in PowerShell versus export in bash. The capabilities are the same once it connects.

Should I use a classic or fine-grained token?

Prefer a fine-grained personal access token. It lets you limit access to specific repositories and pick exact permissions, so the server can't reach more than it needs. Classic tokens grant broad scopes and are harder to contain.

How do I check the server connected?

Run claude mcp list to see configured servers and their status, or open Claude Code and run /mcp to view connected servers and their tools. If GitHub shows as failed, the token or the launch command is the usual cause.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.