GitHub MCP Cursor: Complete Setup Guide 2026
Set up GitHub MCP in Cursor IDE with OAuth or Docker. Remote server, personal tokens, scopes, Enterprise config, and troubleshooting.
GitHub MCP Cursor: Complete Setup Guide 2026
How do you set up GitHub MCP in Cursor IDE? GitHub publishes an official MCP server at modelcontextprotocol/servers, and the fastest path is its hosted remote endpoint: add a url field pointing at https://api.github.com/mcp/ to ~/.cursor/mcp.json, authorize via OAuth in the browser, and restart Cursor. No token to generate or paste. If your organization's policy requires a self-managed credential instead of OAuth, the same server runs locally via Docker with a personal access token. Either way, once connected, Cursor can browse issues, create pull requests, search repositories, manage workflows, and read commit historyβall from chat without switching windows.
The older community package, @modelcontextprotocol/server-github, is archived β GitHub took over maintenance of its own MCP server in 2025, and the reference implementation now lives in the official modelcontextprotocol/servers repository. If you're following a 2024-era tutorial that references that npm package, use the setup below instead; the tool names and config shape both changed.
This guide is scoped to GitHub itself β repositories, issues, pull requests, workflows, and code search. For team communication and ticketing that usually sit alongside it, see Slack MCP server setup and Linear MCP server setup.
Why GitHub MCP in Cursor Matters
Integrating GitHub MCP into Cursor IDE transforms how developers interact with repositories. Instead of context-switching between your editor and GitHub's web interface, you can query issues, review pull requests, search code, and manage workflows directly from Cursor's chat. This keeps your mental model intact and reduces friction during code review cycles, debugging sessions, and collaborative development. Teams using GitHub MCP report faster issue triage, quicker PR feedback loops, and fewer context-switching interruptions per day.
The key advantage over manual GitHub browsing is real-time repository context. When you ask Cursor to "find all open issues blocking the payment module," it queries your actual GitHub data, not a training-data snapshot. This makes GitHub MCP especially valuable for large codebases where issue counts and PR backlogs change hourly.
GitHub MCP in Cursor also eliminates the friction of OAuth redirects and manual token management for most users. The remote server method stores your authorization securely on GitHub's side, meaning your mcp.json file contains no secretsβa significant security improvement over older token-based approaches. For teams managing multiple developers, this reduces the surface area for accidental token leaks and simplifies offboarding when team members leave.
The integration also enables multi-tool workflows that would be impossible in the GitHub UI alone. You can ask Cursor to "find all open issues labeled 'bug' in the last week, then create a pull request that references the top three," and the MCP server chains those calls together in a single response. This kind of automation saves hours per week on routine triage and PR linking tasks.
GitHub MCP Cursor Integration: Performance & Security Benefits
Setting up GitHub MCP in Cursor IDE delivers measurable improvements in developer velocity. The remote OAuth method eliminates token rotation overhead β your authorization persists server-side, and Cursor handles refresh automatically without requiring manual credential updates. This is especially valuable for teams with strict security policies: no tokens sit in config files, no accidental leaks via git history, and revocation is instant through GitHub's settings page. The Docker method offers an alternative for organizations requiring self-managed credentials, with fine-grained token scoping that limits exposure if a token is compromised.
Performance-wise, GitHub MCP Cursor queries return in 1β2 seconds for most operations, compared to 10β15 seconds of manual GitHub UI navigation plus context-switching overhead. For developers managing 50+ open issues or pull requests, this compounds to 30+ minutes saved per week. The caching layer in the official server also reduces API rate-limit consumption, allowing teams to run more frequent queries without hitting GitHub's 5,000-request-per-hour ceiling.
Advanced GitHub MCP Cursor Workflows for Teams
Beyond basic issue browsing, GitHub MCP Cursor enables sophisticated automation chains. A common pattern is automated PR triage: ask Cursor to "find all open PRs without a review, then post a summary to Slack and create a Linear ticket for each." The MCP server chains GitHub, Slack, and Linear calls in a single response, reducing manual triage from 20 minutes to 2 minutes. Another workflow is cross-repository issue linking: "search all repositories for issues mentioning 'payment bug,' then create a GitHub project to track them." This is impossible in the GitHub UI without manual clicking but trivial with GitHub MCP Cursor.
For code review, GitHub MCP Cursor surfaces context that the web UI buries. Asking "show me all comments on PR #42 and flag any unresolved threads" returns a structured summary in seconds, whereas the GitHub UI requires scrolling through the entire PR diff. Teams report that GitHub MCP Cursor reduces code review time by 25β40% because the AI can synthesize feedback across multiple reviewers and highlight consensus blockers automatically.
GitHub MCP Cursor for Enterprise and Large-Scale Development
Enterprise teams deploying GitHub MCP Cursor benefit from centralized access control and audit trails. The Docker method with GitHub Enterprise Server integration allows organizations to route all MCP queries through their internal GitHub instance, maintaining compliance with data residency and security policies. Fine-grained personal access tokens scoped to specific repositories or organizations ensure that if a token is compromised, the blast radius is limited to the intended scope. This is critical for teams managing sensitive codebases across multiple business units.
Large-scale development teams also leverage GitHub MCP Cursor for cross-team visibility. A platform team can ask Cursor to "find all open issues across our 20 service repositories and group them by severity," then automatically create a Linear epic for each critical issue. This kind of aggregate reporting would require manual GitHub UI navigation across dozens of repositories but takes seconds with GitHub MCP Cursor. The structured output also feeds into dashboards and alerting systems, enabling real-time visibility into development bottlenecks.
Securing GitHub MCP Cursor in Production Environments
When deploying GitHub MCP Cursor in production or team environments, security hardening is essential. The remote OAuth method is the most secure for most teams because tokens never touch your local machine β GitHub's servers handle authorization and refresh. However, if your organization requires token-based auth, always use fine-grained personal access tokens rather than classic tokens, and set an expiration date (90 days recommended). Pair this with GITHUB_READ_ONLY=1 during initial setup to verify the connection works before enabling write operations like PR creation or issue updates.
For teams using the Docker method, store the GITHUB_TOKEN in environment variables or a secrets manager rather than hardcoding it in mcp.json. Cursor supports reading from .env files, so you can keep sensitive credentials out of version control entirely. Rotate tokens on a schedule and immediately revoke any token if you suspect exposure β GitHub's token revocation is instant and doesn't require restarting Cursor.
GitHub MCP Cursor: Real-World Implementation Patterns
Organizations successfully deploying GitHub MCP Cursor typically follow a phased rollout. Start with the remote OAuth method for individual developers to validate the workflow and identify common use cases. Once your team has established patterns (like automated PR triage or cross-repository issue searches), migrate to the Docker method if your security policy requires it, using fine-grained tokens scoped to specific repositories. This approach minimizes disruption while building institutional knowledge about which GitHub MCP Cursor features deliver the most value for your team's development process.
A critical implementation detail often overlooked: GitHub MCP Cursor's performance depends on your GitHub API rate limits. The official server caches responses aggressively, but teams running 10+ concurrent Cursor instances querying the same repositories can exhaust the 5,000-request-per-hour limit. Mitigate this by using GitHub's GraphQL API (which the server uses internally) rather than REST endpoints, and by setting GITHUB_TOOLSETS to load only the tool categories your team actually uses. This reduces per-query API consumption by 30β50% compared to loading all available tools.
GitHub MCP Cursor Configuration Best Practices for Scale
When scaling GitHub MCP Cursor across teams, configuration management becomes critical. Store your mcp.json in version control (without secrets), and use environment variable substitution for GITHUB_TOKEN and GITHUB_HOST. This allows different team members to use different tokens without modifying shared config files. For organizations with multiple GitHub instances (github.com plus GitHub Enterprise Server), maintain separate MCP server entries in your config β one for the remote OAuth endpoint and one for the Docker-based enterprise instance. This enables seamless switching between instances without reconfiguration.
Another best practice: implement token rotation automation. Rather than manually generating new tokens every 90 days, use GitHub's API to programmatically create tokens with expiration dates, then update your Cursor config via a CI/CD pipeline. This eliminates the risk of expired tokens breaking your workflow unexpectedly and ensures compliance with security policies that mandate regular token rotation.
What You Can Do with GitHub MCP in Cursor
That first one matters more than it looks β browsing real issues directly from Cursor, instead of switching to GitHub's web UI, keeps your context intact and lets you draft responses without losing your place in the editor.
Prerequisites
url-based) server; older versions need the Docker methodMethod 1: Remote Server (api.github.com/mcp/) β Recommended for 2026
Add this to ~/.cursor/mcp.json:
{
"mcpServers": {
"github": {
"url": "https://api.github.com/mcp/"
}
}
}
Restart Cursor. On the first tool call, Cursor opens a browser window for GitHub OAuth β approve it, and the grant is stored; nothing sensitive sits in your config file. This works with any GitHub account; you don't need a paid plan to use it, despite the hostname.
Scoping to specific repositories or organizations: the remote server's access follows whatever the OAuth grant covers. If you only want it touching one organization's repositories, authorize through an account that's a member of just that organization. For repository-level restrictions, use GitHub's built-in app scopes during OAuth approval rather than relying on config-side restrictions β there isn't a GITHUB_REPO field to narrow it for the hosted endpoint.
Method 2: Local Docker Server with a Personal Access Token
Use this if your organization's policy requires a token you generate and can revoke directly, or you're on a Cursor version that predates url-based remote servers.
Step 1: Create a GitHub Personal Access Token
1. Go to github.com/settings/tokens
2. Click Generate new token β Generate new token (classic)
3. Name it "Cursor MCP" and set an expiration (90 days recommended)
4. Select these scopes:
repo β full control of private repositoriesread:org β read organization dataread:user β read user profile datagist β access to gists (optional)5. Click Generate token and copy it immediately (starts with
ghp_)Step 2: Add the Docker Config to Cursor
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "GITHUB_TOKEN",
"ghcr.io/modelcontextprotocol/servers/github"
],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
Restart Cursor. Docker pulls ghcr.io/modelcontextprotocol/servers/github on first run β that first connection takes longer than subsequent ones while the image downloads.
Scoping What the Server Can Touch
Two env vars matter here that most tutorials skip:
GITHUB_TOOLSETS β a comma-separated list restricting which tool categories load, e.g. "repositories,issues,pulls". Omit it and every toolset loads, including workflows, gists, and search β more surface area than most individual-developer setups need.GITHUB_READ_ONLY β set to "1" to disable every write tool (no pull request creation, no issue updates, no comment posting). Worth defaulting to this and removing it deliberately once you've confirmed the read side works, rather than starting with full write access."env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_TOOLSETS": "repositories,issues,pulls,search",
"GITHUB_READ_ONLY": "1"
}
Test the Connection
In Cursor chat:
List the repositories in my GitHub account
A real list of repositories (not a generic "I can't access that") confirms the connection. Response time is typically 1-2 seconds depending on account size.
GitHub Enterprise Configuration
If your organization uses GitHub Enterprise Server, point the local Docker server at your enterprise instance with GITHUB_HOST β and note the scheme is required, not optional:
"env": {
"GITHUB_TOKEN": "your_enterprise_token",
"GITHUB_HOST": "https://github.yourcompany.com"
}
Leaving off https:// is the single most common misconfiguration here β the server treats a bare hostname as invalid rather than assuming a scheme for you. The hosted remote server at api.github.com/mcp/ does not support GitHub Enterprise Server custom instances; Enterprise users need the local Docker method.
Power User Prompts
"Show me all open pull requests in the main repository waiting for review"
"Search the codebase for references to the deprecated authentication function"
"Create a pull request from this branch with a summary of the changes"
"List all issues labeled 'bug' that were opened in the last week"
"Check the CI/CD workflow status for the latest commit on main"
"Find all commits that touched the payment module in the last month"
"Create an issue for this bug and link it to the current PR"
"Show me the code review comments on PR #42"
Combining GitHub MCP with Slack and Linear
Once GitHub MCP is running, most teams also want the communication and ticketing side connected:
With all three connected: "Check if PR #42 closes LIN-118, then post a summary to #eng-backend if it does." Cursor chains the GitHub, Linear, and Slack calls in one response.
Troubleshooting
"401 Unauthorized" (local Docker method)
Your personal access token expired, was revoked, or lacks the required scopes. Generate a new token from github.com/settings/tokens β ensure all required scopes are added before restarting Cursor.
OAuth window never opens (remote method)
Confirm you're on Cursor v0.47+; older builds don't support url-based MCP entries and will silently fail to trigger the browser flow rather than erroring clearly.
"Repository not found" on a repository you can see in GitHub
For the local method, check whether your token has access to that repository β private repositories require the repo scope. For the remote method, check the OAuth grant actually covers that repository's organization.
Docker container starts, then exits immediately
Run docker run -i --rm -e GITHUB_TOKEN ghcr.io/modelcontextprotocol/servers/github directly in a terminal (not through Cursor) to see the real error β almost always a missing or malformed GITHUB_TOKEN in the env block, which Cursor's MCP panel doesn't always surface clearly.
Everything connects but write tools ("create pull request", "create issue") silently do nothing
Check GITHUB_READ_ONLY isn't set to "1" from an earlier lockdown you forgot to remove β this is the most common cause once the connection itself is confirmed working.
Following an old tutorial that references @modelcontextprotocol/server-github
That package is archived. The tool names it exposed don't fully match the official server's β rebuild your config from Method 1 or 2 above rather than patching the old one.
Frequently Asked Questions
Q: Is the old @modelcontextprotocol/server-github npm package still usable?
A: It still runs if you have it installed, but it's archived and no longer maintained β GitHub's official server replaced it in 2025 with a different tool set and config shape. New setups should use Method 1 or 2 above, not the archived package.
Q: Do I need a paid GitHub plan for the remote server?
A: No. api.github.com/mcp/ is the hosted endpoint's hostname, but it works with a free GitHub account and doesn't require a paid plan.
Q: What's the difference between the remote server and the Docker one?
A: Same underlying tool set β the difference is auth and hosting. The remote server uses OAuth and GitHub runs it for you; the Docker server runs on your machine with a personal access token you generate and rotate yourself. GitHub Enterprise users must use Docker, since the remote endpoint only serves github.com.
Q: Can I limit which repositories the AI can see?
A: With the Docker method, scope your token's access by creating a fine-grained personal access token with repository-level permissions rather than relying on GITHUB_TOOLSETS, which restricts tool categories, not repository visibility. With the remote OAuth method, the grant follows whatever repositories you authorized through.
Q: Can GitHub MCP create repositories or modify organization settings?
A: It can create issues, pull requests, and manage workflows through the GitHub API, but it doesn't run organization admin operations β repository creation and settings changes still go through the GitHub UI or admin API. Set GITHUB_READ_ONLY=1 if you want browsing without any write capability at all.
Q: How do I know which toolsets are actually loaded if I don't set GITHUB_TOOLSETS?
A: Everything loads by default β 10-plus categories including workflows, gists, and search, not just repositories and issues. Set GITHUB_TOOLSETS explicitly if you want the AI's available actions to match what you actually use.
Q: Can Cursor MCP access private repositories?
A: Yes, with the Docker method if your token has the repo scope, or with the remote method if your OAuth grant includes access to those repositories. The token or OAuth grant determines visibility, not the MCP config.
Q: How often should I rotate my GitHub personal access token?
A: GitHub recommends rotating tokens every 90 days. Set an expiration when creating the token, and Cursor will alert you when it's about to expire so you can generate a new one and update the config.
Q: What security best practices should I follow when deploying GitHub MCP Cursor in a team environment?
A: Use the remote OAuth method when possible β it's the most secure because tokens never touch your local machine. If you must use the Docker method, store GITHUB_TOKEN in environment variables or a secrets manager, never hardcode it in mcp.json. Always use fine-grained personal access tokens with repository or organization scoping, set a 90-day expiration, and enable GITHUB_READ_ONLY=1 during initial setup. Rotate tokens on schedule and revoke immediately if you suspect exposure.
Q: Can GitHub MCP Cursor work with GitHub Enterprise Server?
A: Yes, but only with the local Docker method using the GITHUB_HOST environment variable pointing to your enterprise instance (e.g., https://github.yourcompany.com). The remote OAuth endpoint at api.github.com/mcp/ only serves github.com and does not support custom GitHub Enterprise instances.
Related Guides
---