SuperAPI AI Directory

GitHub MCP Server - GitHub launches an MCP-based server tool

Author: AI小集 · Original source: AI工具集

What is GitHub MCP Server

GitHub MCP Server is a server tool based on the Model Context Protocol (MCP) officially launched by GitHub. GitHub MCP Server can seamlessly integrate with the GitHub API, providing developers with advanced automation and interaction capabilities. It supports developers in easily implementing automated workflows, such as automatically handling issues and Pull Requests in GitHub repositories, and extracting and analyzing repository data. GitHub MCP Server provides a rich set of functional modules, including user management, issue management, Pull Request management, repository management, etc., helping developers simplify cumbersome development processes and focus on core development tasks.

GitHub MCP Server

Main features of GitHub MCP Server

  • Issue management: Automatically create, update, and close GitHub issues, support batch operations, such as adding labels or assignees in batches.
  • Pull Request management: Automatically merge Pull Requests, update branches, add comments and review opinions.
  • Repository content management: Push files to repositories, create new branches, get file contents.
  • Search function: Supports searching code snippets, GitHub users, and repositories.
  • Repository content retrieval: Get the contents of files or directories under a specific path, supporting specific branches, tags, or commits.
  • Commit history analysis: Get the commit history of a branch, facilitating code review and version management.
  • Intelligent code review: Analyze code quality and automatically generate review comments.
  • Automated issue classification: Automatically assign labels or assignees based on issue content.
  • Code scanning alerts: Detect potential issues in code and generate alerts.

How to use GitHub MCP Server

  • Installation prerequisites:
    • Install Docker: Install Docker. Download and install Docker from the official Docker website.
    • Create a GitHub personal access token:
      • Log in to your GitHub account.
      • Click the avatar in the upper right corner and select Settings.
      • In the left menu, select Developer settings, then select Personal access tokens.
      • Click Generate new token, select the required permissions, generate the token and save it properly.
  • Configure the environment:
    • Use in VS Code:
      • Open VS Code.
      • Press Ctrl + Shift + P, enter Preferences: Open User Settings (JSON), and open the user settings file.
      • Add the following JSON configuration to the file:
{
    "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}"
                }
            }
        }
    }
}
      • Save and close the settings file.
    • Use in Claude Desktop:
      • Create a configuration file, for example mcp.json, and add the following content:
{
    "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>"
            }
        }
    }
}
      • Replace <YOUR_TOKEN> with your GitHub personal access token.
    • Install from source code:
      • Make sure the Go language environment is installed.
      • Clone the GitHub MCP Server repository:
git clone https://github.com/github/github-mcp-server.git
      • Enter the project directory and build:
cd github-mcp-server
go build -o github-mcp-server ./cmd/github-mcp-server
      • Run the server:
GITHUB_PERSONAL_ACCESS_TOKEN=<YOUR_TOKEN> ./github-mcp-server stdio
  • Run the server: If using Docker or building from source, ensure the environment variable GITHUB_PERSONAL_ACCESS_TOKEN is set correctly. After starting the server, interact with development tools (such as VS Code or Claude Desktop) via standard input/output.
  • Using the features of GitHub MCP Server:
    • Automated workflows: Based on configured tools, automate the handling of GitHub issues and Pull Requests.
    • Data extraction and analysis: Use search functionality to quickly locate code snippets, retrieve file contents, analyze commit history, and more.
    • AI-driven tools: If the tools support AI features, use capabilities such as intelligent code review and automated issue classification.

Project address of GitHub MCP Server

Application scenarios of GitHub MCP Server

  • Automated workflow management: Automatically create, update, and close GitHub issues, and merge Pull Requests (PRs), reducing manual operations and improving project management efficiency.
  • Intelligent code review: Automatically generate code review comments based on AI-driven tools, detect potential issues and generate alerts, and improve code quality.
  • Data extraction and analysis: Search code snippets, repositories, and user information, retrieve file contents and commit history, making it easy to quickly locate resources and perform code analysis.
  • Repository content management: Create new repositories, fork repositories, push files to specified branches, create new branches, and simplify repository management processes.
  • Development tool integration: Deeply integrated with development tools such as VS Code and Claude Desktop, supports building from source, and enhances the automation capabilities of the development environment.