GitHub MCP server in Cursor from mcp.json to merged PR.
Cursor's agent gets full GitHub reach — issues, pull requests, Actions — through one entry in mcp.json pointed at GitHub's hosted MCP endpoint.
Cursor's agent can edit code all day, but out of the box it can't open the pull request for you. The official GitHub MCP Server (30.6k stars on github/github-mcp-server) closes that loop, exposing repos, issues, PRs, and workflow runs as tools Cursor can call mid-task.
GitHub runs the server as a hosted endpoint, so setup in Cursor is a URL, a token, and a toggle. Here's each step, plus the failure modes worth knowing in advance.
Global or per-project config
Cursor reads MCP servers from two places: ~/.cursor/mcp.json applies everywhere, while .cursor/mcp.json inside a repo applies only to that project. GitHub access is usually something you want in every workspace, so the global file is the natural home — reserve the project file for servers tied to one codebase.
You can edit either file directly, or go through Cursor Settings > MCP, which writes the same JSON for you.
The config
Add a github entry under mcpServers with the hosted endpoint and a personal access token in the Authorization header:
{
"mcpServers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ghp_YOUR_GITHUB_PAT"
}
}
}
}Flip the toggle
Saving the file isn't the last step in Cursor: open Cursor Settings > MCP and make sure the github server's toggle is enabled. Cursor lists each configured server with a status dot and a tool count — a green dot with a few dozen tools means the handshake and auth both succeeded.
Generate the PAT at github.com/settings/tokens as a fine-grained token. Cursor's agent will act with exactly the permissions you grant, so scope it to the repos and permission types (contents, issues, pull requests) you actually want automated.
Test it like the agent will use it
In agent mode, try a prompt that forces a tool call rather than a guess: "using the github tools, list my open pull requests across all repos." Cursor should show the tool invocation inline and return live data. If it answers from memory instead, mention the server name explicitly or check that agent mode (not plain chat) is active.
The server's complete tool list — useful for knowing what you can ask for — is on its live Loomal listing at https://loomal.ai/marketplace/github.
Troubleshooting in Cursor
Yellow or red status dot: hover it for the error. A 401 means the token is invalid or the Bearer prefix is missing; a fetch failure usually means a typo in the URL (note the trailing slash on /mcp/).
Server absent from the MCP settings list: the JSON didn't parse. Cursor fails silently on malformed mcp.json, so validate the file — a trailing comma after the headers block is the classic mistake. After any fix, restart Cursor fully rather than relying on the settings page to re-read the file.
Tools load but the agent never uses them: too many enabled servers can crowd the tool budget. Disable servers you're not using so the GitHub tools stay in the agent's working set.
FAQ
How do I set up the GitHub MCP server in Cursor?
Add a github entry with url https://api.githubcopilot.com/mcp/ and a Bearer-token Authorization header to ~/.cursor/mcp.json (or via Cursor Settings > MCP), then enable the server's toggle. The tool count next to the server confirms it's connected.
Where is Cursor's MCP config file?
Global config lives at ~/.cursor/mcp.json and applies to every workspace; project config lives at .cursor/mcp.json in the repo root and applies only there. Both use the same mcpServers JSON shape, and project entries are merged with global ones.
What token scopes does the GitHub server need?
Whatever you want the agent to do, and nothing more. A fine-grained PAT with read access to contents covers browsing; add write on pull requests and issues for PR and triage workflows. Cursor never sees credentials beyond the header you configure.
I edited mcp.json but the server never appeared — why?
Almost certainly invalid JSON; Cursor skips files it can't parse without a visible error. Run the file through a JSON validator, fix the syntax, then restart Cursor. If it appears but shows an error dot, the problem is the token or the URL, not the file.
More MCP servers for Cursor.
Compare live tool lists across hundreds of servers on Loomal.