Skip to content
Developer Tool IntegrationJune 2026 · 12 min read

GitHub MCP Server Setup Guide for Claude Desktop, Cursor & VS Code

Connect Claude Desktop, Cursor IDE, and VS Code directly to your GitHub repositories to automate PR code reviews, triage bug reports, search commit histories, and orchestrate releases through natural language.

1. Executive Overview & GitHub MCP Capabilities

Version control is the central nervous system of modern software engineering. Every feature lifecycle begins with an issue discussion, progresses through branches and commits, and culminates in a pull request review. Traditionally, integrating AI coding assistants into this lifecycle meant manually copying code diffs, pasting stack traces into chat windows, and copying generated review feedback back to GitHub.

The official GitHub Model Context Protocol Server (@modelcontextprotocol/server-github) eliminates this friction. By standardizing communication over JSON-RPC 2.0 messages, the server grants Claude Desktop, Cursor, and Cline direct access to GitHub REST and GraphQL endpoints.

With the server connected, your AI assistant can browse remote directory structures without cloning repositories locally, inspect pull request diffs hunk by hunk, create and assign issues, trigger continuous integration builds in GitHub Actions, and write verified review comments directly to active discussions.

2. Security Hardening: Scoping Personal Access Tokens

When connecting an AI agent to your source code, enforcing least-privilege security boundaries is critical. Never use an unrestricted classic Personal Access Token with global admin rights. Instead, create a Fine-Grained Personal Access Token (PAT) tailored specifically to the repositories the AI is authorized to touch.

Follow these step-by-step instructions to configure your token safely:

  1. Log into GitHub, click your profile picture in the top-right corner, and select Settings.
  2. In the left navigation sidebar, scroll to the bottom and click Developer Settings.
  3. Navigate to Personal access tokens → Fine-grained tokens and click Generate new token.
  4. Provide a descriptive token name such as Claude-Desktop-GitHub-MCP and select an appropriate expiration window (e.g. 90 days).
  5. Under Repository access, choose “Only select repositories” and select your active project repositories. Avoid selecting “All repositories” to minimize risk.
  6. Under Permissions → Repository permissions, configure the following granular access levels:
    • Pull requests: Read and Write (enables fetching diffs and posting review comments).
    • Issues: Read and Write (enables creating, updating, and triaging bug reports).
    • Contents: Read-only (enables viewing repository trees and reading files; grant Write only if you want the AI to push commits directly).
    • Workflows: Read and Write (enables inspecting CI test run logs and triggering workflow dispatches).
  7. Click Generate token and immediately copy the secret token string (starts with github_pat_...).

3. Multi-Client Installation Configurations

The GitHub MCP server runs as a local subprocess via Node.js (npx). Configure your client application by pasting the JSON block into your respective settings file:

Claude Desktop Config

claude_desktop_config.json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_your_token_here"
      }
    }
  }
}

Cursor IDE Config

.cursor/mcp.json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_your_token_here"
      }
    }
  }
}

On macOS, the Claude Desktop configuration file is located at ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows, locate it at %APPDATA%\Claude\claude_desktop_config.json. Restart the client application after saving the configuration.

4. High-Impact Automated Workflows & Prompt Recipes

With the GitHub MCP integration running, you can command your AI assistant to execute multi-step engineering tasks:

Automated Pull Request Code Review

Prompt: “Fetch pull request #84 in owner/repository. Review the modified files against our strict TypeScript standards, look for race conditions in asynchronous handlers, and draft a structured review comment summarizing potential issues.”

The MCP server fetches the git diff, parses the affected line numbers, reasons through the architecture changes, and prepares a comprehensive review that you can submit with a single click.

Triage Open Bug Reports & Diagnose Regressions

Prompt: “Search open issues with the label ‘bug’ in our repository. For each issue, check recent commit logs to determine if a recent release introduced the regression, and suggest a proposed fix.”

Claude cross-references issue descriptions against the commit log history, identifies suspicious commits, and provides an actionable triage report for your sprint planning.

Generating Comprehensive Release Notes

Prompt: “Inspect all pull requests merged into the main branch since tag v2.3.0. Categorize changes into Features, Bug Fixes, and Breaking Changes, and output a formatted Markdown changelog.”

The assistant extracts PR titles, linked issue numbers, and author credits to generate human-readable release notes ready for publication.

5. Enterprise Configurations & Troubleshooting

When deploying the GitHub MCP server across enterprise organizations, keep the following operational considerations in mind:

  • GitHub Enterprise Server (GHES): If your organization hosts GitHub Enterprise on a private cloud or on-premise VPC, define the custom API base URL in your environment configuration by adding "GITHUB_API_URL": "https://github.internal.yourcompany.com/api/v3".
  • Rate Limit Management: GitHub grants authenticated users 5,000 requests per hour. If your assistant analyzes dozens of large pull requests in rapid succession, avoid broad recursive search queries that consume dozens of API calls per prompt.
  • Handling 403 Forbidden Errors: If the server returns a 403 error, verify that Single Sign-On (SSO) authorization is enabled on your fine-grained token if your organization enforces SAML SSO.