GitHub MCP server: setup, toolsets, tools and fixes

GitHub's official MCP server: its URL, setup in Claude Code, Cursor, VS Code, Codex and Claude, toolsets, read-only and lockdown modes, tokens and fixes.

Updated

Short answer

GitHub runs an official MCP server (a connector that lets an AI agent use GitHub) at https://api.githubcopilot.com/mcp/. It's free on every GitHub plan, with no Copilot subscription needed, and gives an agent tools for code, repos, issues, pull requests, Actions, security alerts and more. VS Code, Copilot and claude.ai sign in with GitHub. Most other clients, including Claude Code and Cursor, need a personal access token. In Claude Code:

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

Use a fine-grained token limited to the repos the agent needs, and add readonly to the address (…/mcp/readonly) if it should only read. Add GitHub through Upsy to sign in without a token in any client, with a different level per agent.

GitHub's MCP server

Address https://api.githubcopilot.com/mcp/ (Streamable HTTP)
Sign-in GitHub sign-in in VS Code, Visual Studio, JetBrains, Xcode, Eclipse, Copilot CLI and claude.ai. A personal access token elsewhere
Reach Whatever your token or sign-in can reach, public and private
Plans Every GitHub plan, free. Some tools need Copilot, GitHub Advanced Security or Secret Protection
Limits GitHub's API limits: 5,000 requests an hour per user, and 80 content-creating requests a minute
Enterprise Enterprise Cloud with data residency: https://copilot-api.SUBDOMAIN.ghe.com/mcp. Enterprise Server: local server only

GitHub's README and remote server docs have the details. The remote server has been generally available since September 2025.

Addresses and headers

Address What you get
…/mcp/ The default toolsets
…/mcp/readonly Read tools only
…/mcp/x/all Every toolset
…/mcp/x/issues One toolset (any name from the list below), also with /readonly

Clients that send headers can choose more precisely: X-MCP-Toolsets (comma-separated toolsets), X-MCP-Tools (single tools), X-MCP-Exclude-Tools, X-MCP-Readonly: true and X-MCP-Lockdown: true. Excluded tools always win, and read-only drops write tools even when you name them.

Toolsets

On by default: context, repos, issues, pull_requests, users and copilot.

Off by default: actions, code_quality, code_security, copilot_automations, copilot_issue_intents, dependabot, discussions, gists, git, governance, labels, notifications, orgs, projects, secret_protection, security_advisories and stargazers. The remote server also has copilot_spaces and github_support_docs_search.

Turn more on with default,actions in X-MCP-Toolsets, or all. GitHub removed the old dynamic toolsets option in May 2026.

Connect it to your client

VS Code. Install it from the README with one click, or add {"servers":{"github":{"type":"http","url":"https://api.githubcopilot.com/mcp/"}}} and sign in with GitHub. Copilot Chat also has it built in.

Claude Code. Run the command above. Anthropic's GitHub plugin, github@claude-plugins-official, adds the same server and reads the token from GITHUB_PERSONAL_ACCESS_TOKEN. A GitHub connector you add on claude.ai also shows up in Claude Code when you're signed in with your Claude account.

Claude. Open Customize › Connectors, add a custom connector with https://api.githubcopilot.com/mcp/, and sign in with GitHub. Claude signs in through a client Anthropic registered with GitHub. The /readonly and /x/… addresses need a GitHub App you register yourself (Anthropic's steps). See how to connect GitHub to Claude.

Cursor. Add {"mcpServers":{"github":{"url":"https://api.githubcopilot.com/mcp/","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}}} to ~/.cursor/mcp.json.

Codex. Run codex mcp add github --url https://api.githubcopilot.com/mcp/ --bearer-token-env-var GITHUB_PAT_TOKEN and set GITHUB_PAT_TOKEN to your token.

Windsurf. Add the server under serverUrl with an Authorization: Bearer header in mcp_config.json.

Gemini CLI. Run gemini extensions install https://github.com/github/github-mcp-server with GITHUB_MCP_PAT set.

Copilot CLI. Built in, read-only by default. Add toolsets with --add-github-mcp-toolset.

ChatGPT. Adding it as a custom MCP server fails with "Error fetching OAuth configuration.", because GitHub's sign-in doesn't let clients register themselves. See ChatGPT and GitHub.

Tokens

  • Prefer fine-grained tokens, limited to chosen repos and permissions. Organizations approve them by default, unless an owner created them.
  • Classic tokens need at least repo, read:org and read:packages. The server hides tools a classic token's scopes can't use.
  • Single sign-on: authorize the token for each organization that uses SAML, under Configure SSO next to the token.
  • Enterprise Managed Users have personal access tokens turned off by default.
  • Keep tokens out of shared config files. Use an environment variable, as in the Codex and Gemini examples.

Its tools

GitHub's README lists 95 tools in 22 toolsets: 57 read and 38 write. The default toolsets:

Toolset Read Change
repos get_file_contents, search_code, search_repositories, search_commits, get_commit, list_commits, list_branches, list_tags, get_tag, list_releases, get_latest_release, get_release_by_tag, list_repository_collaborators create_or_update_file, push_files, delete_file, create_branch, create_repository, fork_repository, delete_repository
issues issue_read, list_issues, search_issues, get_label, list_issue_types, list_issue_fields issue_write, add_issue_comment, update_issue_comment, sub_issue_write
pull_requests pull_request_read, list_pull_requests, search_pull_requests create_pull_request, update_pull_request, update_pull_request_branch, merge_pull_request, pull_request_review_write, add_comment_to_pending_review, add_reply_to_pull_request_comment
context get_me, get_teams, get_team_members, ui_get
users search_users
copilot assign_copilot_to_issue, request_copilot_review

Off by default, among others: actions (list, read logs, run, rerun and cancel workflows), code_security, dependabot and secret_protection (read and update alerts), discussions, gists, labels, notifications and projects.

  • What can do damage: merge_pull_request, push_files, delete_file and delete_repository. GitHub asks you to type the repo's name before delete_repository runs, in clients that support it.
  • Old names still work. GitHub renames tools often, like list_workflows to actions_list, and keeps the old names as aliases.
  • Big files: get_file_contents returns a link instead of the content for files over 1 MB.

Read-only, lockdown and secret protection

  • Read-only (/readonly, X-MCP-Readonly, or GITHUB_READ_ONLY=1 locally) keeps only read tools.
  • Lockdown (X-MCP-Lockdown, or GITHUB_LOCKDOWN_MODE=1) hides issues, pull requests and comments in public repos from people without push access, so strangers can't plant instructions for your agent. GitHub calls it a best-effort filter, not a security boundary.
  • Push protection blocks secrets in what the server writes, such as an issue body, on public repos and on private repos with GitHub Advanced Security.

Where GitHub's server stops

  • A token in most clients. Outside VS Code, Copilot and claude.ai, you paste a long-lived token into a config file.
  • No self-registration. Clients that expect to register themselves, like ChatGPT and OpenCode, can't sign in.
  • One choice of tools per connection. Every agent on that token or sign-in gets the same toolsets and level.
  • Enterprise Server isn't supported by the remote server.

For VS Code, Copilot or a single agent with a fine-grained token, GitHub's server is all you need.

Running it locally

GitHub publishes a Docker image and binaries for macOS, Linux and Windows:

docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
  • Settings go in environment variables: GITHUB_TOOLSETS, GITHUB_TOOLS, GITHUB_READ_ONLY, GITHUB_LOCKDOWN_MODE and GITHUB_HOST.
  • Enterprise Server: set GITHUB_HOST=https://your-host.
  • Sign-in without a token: official builds can sign in with GitHub in your browser on github.com.
  • The old npm package, @modelcontextprotocol/server-github, was archived in April 2025 and gets no fixes. Use GitHub's server instead.

GitHub MCP servers compared

GitHub's remote server GitHub's local server Upsy mcp-server-git
Who runs it GitHub You Upsy, on top of GitHub's remote server You
Sign-in GitHub sign-in in some clients, a token elsewhere A token, or GitHub sign-in Sign in to Upsy; Upsy signs in to GitHub None: it works on local folders
Reaches GitHub GitHub or Enterprise Server GitHub Git repos on your disk
Limits Toolsets, read-only, lockdown The same Read-only or picked tools, per agent None

Other servers

  • mcp-server-git is the reference server for local repos: status, diff, log, commit, branch and checkout, with no GitHub account.
  • GitMCP gives agents a project's docs and code from any public GitHub repo, free and remote.
  • GitLab runs its own MCP server at https://gitlab.com/api/v4/mcp, with OAuth that clients can register with.

Upsy's GitHub MCP server

Upsy connects to GitHub's remote server with its own GitHub sign-in, so there's no token to create or paste. It's the same address as Upsy's other apps, https://upsy.ai/connect.

What it adds:

  • Sign in once, in any client. Claude Code, Cursor, Codex, ChatGPT, Claude, Grok and Muse all reach GitHub through Upsy without a token.
  • A level per agent. Read-only for one agent and full access for another, enforced by Upsy, with no GitHub App to register.
  • No merges or pushes. With Pick actions, leave out merge_pull_request, push_files and delete_file, and keep the rest.
  • GitHub next to your other apps. One server holds GitHub, Linear, Slack, Gmail and more, so an agent can turn a Slack thread into an issue or post a release summary.
  • Up to five GitHub accounts, each with its own level.
  • History and alerts: every GitHub tool an agent runs, listed under that agent.

Upsy uses GitHub's default toolsets. Its sign-in leaves out GitHub's delete_repo and workflow permissions, so agents can't delete repos or change files in .github/workflows, even at full access. Organizations that restrict OAuth apps must approve Upsy before it reaches their private repos.

Connect GitHub to Upsy

  1. Go to upsy.ai and click Set up Upsy.
  2. Open Apps, click Connect an app and pick GitHub. Check it's the right GitHub account and approve. For another account, click Add account next to GitHub.
  3. On the Assistants page, click Add assistant and choose your client under Which assistant? for its exact steps.

Add the server to your client

Signing in opens an Upsy page: tick GitHub, keep full access or pick Read-only, and click Allow. To leave out merges and pushes, use Pick actions on the agent's page afterwards.

  • Claude Code: claude mcp add --transport http --scope user upsy https://upsy.ai/connect, then /mcp to sign in.
  • Cursor: add {"mcpServers":{"upsy":{"url":"https://upsy.ai/connect"}}} to ~/.cursor/mcp.json, then click Connect next to upsy.
  • Codex: codex mcp add upsy --url https://upsy.ai/connect, then codex mcp login upsy.
  • Claude and ChatGPT: add https://upsy.ai/connect as a custom connector (Claude, ChatGPT).
  • Grok and Muse: paste the setup prompt Upsy shows into a chat and approve the sign-in.

Server details, such as OAuth endpoints and token lifetimes, are in the Gmail MCP server guide; they're the same for GitHub.

Check that it works

Using Upsy, list the open pull requests in my-org/my-repo and tell me which have failing checks.

The agent should list the pull requests and read each one's checks. The calls show in Upsy's History under that agent.

Prompts to try

  • "Find where we verify webhook signatures in my-org/api and explain how it works."
  • "Which of my open pull requests have failing checks, and why?"
  • "Summarize the review comments on pull request 412 and list what's still open."
  • "Open an issue in my-org/api for the bug we just found, with steps to reproduce."
  • "Read this Slack thread and open a GitHub issue with its decisions and owners."

Troubleshooting

missing required Authorization header

The client sent no token and didn't sign in. Add an Authorization: Bearer header with your token, or finish the sign-in.

401 Bad credentials

The token expired, was revoked or was pasted wrong. Create a new one, and check the header reads Bearer followed by the token.

Resource protected by organization SAML enforcement

The organization uses single sign-on and your token isn't authorized for it. Click Configure SSO next to the token on GitHub and authorize it. With GitHub sign-in, sign out and in again.

Resource not accessible by personal access token

A fine-grained token is missing a permission, or the organization hasn't approved it yet. Add the permission, or ask an owner to approve it.

"does not support dynamic client registration" or "Error fetching OAuth configuration."

Your client expects to register itself with GitHub, which GitHub doesn't allow. Use a token, a client that GitHub's sign-in supports, or Upsy.

"Cannot have more than 128 tools per request"

VS Code's limit. Turn on fewer toolsets, or untick tools in the tool picker.

An organization's private repos are missing

The organization restricts OAuth apps and hasn't approved the client, or needs single sign-on. Request access under Settings › Applications › Authorized OAuth Apps, and an owner approves it. VS Code and Visual Studio are exempt.

"GitHub API rate limit exceeded"

The agent used up the token's 5,000 requests an hour, or made too many changes too fast. Wait for the reset time in the message.

"The user hasn't allowed you to use GitHub's …"

That's Upsy refusing a tool outside the agent's level, such as merge_pull_request on Read-only. Change GitHub's level on the agent's page in Upsy.

Security and privacy

  • A token or sign-in acts as you, in every repo it reaches. Limit fine-grained tokens to the repos an agent needs, and set an expiry.
  • Prompt injection. An issue, comment or file in a public repo can carry instructions aimed at your agent. Turn on lockdown, or keep agents that read public repos read-only.
  • Check before merges and pushes. Keep your client's approval prompt on for write tools.
  • Secrets: push protection blocks secrets in what the server writes on public repos and repos with GitHub Advanced Security.
  • Through Upsy, agents never get a GitHub token: they call Upsy, and Upsy calls GitHub. Tokens last 8 hours and renew on their own. Upsy emails you when one agent reads 100 or more items or deletes 50 or more in 10 minutes, and when a new agent or app connects.

FAQ

Is there an official GitHub MCP server?

Yes. GitHub runs it at https://api.githubcopilot.com/mcp/ and publishes a local version as github/github-mcp-server.

What is the GitHub MCP server URL?

https://api.githubcopilot.com/mcp/. Add readonly or x/<toolset> for narrower versions. On Enterprise Cloud with data residency, it's https://copilot-api.SUBDOMAIN.ghe.com/mcp.

Is the GitHub MCP server free?

Yes, on every GitHub plan. It doesn't need Copilot, though Copilot's own tools need a Copilot plan and security tools need GitHub's security products.

Does the GitHub MCP server support OAuth?

Yes, in clients GitHub's sign-in already knows: VS Code, Visual Studio, JetBrains, Xcode, Eclipse, Copilot CLI and claude.ai. Others need a token or their own registered GitHub app.

How do I make the GitHub MCP server read-only?

Use https://api.githubcopilot.com/mcp/readonly, send X-MCP-Readonly: true, or set GITHUB_READ_ONLY=1 locally. Through Upsy, set GitHub to Read-only for the agent.

Can the GitHub MCP server delete a repository?

Yes, with delete_repository, if the token has the delete_repo scope. GitHub asks you to type the repo's name first, in clients that support it.

Is @modelcontextprotocol/server-github still maintained?

No. It was archived in April 2025. GitHub's own server replaces it.

Does it work with GitHub Enterprise Server?

Only the local server, with GITHUB_HOST set to your server's address.

Related guides