Back to MCP directory
publicPublicdnsLocal runtime

PhialsBasement_mcp-github-server-plus

GitHub MCP Server Plus是一个基于GitHub API的服务,提供文件操作、仓库管理、搜索功能等全面功能,支持自动分支创建、批量操作和高级搜索,并保持Git历史记录。

article

README

🚀 GitHub MCP 服务器指南

本指南详细介绍了 GitHub MCP 服务器的安装、使用、配置等内容,能帮助你快速搭建并使用该服务器,实现对 GitHub 仓库的高效管理和操作。

🚀 快速开始

安装 Docker 并启动服务

下载镜像

docker pull mcp/github

启动服务

docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=mYnGfGhp0c3oQ9cd8w5DZvxnWiawQjxOls -p 1234:1234 mcp/github

✨ 主要特性

支持命令

  • 仓库信息:获取仓库的提交、分支和标签信息。
  • 代码搜索:支持语言过滤、路径限制和文件扩展名筛选。
  • 问题管理:搜索开放或关闭的问题,按标签分类。
  • 拉取请求:查看合并状态和检查结果。
  • 评论与审查:获取代码评论和审查意见。

📦 安装指南

安装 Docker 并启动服务

下载镜像

docker pull mcp/github

启动服务

docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN=mYnGfGhp0c3oQ9cd8w5DZvxnWiawQjxOls -p 1234:1234 mcp/github

💻 使用示例

支持的 Git 命令

基础用法

# 获取仓库信息
git ls-remote https://github.com/username/repo.git

# 创建新分支
git branch new-feature -f origin/main:main

# 提交更改
git push https://x-access-token:<TOKEN>@github.com/username/repo.git main

支持的 GitHub API 命令

基础用法

# 获取用户信息
GET /users/{username}

# 获取仓库信息
GET /repos/{owner}/{repo}

# 创建新分支
POST /repos/{owner}/{repo}/branches

支持的代码搜索命令

基础用法

# 按语言搜索
language:javascript

# 按仓库路径搜索
repo:owner/name

# 按文件路径搜索
path:app/src

搜索代码、问题和用户

基础用法

# 搜索代码
q: "import express" language:typescript path:src/

# 搜索问题
q: "memory leak" is:issue is:open label:bug

# 搜索用户
q: "fullstack developer" location:London followers:>100

📚 详细文档

个人访问令牌设置

创建 GitHub 个人访问令牌:

  • 登录 GitHub 账户,进入“开发者设置” > “个人访问令牌”。
  • 生成新令牌,并授予“repo”范围权限。

Docker 配置示例

{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "mcp/github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}

NPX 配置示例

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}

镜像构建

docker build -t mcp/github -f src/github/Dockerfile .

设置与配置

个人访问令牌

创建并配置个人访问令牌,确保具有适当的权限(如“repo”范围)。

集成到 Claude Desktop

claude_desktop_config.json 中添加 GitHub MCP 服务器配置。

📄 许可证

本 MCP 服务器基于 MIT 许可证。这意味着您可以自由使用、修改和分发软件,但需遵守 MIT 许可证的条款和条件。更多细节请参阅项目存储库中的 LICENSE 文件。

建议贡献者

欢迎 fork 仓库并提交 Pull Request。如有任何问题,请在 Issues 中提出。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client