Supercharge Your Development: Setting Up Cursor with GitHub MCP Server
GitHub's Model Context Protocol (MCP) Server is a powerful tool that allows you to interact with GitHub directly from your Cursor IDE. This integration enables you to create repositories, push files, search code, manage issues, and perform many other GitHub operations without leaving your editor. In this guide, I'll walk you through the setup process and demonstrate some of the powerful features of using Cursor with GitHub MCP Server.
What is GitHub MCP Server?
GitHub MCP Server is an official implementation of the Model Context Protocol that provides a bridge between Cursor's AI capabilities and GitHub's API. It allows the AI assistant in Cursor to perform GitHub operations on your behalf, making your development workflow more efficient. By connecting Cursor with GitHub MCP Server, you can automate many routine GitHub tasks directly from your IDE.
Prerequisites for Cursor with GitHub MCP Server
Before we begin setting up Cursor with GitHub MCP Server, make sure you have:
- Cursor IDE installed (latest version)
- A GitHub account
- Docker installed (we'll be using a Docker container)
- A GitHub Personal Access Token (PAT)
Creating a GitHub Personal Access Token for MCP Server
To use Cursor with GitHub MCP Server, you'll need a Personal Access Token with the appropriate permissions:
- Go to your GitHub account settings
- Navigate to Developer Settings > Personal Access Tokens > Classic Tokens
- Click "Generate new token" and select "Classic"
- Name your token (e.g., "Cursor MCP")
- Set an expiration date
- Important: Select the "repo" scope to give the token access to your repositories
- Generate and copy your token (you'll only see it once!)
Setting Up GitHub MCP Server in Cursor
There are two ways to set up Cursor with GitHub MCP Server:
Method 1: Global MCP Server Setup in Cursor
- Open Cursor IDE
- Go to Settings > Features > MCP
- Click the "+ Add New MCP Server" button
- Configure the server:
- Name: GitHub
- Type: Command
- Command:
docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN="your_token_here" ghcr.io/github/github-mcp-server
- Replace
your_token_here
with your actual GitHub Personal Access Token
Method 2: Project-Specific Setup for Cursor with GitHub MCP
For a project-specific setup, create a .cursor/mcp.json
file in the root of your project:
- Create a
.cursor
directory in your project root if it doesn't exist - Create an
mcp.json
file inside the.cursor
directory with the following content:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
}
}
}
}
Replace your_token_here
with your actual GitHub Personal Access Token.
Verifying Your Cursor with GitHub MCP Server Setup
After setting up Cursor with GitHub MCP Server, you should verify that it's working correctly:
- Open Cursor's Agent mode
- Ask the agent to list the available MCP tools
- You should see a list of GitHub-related tools like
create_repository
,push_files
, etc.
Using GitHub MCP Features in Cursor
Now that your Cursor with GitHub MCP Server integration is set up, let's explore some of the powerful features you can use directly from Cursor:
Creating a Repository from Cursor
You can create a new GitHub repository by simply asking the Cursor agent:
Create a new repository called "test-repo" with a description "Testing GitHub MCP"
The agent will use the create_repository
tool to create the repository for you.
Adding Files to a Repository from Cursor
Once you've created a repository, you can add files to it directly from Cursor:
Add an index.html file to test-repo with a simple greeting message
The agent will use the push_files
tool to add the file to your repository.
Searching GitHub from Cursor
You can search for repositories, code, issues, and users on GitHub without leaving Cursor:
Search for repositories related to "machine learning"
The agent will use the search_repositories
tool to find relevant repositories.
Managing Issues with Cursor and GitHub MCP
You can create, list, and update issues in your repositories directly from Cursor:
Create an issue in my test-repo titled "Add documentation" with a description "We need to add better documentation"
The agent will use the create_issue
tool to create the issue.
Working with Pull Requests in Cursor
You can create and manage pull requests from within Cursor:
Create a pull request from my feature-branch to main in test-repo with the title "New feature implementation"
The agent will use the create_pull_request
tool to create the PR.
Advanced Features of Cursor with GitHub MCP Server
The Cursor with GitHub MCP Server integration also offers more advanced features:
Code Scanning from Cursor
You can list and get details about code scanning alerts directly in Cursor:
List code scanning alerts for my repository
Secret Scanning from Cursor
You can list and get details about secret scanning alerts without leaving Cursor:
List secret scanning alerts for my repository
Repository Content Access in Cursor
You can access repository content at specific paths, branches, commits, tags, or pull requests directly from Cursor:
Show me the content of the README.md file in the main branch
Troubleshooting Cursor with GitHub MCP Server
If you encounter issues with your Cursor with GitHub MCP Server integration:
- Authentication Issues: Make sure your Personal Access Token has the correct permissions and hasn't expired
- Docker Issues: Ensure Docker is running and you have the necessary permissions
- Connection Issues: Check your internet connection and GitHub's status page
- Token Visibility: Never share your Personal Access Token; if you suspect it's been compromised, revoke it and create a new one
Conclusion: The Power of Cursor with GitHub MCP Server
The Cursor with GitHub MCP Server integration provides a seamless way to interact with GitHub without leaving your editor. By automating common GitHub tasks, you can stay focused on your code and improve your development workflow.
With this setup, you're now ready to leverage the full power of GitHub directly from Cursor. The combination of Cursor's AI capabilities with GitHub MCP Server creates a powerful development environment that can significantly boost your productivity.
Real-World Applications
Want to see how teams are using this integration in production? Check out our detailed use case study that shows how a development team managing a complex open-source project achieved:
- 40% reduction in PR review time
- 60% faster response to critical issues
- 30% improvement in documentation accuracy
- 25% reduction in bugs reaching production