GitHub MCP server

Integrates with GitHub's API to enable repository management, code manipulation, issue tracking, and pull request handling for streamlined development workflows.
Back to servers
Setup instructions
Provider
cyanheads
Release date
Mar 15, 2025
Language
TypeScript
Stats
8 stars

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.

Installation

Prerequisites

  • Node.js (v16 or newer)
  • A GitHub personal access token with appropriate permissions

Setup

  1. Clone the repository:

    git clone https://github.com/cyanheads/github-mcp-server.git
    cd github-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. 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
    
  4. Build the project:

    npm run build
    
  5. Start the server:

    node build/index.js
    

Configuration

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

MCP Client Settings

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"
      }
    }
  }
}

Available Tools

Repository Management Tools

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)

Branch Management Tools

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

Issue Management Tools

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)

Pull Request Management Tools

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)

File Management Tools

Tool Description
update_file Create or update a file in a repository
Parameters: owner, repo, path, message, content, sha (optional), branch (optional)

Release Management Tools

Tool Description
create_release Create a new release
Parameters: owner, repo, tag_name, name (optional), body (optional), draft (optional), prerelease (optional)

Important Note

This repository is deprecated. Please use the official GitHub MCP server instead at https://github.com/github/github-mcp-server.

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later