---
title: How to connect GitHub MCP to Cursor
description: Add https://api.githubcopilot.com/mcp/ to .cursor/mcp.json with a token in the Authorization header. Read-only mode, toolsets, team setup and fixes.
canonical: https://mcp1.com/blog/github-mcp-cursor
last-updated: 2026-11-27
---

# How to connect GitHub MCP to Cursor

Add https://api.githubcopilot.com/mcp/ to .cursor/mcp.json with a token in the Authorization header. Read-only mode, toolsets, team setup and fixes.

![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite

 .cursor/mcp.json

"github": { "url": "https://api.githubcopilot.com/mcp/" }

"Authorization": "Bearer ${env:GITHUB\_PAT}"

githubConnected

 .cursor/mcp.json

"github": { "url": "https://api.githubcopilot.com/mcp/" }

"Authorization": "Bearer ${env:GITHUB\_PAT}"

githubConnected

To connect GitHub to Cursor, create a fine-grained personal access token and add GitHub’s hosted server, `https://api.githubcopilot.com/mcp/`, to `.cursor/mcp.json` with the token in an `Authorization` header. Cursor’s agent can then read code, issues, pull requests and Actions logs across the repositories the token reaches. Add `X-MCP-Readonly` to keep it from writing.

## How do I add the GitHub MCP server to Cursor?

GitHub hosts the server, so there is nothing to install. It works on every GitHub plan and needs Cursor 0.48 or later for remote servers.

1. 1Create a fine-grained token at `github.com/settings/personal-access-tokens`. Choose the repositories it may reach and grant read access to Contents, Issues, Pull requests and Metadata, plus Actions for build logs. Grant write only where you want the agent to write.
2. 2Export it as `GITHUB_PAT` in the environment Cursor starts from, then create `.cursor/mcp.json` in the project root (or `~/.cursor/mcp.json` for every project):  
.cursor/mcp.json  
```  
{  
  "mcpServers": {  
    "github": {  
      "url": "https://api.githubcopilot.com/mcp/",  
      "headers": {  
        "Authorization": "Bearer ${env:GITHUB_PAT}"  
      }  
    }  
  }  
}  
```
3. 3Restart Cursor fully, open Settings, Tools & Integrations, and check that github shows a green dot with its tools listed.

Then ask for something that changes nothing:

Prompt

```
Use the GitHub tools to list open pull requests in this repository
that are waiting on my review, with their failing checks. Don't change anything.
```

Why a token and not OAuth

Cursor supports OAuth for MCP servers, but GitHub’s hosted server only accepts OAuth from clients that register their own GitHub app. GitHub’s Cursor guide says the remote server currently needs a token in Cursor. If you want a browser sign-in, run the server locally (below).

## Which GitHub tools does Cursor get?

The base URL loads five toolsets: `context`, `repos`, `issues`, `pull_requests` and `users`. The ones you’ll use most:

ToolWhat it does

`get_file_contents`

Reads a file or directory in any repository the token reaches. Read.

`search_code`

Searches code with qualifiers like repo: and org:. Read.

`issue_read`

Fetches an issue and its comments. Read.

`pull_request_read`

Fetches a pull request’s diff, files, reviews or checks. Read.

`get_job_logs`

Returns logs for a failed Actions job, in the actions toolset. Read.

`issue_write`

Creates or updates an issue. Write.

`create_pull_request`

Opens a pull request from a branch. Write.

`merge_pull_request`

Merges a pull request. Write.

Cursor already sees your checkout, so the server is worth it for what isn’t local: other repositories, review threads, issues and CI logs.

## How do I make GitHub MCP read-only in Cursor?

Point the `url` at `https://api.githubcopilot.com/mcp/readonly`, or send headers. `X-MCP-Readonly` drops every write tool, and `X-MCP-Toolsets` picks which toolsets load:

.cursor/mcp.json

```
{
  "mcpServers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${env:GITHUB_PAT}",
        "X-MCP-Toolsets": "repos,issues,pull_requests,actions",
        "X-MCP-Readonly": "true"
      }
    }
  }
}
```

`X-MCP-Tools` loads single tools instead, and a misspelled name there stops the server from starting. These settings live in a file anyone can edit; a token with read permissions only is the limit GitHub enforces. More in [how to make an MCP server read-only](https://mcp1.com/blog/read-only-mcp-server).

## Does Cursor have a limit on GitHub tools?

Older Cursor versions sent at most 40 MCP tools to the model, and GitHub alone could fill that. Current versions load tool descriptions on demand, so the hard cap is no longer the problem, but a short list still helps the model pick the right tool. Load only the toolsets you use, and switch off single tools by clicking them in the server’s entry in settings. [Too many MCP tools](https://mcp1.com/blog/too-many-mcp-tools) covers this for other clients.

## Does Cursor ask before running GitHub tools?

Yes, by default. Cursor asks before each MCP tool call and shows its arguments, so you can read the branch and title before a pull request is opened. On team plans, admins can set an MCP allowlist in the dashboard and a per-server tool allowlist that decides which tools may run without asking. Put the read tools there and keep `merge_pull_request` and other writes on manual approval. See [stopping destructive MCP tools](https://mcp1.com/blog/stop-destructive-mcp-tools).

## How do I share GitHub MCP with my team in Cursor?

Commit `.cursor/mcp.json`. Cursor fills `${env:GITHUB_PAT}` from each person’s environment, so the file holds no secret and every teammate calls GitHub with their own token and permissions. Each person needs `GITHUB_PAT` set before Cursor starts; a variable exported in a terminal opened later isn’t seen by an app launched from the dock. The pattern is the same for other servers, in [sharing an MCP server without sharing the key](https://mcp1.com/blog/share-mcp-server-without-api-key).

## Can I sign in to GitHub with OAuth in Cursor?

Yes, with the local server. GitHub’s Docker image runs on your machine, opens a browser sign-in on first use and keeps the token in memory only. It needs Docker running:

.cursor/mcp.json

```
{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-p", "127.0.0.1:8085:8085",
        "-e", "GITHUB_OAUTH_CALLBACK_PORT",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": { "GITHUB_OAUTH_CALLBACK_PORT": "8085" }
    }
  }
}
```

If a token is also set, the token wins. The local server is also the way to reach GitHub Enterprise Server, which the hosted one doesn’t, and it takes `GITHUB_TOOLSETS` and `GITHUB_READ_ONLY` in place of the headers. GitHub’s install guide has one-click Install buttons for both the remote and Docker setups.

## What if GitHub MCP doesn’t connect in Cursor?

Open the Output panel (`Cmd+Shift+U` on macOS), choose MCP Logs and match the error:

SymptomFix

The server doesn’t appear

Check that mcp.json is valid JSON and in the right folder, then quit and reopen Cursor. A reload isn’t always enough.

401 Unauthorized

The token expired, or GITHUB\_PAT was empty when Cursor started. Set it, then restart Cursor.

Organization repositories come back empty

The organization must approve fine-grained tokens, or the token needs SSO authorization. Check the token’s page in GitHub settings.

A tool you expect is missing

Its toolset isn’t loaded, or read-only mode removed it. Add the toolset to X-MCP-Toolsets.

The server fails to start after editing headers

A name in X-MCP-Tools is misspelled. Fix or remove it.

Old guides use the npm package `@modelcontextprotocol/server-github`. It was deprecated in April 2025; use the hosted URL or the Docker image.

## GitHub for the whole team, without a token on every laptop

The setup above puts a GitHub token on every laptop and leaves read-only mode in a file anyone can change. MCP1 is a gateway that does it once. An admin installs [GitHub](https://mcp1.com/servers/github) in the workspace with a fine-grained token, and can add a second, read-only token that people on read-only access call with, so GitHub itself refuses their writes. In Cursor, people install the gateway from the Connect page in the dashboard, or add its URL and sign in with OAuth:

.cursor/mcp.json

```
{
  "mcpServers": {
    "mcp1": {
      "url": "https://mcp1.com/mcp/<workspace>/<gateway>"
    }
  }
}
```

GitHub’s tools appear as `github__<tool>` next to Linear, Sentry and the rest, rules like `github__merge_*` hold risky tools to admins, and every call goes in the audit log with the person who made it. The Claude Code version of this guide is [here](https://mcp1.com/blog/github-mcp-claude-code), the [docs](https://mcp1.com/docs) cover gateways and groups, and you can [start free](https://mcp1.com/signup).

## Common questions

### Do I need GitHub Copilot to use GitHub MCP in Cursor?

No. GitHub’s MCP server is available on every GitHub plan, even though it is hosted at api.githubcopilot.com. Only tools for paid features need a Copilot license.

### Can Cursor sign in to GitHub’s hosted MCP server with OAuth?

Not today. GitHub’s Cursor guide says the remote server needs a personal access token in Cursor. For a browser sign-in, run GitHub’s Docker image locally.

### Should I put the token straight into mcp.json?

Only in a global file nobody else reads. In a project file, use ${env:GITHUB\_PAT} so the token stays in your environment and the file is safe to commit.

### Does GitHub MCP work with GitHub Enterprise Server in Cursor?

The hosted server doesn’t reach Enterprise Server. Run the github-mcp-server Docker image locally and point it at your instance.

Give your team one URL

Create a workspace, install your servers and share a gateway with a group. Free for individuals.

[Start with MCP1](https://mcp1.com/signup)[Read the docs](https://mcp1.com/docs)

## More from the blog

[ ProductLinearRead onlyProductboardRead onlyFigmaRead onlyPostHogRead onlyMCP servers for product teams: what to connect firstConnect Linear, a feedback tool (Productboard, Dovetail), analytics (PostHog, Amplitude) and Figma, read-only. Their tools, setup and which writes to hold back.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/mcp-servers-for-product-teams)[ Terminal$ gemini mcp add --transport http github https://api.githubcopilot.com/mcp/\-H 'Authorization: Bearer $GITHUB\_MCP\_PAT'githubConnectedHow to connect GitHub MCP to Gemini CLIInstall GitHub’s Gemini CLI extension or add https://api.githubcopilot.com/mcp/ with a token header. Read-only mode, policy rules, headless runs and fixes.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/github-mcp-gemini-cli)

---

This is the markdown copy of https://mcp1.com/blog/github-mcp-cursor. Site index for agents: https://mcp1.com/llms.txt
