GitHub MCP Server Plus

GitHub MCP Server Plus

用于 GitHub API 的 MCP 服务器,提供文件操作、存储库管理和高级搜索功能,具有自动分支创建和全面的错误处理。

版本控制
开发者工具
搜索
访问服务器

Tools

create_or_update_file

Create or update a single file in a GitHub repository

search_repositories

Search for GitHub repositories

create_repository

Create a new GitHub repository in your account

get_file_contents

Get the contents of a file or directory from a GitHub repository

push_files_content

Push multiple files with direct content to a GitHub repository in a single commit

push_files_from_path

Push multiple files from filesystem paths to a GitHub repository in a single commit

create_issue

Create a new issue in a GitHub repository

create_pull_request

Create a new pull request in a GitHub repository

fork_repository

Fork a GitHub repository to your account or specified organization

create_branch

Create a new branch in a GitHub repository

list_commits

Get list of commits of a branch in a GitHub repository

list_issues

List issues in a GitHub repository with filtering options

update_issue

Update an existing issue in a GitHub repository

add_issue_comment

Add a comment to an existing issue

search_code

Search for code across GitHub repositories

search_issues

Search for issues and pull requests across GitHub repositories

search_users

Search for users on GitHub

get_issue

Get details of a specific issue in a GitHub repository.

README

GitHub MCP Server Plus

npm 下载量

用于 GitHub API 的 MCP 服务器,支持文件操作、仓库管理、搜索功能等。

<a href="https://glama.ai/mcp/servers/qmvm4mx87p"><img width="380" height="200" src="https://glama.ai/mcp/servers/qmvm4mx87p/badge" alt="GitHub Server Plus MCP server" /></a>

功能

  • 自动分支创建: 在创建/更新文件或推送更改时,如果分支不存在,则会自动创建
  • 全面的错误处理: 针对常见问题提供清晰的错误消息
  • Git 历史记录保留: 操作保持正确的 Git 历史记录,而无需强制推送
  • 批量操作: 支持单文件和多文件操作,可以使用内容或文件路径
  • 高级搜索: 支持搜索代码、问题/PR 和用户

工具

  1. create_or_update_file

    • 在仓库中创建或更新单个文件
    • 输入:
      • owner (string): 仓库所有者(用户名或组织)
      • repo (string): 仓库名称
      • path (string): 创建/更新文件的路径
      • content (string): 文件内容
      • message (string): 提交消息
      • branch (string): 在哪个分支中创建/更新文件
      • sha (optional string): 被替换文件的 SHA(用于更新)
    • 返回: 文件内容和提交详情
  2. push_files_content

    • 在单个提交中推送多个具有直接内容的文件
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • branch (string): 推送到的分支
      • files (array): 要推送的文件,每个文件都包含 pathcontent
      • message (string): 提交消息
    • 返回: 更新后的分支引用
  3. push_files_from_path

    • 在单个提交中从文件系统路径推送多个文件
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • branch (string): 推送到的分支
      • files (array): 要推送的文件,每个文件都包含:
        • path (string): 仓库中的目标路径
        • filepath (string): 要从中读取的源文件系统路径
      • message (string): 提交消息
    • 返回: 更新后的分支引用
  4. search_repositories

    • 搜索 GitHub 仓库
    • 输入:
      • query (string): 搜索查询
      • page (optional number): 分页的页码
      • perPage (optional number): 每页结果数(最多 100)
    • 返回: 仓库搜索结果
  5. create_repository

    • 创建一个新的 GitHub 仓库
    • 输入:
      • name (string): 仓库名称
      • description (optional string): 仓库描述
      • private (optional boolean): 仓库是否应为私有
      • autoInit (optional boolean): 使用 README 初始化
    • 返回: 创建的仓库详情
  6. get_file_contents

    • 获取文件或目录的内容
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • path (string): 文件/目录的路径
      • branch (optional string): 从哪个分支获取内容
    • 返回: 文件/目录内容
  7. create_issue

    • 创建一个新的 issue
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • title (string): Issue 标题
      • body (optional string): Issue 描述
      • assignees (optional string[]): 要分配的用户名
      • labels (optional string[]): 要添加的标签
      • milestone (optional number): 里程碑编号
    • 返回: 创建的 issue 详情
  8. create_pull_request

    • 创建一个新的 pull request
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • title (string): PR 标题
      • body (optional string): PR 描述
      • head (string): 包含更改的分支
      • base (string): 要合并到的分支
      • draft (optional boolean): 创建为草稿 PR
      • maintainer_can_modify (optional boolean): 允许维护者编辑
    • 返回: 创建的 pull request 详情
  9. fork_repository

    • Fork 一个仓库
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • organization (optional string): 要 fork 到的组织
    • 返回: Fork 的仓库详情
  10. create_branch

    • 创建一个新分支
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • branch (string): 新分支的名称
      • from_branch (optional string): 源分支(默认为仓库默认分支)
    • 返回: 创建的分支引用
  11. list_issues

    • 列出和筛选仓库 issue
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • state (optional string): 按状态筛选('open'、'closed'、'all')
      • labels (optional string[]): 按标签筛选
      • sort (optional string): 按('created'、'updated'、'comments')排序
      • direction (optional string): 排序方向('asc'、'desc')
      • since (optional string): 按日期筛选(ISO 8601 时间戳)
      • page (optional number): 页码
      • per_page (optional number): 每页结果数
    • 返回: issue 详情数组
  12. update_issue

    • 更新现有的 issue
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • issue_number (number): 要更新的 issue 编号
      • title (optional string): 新标题
      • body (optional string): 新描述
      • state (optional string): 新状态('open' 或 'closed')
      • labels (optional string[]): 新标签
      • assignees (optional string[]): 新受让人
      • milestone (optional number): 新里程碑编号
    • 返回: 更新后的 issue 详情
  13. add_issue_comment

    • 向 issue 添加评论
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • issue_number (number): 要评论的 issue 编号
      • body (string): 评论文本
    • 返回: 创建的评论详情
  14. search_code

    • 搜索 GitHub 仓库中的代码
    • 输入:
      • q (string): 使用 GitHub 代码搜索语法的搜索查询
      • sort (optional string): 排序字段(仅 'indexed')
      • order (optional string): 排序顺序('asc' 或 'desc')
      • per_page (optional number): 每页结果数(最多 100)
      • page (optional number): 页码
    • 返回: 带有仓库上下文的代码搜索结果
  15. search_issues

    • 搜索 issue 和 pull request
    • 输入:
      • q (string): 使用 GitHub issue 搜索语法的搜索查询
      • sort (optional string): 排序字段(comments、reactions、created 等)
      • order (optional string): 排序顺序('asc' 或 'desc')
      • per_page (optional number): 每页结果数(最多 100)
      • page (optional number): 页码
    • 返回: issue 和 pull request 搜索结果
  16. search_users

    • 搜索 GitHub 用户
    • 输入:
      • q (string): 使用 GitHub 用户搜索语法的搜索查询
      • sort (optional string): 排序字段(followers、repositories、joined)
      • order (optional string): 排序顺序('asc' 或 'desc')
      • per_page (optional number): 每页结果数(最多 100)
      • page (optional number): 页码
    • 返回: 用户搜索结果
  17. list_commits

    • 获取仓库中某个分支的提交
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • page (optional string): 页码
      • per_page (optional string): 每页记录数
      • sha (optional string): 分支名称
    • 返回: 提交列表
  18. get_issue

    • 获取仓库中 issue 的内容
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • issue_number (number): 要检索的 issue 编号
    • 返回: GitHub Issue 对象和详情
  19. get_pull_request

    • 获取特定 pull request 的详细信息
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
    • 返回: Pull request 详细信息,包括 diff 和审核状态
  20. list_pull_requests

    • 列出和筛选仓库 pull request
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • state (optional string): 按状态筛选('open'、'closed'、'all')
      • head (optional string): 按 head 用户/组织和分支筛选
      • base (optional string): 按 base 分支筛选
      • sort (optional string): 按('created'、'updated'、'popularity'、'long-running')排序
      • direction (optional string): 排序方向('asc'、'desc')
      • per_page (optional number): 每页结果数(最多 100)
      • page (optional number): 页码
    • 返回: pull request 详情数组
  21. create_pull_request_review

    • 在 pull request 上创建审核
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
      • body (string): 审核评论文本
      • event (string): 审核操作('APPROVE'、'REQUEST_CHANGES'、'COMMENT')
      • commit_id (optional string): 要审核的提交的 SHA
      • comments (optional array): 行特定评论,每个评论都包含:
        • path (string): 文件路径
        • position (number): diff 中的行位置
        • body (string): 评论文本
    • 返回: 创建的审核详情
  22. merge_pull_request

    • 合并 pull request
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
      • commit_title (optional string): 合并提交的标题
      • commit_message (optional string): 合并提交的额外详细信息
      • merge_method (optional string): 合并方法('merge'、'squash'、'rebase')
    • 返回: 合并结果详情
  23. get_pull_request_files

    • 获取 pull request 中更改的文件列表
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
    • 返回: 更改的文件数组,包含 patch 和状态详情
  24. get_pull_request_status

    • 获取 pull request 的所有状态检查的组合状态
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
    • 返回: 组合状态检查结果和单个检查详情
  25. update_pull_request_branch

    • 使用 base 分支的最新更改更新 pull request 分支
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
      • expected_head_sha (optional string): pull request 的 HEAD ref 的预期 SHA
    • 返回: 分支更新成功消息
  26. get_pull_request_comments

    • 获取 pull request 上的审核评论
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
    • 返回: pull request 审核评论数组
  27. get_pull_request_reviews

    • 获取 pull request 上的审核
    • 输入:
      • owner (string): 仓库所有者
      • repo (string): 仓库名称
      • pull_number (number): Pull request 编号
    • 返回: pull request 审核数组

