← All connection guides

How to connect Cursor to GitHub

Connect Cursor to GitHub with the read-only MCP server, then check one pull request from a repository you choose.

Free guide · Updated

Based on official documentation · Checked

Ask your agent

Copy the prompt and paste it into your assistant.

Quick answer

Add the hosted GitHub MCP server to Cursor with the read-only URL and a GitHub personal access token. Start with one repository and have Cursor look up a known pull request. This gives the agent GitHub context such as PR state and discussion alongside the files it already sees locally.

Create a token for one repository

In GitHub, create a fine-grained personal access token and choose the owner and repository you want to use. Set an expiration and grant read access for pull requests. Add read access to Contents only if the task also needs it. An organization may require approval before the token can read its private repositories.

Make the token available to the Cursor process as IFLOW_GITHUB_MCP_PAT through your local environment or secret manager. Cursor needs to inherit it when it starts. Keep the token out of project files, terminal history, screenshots and chat.

Add GitHub to Cursor

Open Cursor’s global MCP configuration at ~/.cursor/mcp.json. Add the github entry under the existing mcpServers object. If you already have other servers, keep their entries. The URL below uses GitHub’s hosted read-only variant.

{
  "mcpServers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/readonly",
      "headers": {
        "Authorization": "Bearer ${env:IFLOW_GITHUB_MCP_PAT}"
      }
    }
  }
}

Confirm that the GitHub tools are available

Restart Cursor after making the variable available. In Tools & Integrations, check that the GitHub MCP server is enabled and lists tools. If an existing GitHub server is active, choose the read-only connection for the test so you know which server supplied the result.

Practice

Read a pull request

  1. Pick an existing pull request in the one repository selected for the token.
  2. Ask: “Use the GitHub MCP server to read pull request #42 in OWNER/REPO. Return the title, current state and URL.” Replace the repository and PR number with your own values.
  3. Open the returned PR URL and compare the title and state with GitHub.

Output: A title, state and URL that match the pull request in GitHub.

Fix missing tools or private repository access

If GitHub tools do not appear, check that Cursor can read the JSON config and inherited IFLOW_GITHUB_MCP_PAT at launch. If tools appear but the lookup fails, recheck the repository owner, token expiry, Pull requests permission and any outstanding organization approval.

To disconnect, remove or disable the server in Cursor and revoke the dedicated token in GitHub when you no longer need it.

Sources

Read the primary material