用于与GitHub API交互的工具,支持文件操作、仓库管理及搜索等功能。
GitHub (已归档) MCP Server
镜像概述和主要用途
本镜像提供与GitHub API交互的工具集,支持文件操作、仓库管理、Issue和Pull Request处理、代码搜索等功能。通过封装GitHub API,实现对GitHub资源的程序化管理和自动化操作。
https://www.anthropic.com/news/model-context-protocol
核心功能和特性
| 属性 | 详情 |
|---|---|
| Docker镜像 | https://hub.docker.com/repository/docker/mcp/github |
| 作者 | https://github.com/modelcontextprotocol |
| 代码仓库 | https://github.com/modelcontextprotocol/servers |
| Dockerfile | https://github.com/modelcontextprotocol/servers/blob/2025.4.24/src/github/Dockerfile |
| 镜像构建方 | Docker Inc. |
| Docker Scout健康评分 | |
| 验证签名 | COSIGN_REPOSITORY=mcp/signatures cosign verify mcp/github --key https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub |
| 许可证 | MIT License |
使用场景和适用范围
- 自动化仓库管理:批量创建/更新仓库、分支,实现标准化仓库配置
- Issue和PR生命周期管理:自动创建Issue、添加评论、合并PR,支持工作流自动化
- 批量文件操作:在多个仓库或分支中创建、更新文件,适用于配置同步、代码生成场景
- 代码和用户搜索:跨仓库搜索代码片段、Issue、用户,支持数据分析和调研
- CI/CD集成:作为CI/CD流程的一部分,实现与GitHub的无缝交互
可用工具列表(26个)
| 工具名称 | 简短描述 |
|---|---|
add_issue_comment | 为现有Issue添加评论 |
create_branch | 在GitHub仓库中创建新分支 |
create_issue | 在GitHub仓库中创建新Issue |
create_or_update_file | 在GitHub仓库中创建或更新单个文件 |
create_pull_request | 在GitHub仓库中创建新Pull Request |
create_pull_request_review | 对Pull Request创建审核 |
create_repository | 在个人账号中创建新GitHub仓库 |
fork_repository | 将GitHub仓库Fork到个人账号或指定组织 |
get_file_contents | 获取GitHub仓库中文件或目录的内容 |
get_issue | 获取GitHub仓库中特定Issue的详情 |
get_pull_request | 获取特定Pull Request的详情 |
get_pull_request_comments | 获取Pull Request的审核评论 |
get_pull_request_files | 获取Pull Request中更改的文件列表 |
get_pull_request_reviews | 获取Pull Request的审核记录 |
get_pull_request_status | 获取Pull Request所有状态检查的综合状态 |
list_commits | 获取GitHub仓库中某个分支的提交列表 |
list_issues | 列出GitHub仓库中的Issue,支持筛选 |
list_pull_requests | 列出并筛选仓库的Pull Request |
merge_pull_request | 合并Pull Request |
push_files | 在单个提交中向GitHub仓库推送多个文件 |
search_code | 跨GitHub仓库搜索代码 |
search_issues | 跨GitHub仓库搜索Issue和Pull Request |
search_repositories | 搜索GitHub仓库 |
search_users | 搜索GitHub用户 |
update_issue | 更新GitHub仓库中现有的Issue |
update_pull_request_branch | 使用基础分支的最新更改更新Pull Request分支 |
工具详细信息
工具:add_issue_comment
为现有Issue添加评论
| 参数 | 类型 | 描述 |
|---|---|---|
body | string | 评论内容 |
issue_number | number | Issue编号 |
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
工具:create_branch
在GitHub仓库中创建新分支
| 参数 | 类型 | 描述 |
|---|---|---|
branch | string | 新分支名称 |
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
from_branch | string 可选 | 可选:从中创建的源分支(默认为仓库的默认分支) |
工具:create_issue
在GitHub仓库中创建新Issue
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
title | string | Issue标题 |
assignees | array 可选 | 可选:负责人列表 |
body | string 可选 | 可选:Issue内容 |
labels | array 可选 | 可选:标签列表 |
milestone | number 可选 | 可选:里程碑编号 |
工具:create_or_update_file
在GitHub仓库中创建或更新单个文件
| 参数 | 类型 | 描述 |
|---|---|---|
branch | string | 操作文件的分支 |
content | string | 文件内容 |
message | string | 提交消息 |
owner | string | 仓库所有者(用户名或组织) |
path | string | 文件创建/更新的路径 |
repo | string | 仓库名称 |
sha | string 可选 | 可选:被替换文件的SHA(更新现有文件时必需) |
工具:create_pull_request
在GitHub仓库中创建新Pull Request
| 参数 | 类型 | 描述 |
|---|---|---|
base | string | 接收更改的目标分支名称 |
head | string | 包含更改的源分支名称 |
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
title | string | Pull Request标题 |
body | string 可选 | 可选:Pull Request内容/描述 |
draft | boolean 可选 | 可选:是否创建为草稿Pull Request |
maintainer_can_modify | boolean 可选 | 可选:维护者是否可以修改此Pull Request |
工具:create_pull_request_review
对Pull Request创建审核
| 参数 | 类型 | 描述 |
|---|---|---|
body | string | 审核内容文本 |
event | string | 审核操作类型 |
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
comments | array 可选 | 可选:作为审核一部分发布的评论(指定position或line,不可同时指定) |
commit_id | string 可选 | 可选:需要审核的提交SHA |
工具:create_repository
在个人账号中创建新GitHub仓库
| 参数 | 类型 | 描述 |
|---|---|---|
name | string | 仓库名称 |
autoInit | boolean 可选 | 可选:是否使用README.md初始化仓库 |
description | string 可选 | 可选:仓库描述 |
private | boolean 可选 | 可选:仓库是否设为私有 |
工具:fork_repository
将GitHub仓库Fork到个人账号或指定组织
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 源仓库所有者(用户名或组织) |
repo | string | 源仓库名称 |
organization | string 可选 | 可选:Fork目标组织(默认为个人账号) |
工具:get_file_contents
获取GitHub仓库中文件或目录的内容
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
path | string | 文件或目录路径 |
repo | string | 仓库名称 |
branch | string 可选 | 可选:获取内容的分支 |
工具:get_issue
获取GitHub仓库中特定Issue的详情
| 参数 | 类型 | 描述 |
|---|---|---|
issue_number | number | Issue编号 |
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
工具:get_pull_request
获取特定Pull Request的详情
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
工具:get_pull_request_comments
获取Pull Request的审核评论
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
工具:get_pull_request_files
获取Pull Request中更改的文件列表
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
工具:get_pull_request_reviews
获取Pull Request的审核记录
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
工具:get_pull_request_status
获取Pull Request所有状态检查的综合状态
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
工具:list_commits
获取GitHub仓库中某个分支的提交列表
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
page | number 可选 | 可选:页码 |
perPage | number 可选 | 可选:每页条数 |
sha | string 可选 | 可选:分支SHA或分支名 |
工具:list_issues
列出GitHub仓库中的Issue,支持筛选
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
direction | string 可选 | 可选:排序方向 |
labels | array 可选 | 可选:标签筛选列表 |
page | number 可选 | 可选:页码 |
per_page | number 可选 | 可选:每页条数 |
since | string 可选 | 可选:起始时间(ISO 8601格式) |
sort | string 可选 | 可选:排序字段 |
state | string 可选 | 可选:状态筛选(open/closed/all) |
工具:list_pull_requests
列出并筛选仓库的Pull Request
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
base | string 可选 | 可选:按基础分支名称筛选 |
direction | string 可选 | 可选:排序方向 |
head | string 可选 | 可选:按源用户/组织和分支名称筛选 |
page | number 可选 | 可选:页码 |
per_page | number 可选 | 可选:每页条数(最大100) |
sort | string 可选 | 可选:排序字段 |
state | string 可选 | 可选:状态筛选(open/closed/merged/all) |
工具:merge_pull_request
合并Pull Request
| 参数 | 类型 | 描述 |
|---|---|---|
owner | string | 仓库所有者(用户名或组织) |
pull_number | number | Pull Request编号 |
repo | string | 仓库名称 |
commit_message | string 可选 | 可选:附加到自动提交消息的详情 |
commit_title | string 可选 | 可选:自动提交消息的标题 |
merge_method | string 可选 | 可选:合并方式(merge/squash/rebase) |
工具:push_files
在单个提交中向GitHub仓库推送多个文件
| 参数 | 类型 | 描述 |
|---|---|---|
branch | string | 推送目标分支(如'main'或'master') |
files | array | 推送文件数组(每个元素需包含path和content字段) |
message | string | 提交消息 |
owner | string | 仓库所有者(用户名或组织) |
repo | string | 仓库名称 |
工具:search_code
跨GitHub仓库搜索代码
| 参数 | 类型 | 描述 |
|---|---|---|
q | string | 搜索查询字符串(遵循GitHub搜索语法) |
order | string 可选 | 可选:排序顺序(asc/desc) |
page | number 可选 | 可选:页码 |
per_page | number 可选 | 可选:每页条数 |
工具:search_issues
跨GitHub仓库搜索Issue和Pull Request
| 参数 | 类型 | 描述 |
|---|---|---|
q | string | 搜索查询字符串(遵循GitHub搜索语法) |
order | string 可选 | 可选:排序顺序(asc/desc) |
page | number 可选 | 可选:页码 |
per_page | number 可选 | 可选:每页条数 |
sort | string 可选 | 可选:排序字段(comments/created/updated) |
工具:search_repositories
搜索GitHub仓库
| 参数 | 类型 | 描述 |
|---|---|---|
query | string | 搜索查询字符串(参见GitHub搜索语法) |
page | number 可选 | 可选:页码(默认:1) |
perPage | number 可选 | 可选:每页条数(默认:30,最大:100) |
工具:search_users
搜索GitHub用户
| 参数 | 类型 | 描述 |
|---|---|---|
q | string | 搜索查询字符串(遵循GitHub搜索语法) |
order | string 可选 | 可选:排序顺序(asc/desc) |
page | number 可选 | 可选:页码 |
per_page | number 可选 | 可选:每页条数 |
sort | string 可选 | 可选:排序字段(followers/repositories/joined) |
工具:update_issue
更新GitHub仓库中现有的Issue
| 参数 | 类型 | 描述 |
|---|---|---|
issue_number | number | Issue编号 |
owner | string |
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
DockerHub 原生拉取命令
docker pull mcp/github:<标签>
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务