搜索查询语法

代码搜索

  • language:javascript: 按编程语言搜索
  • repo:owner/name: 在特定仓库中搜索
  • path:app/src: 在特定路径中搜索
  • extension:js: 按文件扩展名搜索
  • 示例: q: "import express" language:typescript path:src/

Issue 搜索

  • is:issueis:pr: 按类型筛选
  • is:openis:closed: 按状态筛选
  • label:bug: 按标签搜索
  • author:username: 按作者搜索
  • 示例: q: "memory leak" is:issue is:open label:bug

用户搜索

  • type:usertype:org: 按帐户类型筛选
  • followers:>1000: 按关注者筛选
  • location:London: 按位置搜索
  • 示例: q: "fullstack developer" location:London followers:>100

有关详细的搜索语法,请参阅 GitHub 的搜索文档

设置

个人访问令牌

创建一个具有适当权限的 GitHub 个人访问令牌

  • 转到 个人访问令牌(在 GitHub 设置 > 开发者设置中)
  • 选择您希望此令牌有权访问的仓库(公共、全部或选择)
  • 创建一个具有 repo 范围(“完全控制私有仓库”)的令牌
    • 或者,如果仅使用公共仓库,则仅选择 public_repo 范围
  • 复制生成的令牌

与 Claude Desktop 一起使用

要将其与 Claude Desktop 一起使用,请将以下内容添加到您的 claude_desktop_config.json 中:

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 构建:

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

许可证

此 MCP 服务器已获得 MIT 许可证的许可。 这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。 有关更多详细信息,请参阅项目存储库中的 LICENSE 文件。

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
Gitingest-MCP

Gitingest-MCP

一个用于 gitingest 的 MCP 服务器。它允许像 Claude Desktop、Cursor、Cline 等 MCP 客户端快速提取关于 Github 仓库的信息,包括仓库摘要、项目目录结构、文件内容等。

精选
本地
Python
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

这个 Serper MCP 服务器支持搜索和网页抓取,并且支持 Serper API 引入的所有最新参数,例如位置信息。

精选
TypeScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript