This MCP server provides tools for interacting with GitHub APIs through Claude Desktop, allowing you to manage repositories, issues, pull requests, and more without leaving your Claude environment.
You'll need a GitHub account and a personal access token before setting up the MCP server.
Clone the repository:
git clone https://github.com/yourusername/github-mcp.git
cd github-mcp
Create and activate a virtual environment:
# On macOS/Linux
python -m venv venv
source venv/bin/activate
# On Windows
python -m venv venv
.\venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Create a .env
file in the project root:
touch .env
Add your GitHub credentials to the .env
file:
GITHUB_TOKEN=your_personal_access_token_here
GITHUB_USERNAME=your_github_username
Start the MCP server:
python run.py
To use this MCP server, you'll need a fine-grained personal access token:
.env
fileSearch for GitHub repositories using various criteria.
Parameters:
Create a new GitHub issue in a specified repository.
Parameters:
Create a new pull request.
Parameters:
Update repository settings and configurations.
Parameters:
Search for issues across repositories.
Parameters:
Manage GitHub Actions workflows.
Parameters:
Manage repository collaborators.
Parameters:
Here are examples of how to use the MCP tools in your code:
# Search for repositories
search_repos(query="python web framework", sort="stars", max_results=5)
# Create a new issue
create_issue(
owner="username",
repo="repository",
title="Bug: Login not working",
body="Users cannot log in using the login button",
labels=["bug", "high-priority"]
)
# Create a pull request
create_pull_request(
owner="username",
repo="repository",
title="Feature: Add user authentication",
body="Implements JWT-based authentication",
head="feature/auth",
base="main"
)
# Search for issues
search_issues(query="is:open is:issue author:username", max_results=10)
# Manage repository settings
manage_repo_settings(
owner="username",
repo="repository",
settings={
"has_issues": True,
"has_projects": True,
"has_wiki": True
}
)
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "github" '{"command":"python","args":["run.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"github": {
"command": "python",
"args": [
"run.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"github": {
"command": "python",
"args": [
"run.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect