弃用通知: 此项目的开发已移至GitHub,在http://github.com/github/github-mcp-server仓库中进行。
GitHub API的MCP服务器,支持文件操作、仓库管理、搜索功能等。
create_or_update_file
owner(字符串):仓库所有者(用户名或组织)repo(字符串):仓库名称path(字符串):创建/更新文件的位置路径content(字符串):文件内容message(字符串):提交信息branch(字符串):要创建/更新文件的分支sha(可选字符串):被替换文件的SHA(用于更新)push_files
owner(字符串):仓库所有者repo(字符串):仓库名称branch(字符串):要推送的分支files(数组):要推送的文件,每个文件包含path和contentmessage(字符串):提交信息search_repositories
query(字符串):搜索查询page(可选数字):分页的页码perPage(可选数字):每页结果数(最大100)create_repository
name(字符串):仓库名称description(可选字符串):仓库描述private(可选布尔值):是否为私有仓库autoInit(可选布尔值):使用README初始化get_file_contents
owner(字符串):仓库所有者repo(字符串):仓库名称path(字符串):文件/目录路径branch(可选字符串):获取内容的分支create_issue
owner(字符串):仓库所有者repo(字符串):仓库名称title(字符串):问题标题body(可选字符串):问题描述assignees(可选字符串数组):分配给的用户名labels(可选字符串数组):添加的标签milestone(可选数字):里程碑编号create_pull_request
owner(字符串):仓库所有者repo(字符串):仓库名称title(字符串):拉取请求标题body(可选字符串):拉取请求描述head(字符串):包含更改的分支base(字符串):要合并到的分支draft(可选布尔值):作为草稿拉取请求创建maintainer_can_modify(可选布尔值):允许维护者编辑fork_repository
owner(字符串):仓库所有者repo(字符串):仓库名称organization(可选字符串):分叉到的组织create_branch
owner(字符串):仓库所有者repo(字符串):仓库名称branch(字符串):新分支名称from_branch(可选字符串):源分支(默认为仓库默认分支)list_issues
owner(字符串):仓库所有者repo(字符串):仓库名称state(可选字符串):按状态过滤('open', 'closed', 'all')labels(可选字符串数组):按标签过滤sort(可选字符串):排序字段('created', 'updated', 'comments')direction(可选字符串):排序方向('asc', 'desc')since(可选字符串):按日期过滤(ISO 8601时间戳)page(可选数字):页码per_page(可选数字):每页结果数update_issue
owner(字符串):仓库所有者repo(字符串):仓库名称issue_number(数字):要更新的问题编号title(可选字符串):新的标题body(可选字符串):新的描述state(可选字符串):新的状态('open' 或 'closed')labels(可选字符串数组):新的标签assignees(可选字符串数组):新的分配人milestone(可选数字):新的里程碑编号add_issue_comment
owner(字符串):仓库所有者repo(字符串):仓库名称issue_number(数字):要评论的问题编号body(字符串):评论文本search_code
q(字符串):使用GitHub代码搜索语法的搜索查询sort(可选字符串):排序字段(仅 'indexed')order(可选字符串):排序顺序('asc' 或 'desc')per_page(可选数字):每页结果数(最大100)page(可选数字):页码search_issues
q(字符串):使用GitHub问题搜索语法的搜索查询sort(可选字符串):排序字段(comments, reactions, created 等)order(可选字符串):排序顺序('asc' 或 'desc')per_page(可选数字):每页结果数(最大1100)page(可选数字):页码search_users
q(字符串):使用GitHub用户搜索语法的搜索查询sort(可选字符串):排序字段(followers, repositories, joined)order(可选字符串):排序顺序('asc' 或 'desc')per_page(可选数字):每页结果数(最大100)page(可选数字):页码list_commits
owner(字符串):仓库所有者repo(字符串):仓库名称page(可选字符串):页码per_page(可选字符串):每页记录数sha(可选字符串):分支名称get_issueowner(字符串):仓库所有者repo(字符串):仓库名称issue_number(数字):要检索的问题编号get_pull_requestowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号list_pull_requestsowner(字符串):仓库所有者repo(字符串):仓库名称state(可选字符串):按状态过滤('open', 'closed', 'all')head(可选字符串):按头用户/组织和分支过滤base(可选字符串):按基础分支过滤sort(可选字符串):排序字段('created', 'updated', 'popularity', 'long-running')direction(可选字符串):排序方向('asc', 'desc')per_page(可选数字):每页结果数(最大100)page(可选数字):页码create_pull_request_reviewowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号body(字符串):审核评论文本event(字符串):审核动作('APPROVE', 'REQUEST_CHANGES', 'COMMENT')commit_id(可选字符串):要审核的提交的SHAcomments(可选数组):行特定评论,每个评论包含:
path(字符串):文件路径position(数字):差异中的行位置body(字符串):评论文本merge_pull_requestowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号commit_title(可选字符串):合并提交的标题commit_message(可选字符串):合并提交的额外细节merge_method(可选字符串):合并方法('merge', 'squash', 'rebase')get_pull_request_filesowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号get_pull_request_statusowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号update_pull_request_branchowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号expected_head_sha(可选字符串):拉取请求HEAD引用的预期SHAget_pull_request_commentsowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号get_pull_request_reviewsowner(字符串):仓库所有者repo(字符串):仓库名称pull_number(数字):拉取请求编号language:javascript:按编程语言搜索repo:owner/name:在特定仓库中搜索path:app/src:在特定路径中搜索extension:js:按文件扩展名搜索q: "import express" language:typescript path:src/is:issue 或 is:pr:按类型筛选is:open 或 is:closed:按状态筛选label:bug:按标签搜索author:username:按作者搜索q: "memory leak" is:issue is:open label:bugtype:user 或 type:org:按账户类型筛选followers:>1000:按关注者筛选location:London:按地点搜索q: "fullstack developer" location:London followers:>100有关详细的搜索语法,请参阅GitHub的搜索文档。
创建GitHub个人访问令牌,具有适当的权限:
repo范围的令牌(“完全控制私有仓库”)
public_repo范围要在Claude Desktop中使用此服务,请在您的claude_desktop_config.json中添加以下内容:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"mcp/github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
快速安装,请使用以下安装按钮之一: