
📰 Fresh out of the press!
This repository contains the setup for the Model Context Protocol (MCP) server that enables GitHub operations directly from within Cursor IDE.
The Model Context Protocol (MCP) is a powerful tool that allows AI assistants in Cursor to interact with external services like GitHub. It enables you to perform GitHub operations such as creating repositories, pushing code, searching issues, and more without leaving your IDE.
- Create and manage GitHub repositories
- Push files and code changes
- Search repositories and users
- Create and manage branches
- Fork repositories
- Search issues and code
- Clone repositories
- And much more!
- Cursor IDE installed
- GitHub account
- GitHub Personal Access Token with
repo
scope - The MCP server uses the
@modelcontextprotocol/server-github
npm package, which is run vianpx
. No global installation is required—npx
will fetch and run the latest version automatically.
-
Generate a GitHub Personal Access Token
- Go to GitHub → Settings → Developer Settings → Personal Access Tokens → Tokens (classic)
- Click "Generate new token" → "Generate new token (classic)"
- Name your token (e.g., "Cursor MCP")
- Set an expiration date
- Select the
repo
scope (this gives access to all your repositories) - Click "Generate token"
- IMPORTANT: Copy the token immediately as GitHub will only show it once
-
Create a Shell Script
- Create a new file called
run.sh
in your preferred location - Add the following content to the file (replace
YOUR_GITHUB_TOKEN
with your actual token):
#!/bin/bash export GITHUB_PERSONAL_ACCESS_TOKEN="YOUR_GITHUB_TOKEN" npx @modelcontextprotocol/server-github
- Create a new file called
-
Make the Script Executable
- Open your terminal and run:
chmod +x /path/to/run.sh
-
Add MCP Server to Cursor
- Open Cursor Settings
- Navigate to the MCP section
- Click "Add a new MCP server"
- Name: "GitHub MCP" (or any name you prefer)
- Type: Command
- Command:
bash /path/to/run.sh
(use the full path to your script) - Click "Add"
-
Enable Agent Mode
- Make sure Agent Mode is enabled in Cursor for MCP to work
graph TD
subgraph Local [Local: Developer Machine]
A[Cursor IDE]
B[AI Assistant]
C[MCP Server]
end
subgraph Remote [Remote: GitHub Cloud]
D[GitHub]
end
A -->|User Request| B
B -->|MCP Protocol| C
C -->|GitHub API| D
D -->|Response| C
C -->|Result| B
B -->|Display| A
subgraph "MCP Tools"
E[Create Repository]
F[Push Files]
G[Search Repositories]
H[Create Branches]
I[Fork Repositories]
J[Search Issues]
K[Clone Repositories]
end
C --> E
C --> F
C --> G
C --> H
C --> I
C --> J
C --> K
🚨 Danger Zone 🚨
Not recommended to host this.
Hosting this server outside your local environment is not recommended due to security reasons. However, if you only need to allow limited read/search permissions for specific optimizations, take maximum precaution to secure your server and credentials.
Simply ask the AI assistant to create a repository:
Create a repository called "my-project"
Add a README.md file to the my-project repository with the content "# My Project"
Search for repositories related to machine learning
- MCP Server Not Responding: Make sure your GitHub token is valid and has the correct permissions
- Command Not Found: Ensure the path to your script is correct in the Cursor MCP settings
- Permission Denied: Check that your script has execute permissions (
chmod +x /path/to/run.sh
)
This project is licensed under the MIT License - see the LICENSE file for details.
The MCP server is hosted locally on your machine whenever you run the run.sh
script. This means the server is not running on a remote cloud or public server, but instead starts up on your own computer each time you execute:
bash /full/path/to/run.sh
- The exact location of the server is determined by the path to your
run.sh
script. For example, if you placed it in/Users/yourusername/mcp/run.sh
, then that is where the server will be started from. - You can change the location of the script as needed, but make sure to update your Cursor MCP configuration to match the new path.
- The server will only be running while the script is active in your terminal session.
Note: The server is not accessible from the public internet unless you specifically configure your network and firewall to allow it (not recommended for most users).
Note: As of March 2025, Microsoft Visual Studio Code has also adopted support for Model Context Protocol (MCP) servers in agent mode, making it even easier for developers to integrate AI-powered tools and workflows. Read more in the official release notes: https://code.visualstudio.com/updates/v1_99