GitHub MCP server

Enables AI interaction with GitHub repositories for managing issues, pull requests, code scanning alerts, and file contents through both read-only and read-write operations.
Back to servers
Setup instructions
Provider
Denis Cruz Rodrigues
Release date
Apr 17, 2025
Language
Go
Stats
2 stars

The GitHub MCP Server provides seamless integration with GitHub APIs through the Model Context Protocol (MCP), enabling advanced automation and interaction capabilities for developers and tools.

Installation Options

Prerequisites

  1. Docker installed for container-based deployment
  2. GitHub Personal Access Token with appropriate permissions for the GitHub APIs you plan to use

Using VS Code

For quick installation, you can use the one-click install buttons available in VS Code or VS Code Insiders.

For manual installation, add the following configuration to your VS Code User Settings (JSON):

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "github_token",
        "description": "GitHub Personal Access Token",
        "password": true
      }
    ],
    "servers": {
      "github": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-e",
          "GITHUB_PERSONAL_ACCESS_TOKEN",
          "ghcr.io/github/github-mcp-server"
        ],
        "env": {
          "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
        }
      }
    }
  }
}

To access the User Settings in VS Code, press Ctrl + Shift + P and type Preferences: Open User Settings (JSON).

Alternatively, you can add the configuration to .vscode/mcp.json in your workspace to share with others (omit the mcp key in this case).

Using Claude Desktop

Add the following configuration to Claude Desktop:

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

Building from Source

If you don't have Docker, you can build the binary using Go:

# Navigate to the project directory and build
go build ./cmd/github-mcp-server

# Run the server with your GitHub token
GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here ./github-mcp-server stdio

Configuration Options

GitHub Enterprise Server

For GitHub Enterprise Server users:

# Using command line flag
./github-mcp-server --gh-host your-enterprise-server.com

# Or using environment variable
GH_HOST=your-enterprise-server.com ./github-mcp-server

Customizing Tool Descriptions

You can override tool descriptions by creating a github-mcp-server-config.json file:

{
  "TOOL_ADD_ISSUE_COMMENT_DESCRIPTION": "an alternative description",
  "TOOL_CREATE_BRANCH_DESCRIPTION": "Create a new branch in a GitHub repository"
}

Export current translations:

./github-mcp-server --export-translations

You can also use environment variables with the prefix GITHUB_MCP_:

export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"

Available Tools

User Tools

  • get_me - Get details of the authenticated user

Issue Management

  • get_issue - Gets the contents of an issue within a repository
  • get_issue_comments - Get comments for a GitHub issue
  • create_issue - Create a new issue in a GitHub repository
  • add_issue_comment - Add a comment to an issue
  • list_issues - List and filter repository issues
  • update_issue - Update an existing issue in a GitHub repository
  • search_issues - Search for issues and pull requests

Pull Request Operations

  • get_pull_request - Get details of a specific pull request
  • list_pull_requests - List and filter repository pull requests
  • merge_pull_request - Merge a pull request
  • get_pull_request_files - Get the list of files changed in a pull request
  • get_pull_request_status - Get the combined status of all status checks for a pull request
  • update_pull_request_branch - Update a pull request branch with the latest changes from the base branch
  • get_pull_request_comments - Get the review comments on a pull request
  • get_pull_request_reviews - Get the reviews on a pull request
  • create_pull_request_review - Create a review on a pull request review
  • create_pull_request - Create a new pull request

Repository Management

  • create_or_update_file - Create or update a single file in a repository
  • push_files - Push multiple files in a single commit
  • search_repositories - Search for GitHub repositories
  • create_repository - Create a new GitHub repository
  • get_file_contents - Get contents of a file or directory
  • fork_repository - Fork a repository
  • create_branch - Create a new branch
  • list_commits - Gets commits of a branch in a repository

Search Functionality

  • search_code - Search for code across GitHub repositories
  • search_users - Search for GitHub users

Code Scanning

  • get_code_scanning_alert - Get a code scanning alert
  • list_code_scanning_alerts - List code scanning alerts for a repository

Resource Access

The server provides access to repository content through resource URLs:

Repository Content Resources

  • Basic repository content: repo://{owner}/{repo}/contents{/path*}
  • Branch-specific content: repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}
  • Commit-specific content: repo://{owner}/{repo}/sha/{sha}/contents{/path*}
  • Tag-specific content: repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}
  • Pull request content: repo://{owner}/{repo}/refs/pull/{prNumber}/head/contents{/path*}

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":"docker","args":["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"],"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"${input:github_token}"}}'

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": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "GITHUB_PERSONAL_ACCESS_TOKEN",
                "ghcr.io/github/github-mcp-server"
            ],
            "env": {
                "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
            }
        }
    }
}

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": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "GITHUB_PERSONAL_ACCESS_TOKEN",
                "ghcr.io/github/github-mcp-server"
            ],
            "env": {
                "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
            }
        }
    }
}

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