The GitHub MCP server provides a standardized interface for Large Language Models (LLMs) to interact with GitHub repositories through the Model Context Protocol. It enables AI agents to manage repositories, issues, pull requests, branches, files, and releases through a consistent API.
Clone the repository:
git clone https://github.com/cyanheads/github-mcp-server.git
cd github-mcp-server
Install dependencies:
npm install
Create a .env
file in the project root with your GitHub token:
GITHUB_TOKEN=your_github_personal_access_token
LOG_LEVEL=info
SERVER_NAME=github-mcp-server
Build the project:
npm run build
Start the server:
node build/index.js
The server can be configured through environment variables:
Environment Variable | Description | Default |
---|---|---|
GITHUB_TOKEN |
GitHub personal access token (required) | - |
LOG_LEVEL |
Logging level (debug, info, warn, error, fatal) | info |
SERVER_NAME |
MCP server name | github-mcp-server |
SERVER_VERSION |
MCP server version | 0.1.0 |
API_TIMEOUT_MS |
Timeout for API calls in milliseconds | 10000 |
RATE_LIMITING_ENABLED |
Whether rate limiting is enabled | true |
RATE_LIMITING_MIN_REMAINING |
Minimum remaining requests before throttling | 100 |
RATE_LIMITING_RESET_BUFFER_MS |
Time buffer to add to rate limit reset time | 5000 |
Add to your MCP client settings:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/path/to/github-mcp-server/build/index.js"],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"LOG_LEVEL": "info",
"SERVER_NAME": "github-mcp-server"
}
}
}
}
Tool | Description |
---|---|
get_repository |
Get detailed information about a specific repository Parameters: owner , repo |
list_repositories |
List repositories for the authenticated user Parameters: type (optional), sort (optional) |
create_repository |
Create a new GitHub repository Parameters: name , description (optional), private (optional) |
Tool | Description |
---|---|
list_branches |
List branches in a repository Parameters: owner , repo , protected (optional), per_page (optional) |
create_branch |
Create a new branch Parameters: owner , repo , branch , sha |
delete_branch |
Delete a branch Parameters: owner , repo , branch |
Tool | Description |
---|---|
create_issue |
Create a new issue in a repository Parameters: owner , repo , title , body (optional), labels (optional) |
list_issues |
List issues in a repository Parameters: owner , repo , state (optional), labels (optional) |
Tool | Description |
---|---|
create_pull_request |
Create a new pull request Parameters: owner , repo , title , head , base , body (optional) |
merge_pull_request |
Merge a pull request Parameters: owner , repo , pull_number , commit_title (optional), commit_message (optional), merge_method (optional) |
update_pull_request |
Update an existing pull request Parameters: owner , repo , pull_number , title (optional), body (optional), state (optional), base (optional), maintainer_can_modify (optional) |
list_pull_requests |
List pull requests in a repository Parameters: owner , repo , state (optional), head (optional), base (optional), sort (optional), direction (optional) |
Tool | Description |
---|---|
update_file |
Create or update a file in a repository Parameters: owner , repo , path , message , content , sha (optional), branch (optional) |
Tool | Description |
---|---|
create_release |
Create a new release Parameters: owner , repo , tag_name , name (optional), body (optional), draft (optional), prerelease (optional) |
This repository is deprecated. Please use the official GitHub MCP server instead at https://github.com/github/github-mcp-server.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "github" '{"command":"node","args":["/path/to/github-mcp-server/build/index.js"],"env":{"GITHUB_TOKEN":"your_github_personal_access_token","LOG_LEVEL":"info","SERVER_NAME":"github-mcp-server"}}'
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": "node",
"args": [
"/path/to/github-mcp-server/build/index.js"
],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"LOG_LEVEL": "info",
"SERVER_NAME": "github-mcp-server"
}
}
}
}
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": "node",
"args": [
"/path/to/github-mcp-server/build/index.js"
],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"LOG_LEVEL": "info",
"SERVER_NAME": "github-mcp-server"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect