这是一个全面的模型上下文协议(MCP)服务器,允许你的MCP客户端(如Claude Desktop、Roo Code、Cline、Cursor、Windsurf等)使用你的GitHub个人访问令牌与GitHub仓库进行交互。它基于令牌实现了GitHub自动化管理,无需Docker以实现最佳性能,并且提供灵活的配置,支持细粒度控制,拥有89个可直接集成API的工具。
repo(对私有仓库的完全控制):推荐用于完整功能。user:read 或 user:email(用于读取用户个人资料数据)。read:org(如果你需要访问组织信息)。确保你已安装Node.js,然后使用 npx 直接运行服务器。检查你是否已将GitHub令牌导出为名为 GH_TOKEN 的环境变量,或者将其包含在你的MCP客户端配置中。
# 使用npx直接运行
npx -y github-repos-manager-mcp
对于macOS/Linux:
{
"mcpServers": {
"github-repos-manager": {
"command": "npx",
"args": [
"-y",
"github-repos-manager-mcp"
],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE"
}
}
}
}
对于Windows,某些情况下你可能需要使用npx.cmd而不是npx:
{
"mcpServers": {
"github-repos-manager": {
"command": "npx.cmd",
"args": [
"-y",
"github-repos-manager-mcp"
],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE"
}
}
}
}
此命令将自动下载并运行服务器的最新版本,无需在本地进行安装。
如果你更喜欢在本地运行服务器,可以克隆仓库并安装依赖项:
git clone https://github.com/kurdin/github-repos-manager.git
cd github-repos-manager
npm install
然后,配置你的MCP客户端,使其指向 server.cjs 的完整路径:
{
"mcpServers": {
"github-repos-manager": {
"command": "node",
"args": ["/full/path/to/your/project/github-repos-manager-mcp/server.cjs"],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE"
}
}
}
}
重要提示:请将 "ghp_YOUR_ACTUAL_TOKEN_HERE" 替换为你实际的GitHub个人访问令牌。
一旦MCP客户端配置了正确的 server.cjs 路径和你的 GH_TOKEN,当客户端尝试使用其工具之一时,服务器应自动启动。
你也可以直接测试服务器脚本以进行基本身份验证,但这需要在你的shell中临时设置 GH_TOKEN 环境变量以进行此特定测试:
# 仅用于直接脚本测试(正常操作使用MCP客户端配置)
export GH_TOKEN="ghp_YOUR_TEMPORARY_TEST_TOKEN"
node server.cjs
unset GH_TOKEN # 重要:测试后取消设置
如果成功,你应该会看到 "GitHub API authentication successful" 和 "GitHub Repos Manager MCP Server running on stdio"。
注意:服务器仅在你通过环境变量、命令行参数或使用 set_default_repo 工具明确配置时才会设置默认仓库,它不会自动设置默认仓库。
Claude Desktop claude_desktop_config.json 的示例文件位置:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json(路径可能会有所不同)🎯 简单性:基于令牌的访问消除了复杂性。 🌿 高效性:无需Docker,确保轻量级和最佳性能。 💪 强大功能:89个可直接集成API的工具提供了无与伦比的灵活性。 🔒 灵活性:可配置的工具支持细粒度控制。
✅ 无需Docker - 一个简单的Node.js服务器,可以在任何地方运行
✅ 单令牌设置 - 仅需一个GitHub个人访问令牌即可工作
✅ 直接API集成 - 不依赖 gh CLI,更快、更可靠
✅ 零配置 - 只需令牌即可开箱即用
✅ 允许的仓库 - 将操作限制在特定的仓库或所有者范围内 ✅ 工具管理 - 启用/禁用特定工具以进行细粒度控制 ✅ 默认仓库 - 设置默认仓库以简化工作流程 ✅ 灵活的权限 - 精确配置服务器可以访问的内容
✅ 全面的工具包 - 89个强大的工具,可实现完整的GitHub工作流程 ✅ 分支和提交管理 - 创建分支、查看历史记录、比较更改 ✅ 图像上传支持 - 直接在问题中上传和嵌入图像 ✅ 高级过滤 - 支持多种条件的排序、过滤和搜索 ✅ 速率限制处理 - 内置GitHub API速率限制管理
repo(对私有仓库的完全控制):推荐用于完整功能。user:read 或 user:email(用于读取用户个人资料数据)。read:org(如果你需要访问组织信息)。配置完成后,你可以让你的MCP客户端(如Claude)执行强大的GitHub操作:
# 仓库发现和管理
"List my GitHub repositories, sort by creation date and show only private repos."
"Set default repository to `octocat/Spoon-Knife` for easier workflow."
"Get detailed information about the `microsoft/vscode` repository."
"Show me the contents of the `src/main.js` file in microsoft/vscode on the `develop` branch."
"Show me the contents of the `src/main.js` file in the default repository on the `develop` branch." # 需要设置默认仓库
"List all collaborators for `my-org/my-repo` who have admin permissions."
"Search for repositories matching 'tensorflow examples language:python' and sort by stars."
# 高级问题管理
"Create an issue in `my-org/my-repo` with title 'Urgent: UI Bug' and body 'The login button is broken on mobile.' Assign it to `user1` and `user2` and add the `bug` label."
"Create an issue with title 'Feature Request' and add the `enhancement` label." # 需要设置默认仓库
"Upload a screenshot from `/Users/me/screenshots/bug_report.png` to issue #42 in microsoft/vscode."
"Upload a screenshot from `/Users/me/screenshots/bug_report.png` to issue #42 in the default repository." # 需要设置默认仓库
"Edit issue #15: change title to 'Feature Request: Dark Mode', add the `enhancement` label, and close it."
"Lock issue #23 with reason 'resolved' to prevent further discussion."
"Get complete details for issue #7 including all metadata and current state."
"Remove `old-assignee` from issue #12 and add `new-assignee` instead."
# 问题讨论管理
"List all comments on issue #7 from the last week."
"Add a comment 'This looks great! Ready for merge.' to issue #15."
"Edit comment ID 123456 to say 'Updated: This needs more testing before merge.'"
"Delete comment ID 789012 from issue #20."
# 标签和里程碑管理
"List all labels in `my-org/my-repo` to see current organization system."
"List all labels in the default repository to see current organization system." # 需要设置默认仓库
"Create a new label called 'urgent' with red color (#ff0000) and description 'Requires immediate attention'."
"Edit the 'bug' label to change its color to orange (#FFA500) and update the description."
"Delete the outdated 'legacy' label from the repository."
"List all open milestones in `my-org/project-x` sorted by due date."
"Create a milestone 'v2.0 Release' with due date '2025-12-31T23:59:59Z' and description 'Major version release'."
"Edit milestone #3 to change the title to 'Q2 Goals' and extend the due date."
"Delete milestone #5 as it's no longer relevant to the project."
# 拉取请求和协作
"List all open pull requests for `microsoft/vscode`."
"List all open pull requests for the default repository." # 需要设置默认仓库
"Show me closed pull requests from the last month for `my-org/project-x`."
"Get my GitHub user profile information."
"Get user profile details for `github_username`."
# 分支和提交管理
"List all branches in `my-org/my-repo` and show their protection status."
"List all branches in the default repository and show their protection status." # 需要设置默认仓库
"Show only protected branches in `my-org/secure-repo`."
"Create a new feature branch called `feature/dark-mode` from the `develop` branch."
"List the last 10 commits on the `main` branch."
"Show me all commits by `john-doe` from the last week."
"Get detailed information about commit `abc123def` including all file changes."
"Compare the `main` branch with `feature/new-ui` to see what's different."
"Show me the commit history between `v1.0.0` and `v2.0.0` tags."
# 工作流自动化示例
"Set `my-org/main-project` as default, then list all open issues assigned to me."
"Create a bug report issue with title 'Login Error', upload the error screenshot from `/path/to/error.png`, assign to `dev-team`, and add labels `bug` and `high-priority`."
"For issue #50: add assignee `reviewer1`, lock it with reason 'resolved', and add a final comment 'Issue resolved in PR #51'."
你可以设置默认仓库以简化工作流程,避免在每个命令中都指定 owner 和 repo。有三种配置方式:
在MCP客户端配置中添加环境变量:
使用npx:
{
"mcpServers": {
"github-repos-manager": {
"command": "npx",
"args": ["-y", "github-repos-manager-mcp"],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE",
"GH_DEFAULT_OWNER": "octocat",
"GH_DEFAULT_REPO": "Hello-World"
}
}
}
}
使用本地安装:
{
"mcpServers": {
"github-repos-manager": {
"command": "node",
"args": ["/full/path/to/your/project/github-repos-manager-mcp/server.cjs"],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE",
"GH_DEFAULT_OWNER": "octocat",
"GH_DEFAULT_REPO": "Hello-World"
}
}
}
}
直接运行服务器时,可以传递默认仓库设置:
node server.cjs --default-owner octocat --default-repo Hello-World
在会话期间使用 set_default_repo 工具设置或更改默认仓库:
microsoft/vscode"username/my-project"配置优先级(从高到低):
--default-owner, --default-repo)GH_DEFAULT_OWNER, GH_DEFAULT_REPO)set_default_repo)默认仓库的好处:
owner 和 reposet_default_repo 工具更改一旦设置了默认仓库,你可以在命令中省略 owner 和 repo 参数:
你可以使用 GH_ALLOWED_REPOS 环境变量或 --allowed-repos 命令行参数限制服务器可以访问的仓库。这是一项安全功能,确保服务器只能在批准的仓库上操作。
1. 环境变量(用于MCP客户端)
{
"mcpServers": {
"github-repos-manager": {
"command": "node",
"args": ["/path/to/server.cjs"],
"env": {
"GH_TOKEN": "ghp_YOUR_TOKEN",
"GH_ALLOWED_REPOS": "owner1/repo1,owner2/repo2,owner3"
}
}
}
}
2. 命令行参数
node server.cjs --allowed-repos "microsoft/vscode,facebook/react,google"
工作原理:
owner/repo):仅允许该特定仓库owner):允许该所有者的所有仓库示例:
"microsoft/vscode" - 仅允许Microsoft的vscode仓库"kurdin" - 允许kurdin拥有的所有仓库"kurdin,microsoft/vscode,facebook/react" - 允许kurdin的所有仓库以及特定的仓库通过设置 GH_DISABLED_TOOLS 环境变量或使用 --disabled-tools 命令行参数禁用你不希望使用的工具。
为了最大程度的安全,你可以通过设置 GH_ALLOWED_TOOLS 环境变量或使用 --allowed-tools 命令行参数将服务器限制为仅允许特定工具。
重要提示:如果同时设置了 GH_ALLOWED_TOOLS 和 GH_DISABLED_TOOLS,GH_ALLOWED_TOOLS 优先。
使用npx(macOS/Linux):
{
"mcpServers": {
"github-repos-manager": {
"command": "npx",
"args": ["-y", "github-repos-manager-mcp"],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE",
"GH_DEFAULT_OWNER": "mycompany",
"GH_DEFAULT_REPO": "main-project",
"GH_ALLOWED_REPOS": "mycompany,trusted-org/specific-repo",
"GH_ALLOWED_TOOLS": "list_issues,create_issue,list_prs,get_repo_info"
}
}
}
}
使用npx(Windows):
{
"mcpServers": {
"github-repos-manager": {
"command": "npx.cmd",
"args": ["-y", "github-repos-manager-mcp"],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE",
"GH_DEFAULT_OWNER": "mycompany",
"GH_DEFAULT_REPO": "main-project",
"GH_ALLOWED_REPOS": "mycompany,trusted-org/specific-repo",
"GH_ALLOWED_TOOLS": "list_issues,create_issue,list_prs,get_repo_info"
}
}
}
}
使用本地安装:
{
"mcpServers": {
"github-repos-manager": {
"command": "node",
"args": ["/full/path/to/your/project/github-repos-manager-mcp/server.cjs"],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE",
"GH_DEFAULT_OWNER": "mycompany",
"GH_DEFAULT_REPO": "main-project",
"GH_ALLOWED_REPOS": "mycompany,trusted-org/specific-repo",
"GH_ALLOWED_TOOLS": "list_issues,create_issue,list_prs,get_repo_info"
}
}
}
}
命令行等效配置:
node server.cjs \
--default-owner mycompany \
--default-repo main-project \
--allowed-repos "mycompany,trusted-org/specific-repo" \
--allowed-tools "list_issues,create_issue,list_prs,get_repo_info"
这个服务器提供了89个全面的工具,用于完整的GitHub工作流程管理:
create_pull_request:创建一个新的拉取请求,指定标题、正文和分支。
owner (字符串, 可选), repo (字符串, 可选), title (字符串, 必需), body (字符串, 可选), head (字符串, 必需 - 包含更改的分支), base (字符串, 必需 - 目标分支), draft (布尔值, 可选), maintainer_can_modify (布尔值, 可选)edit_pull_request:更新现有拉取请求的标题、正文、状态或基础分支。
owner (字符串, 可选), repo (字符串, 可选), pull_number (整数, 必需), title (字符串, 可选), body (字符串, 可选), state (字符串, 可选 - "open" 或 "closed"), base (字符串, 可选)get_pr_details:获取拉取请求的全面信息,包括状态和合并细节。
owner (字符串, 可选), repo (字符串, 可选), pull_number (整数, 必需)list_pr_reviews:列出拉取请求的所有审查,包括状态和评论。
owner (字符串, 可选), repo (字符串, 可选), pull_number (整数, 必需), per_page (整数, 可选, 默认30)create_pr_review:提交对拉取请求的审查,包括评论和批准状态。
owner (字符串, 可选), repo (字符串, 可选), pull_number (整数, 必需), body (字符串, 可选), event (字符串, 可选 - "APPROVE", "REQUEST_CHANGES", "COMMENT"), comments (数组, 可选)list_pr_files:列出拉取请求中更改的所有文件,包括添加/删除统计信息。
owner (字符串, 可选), repo (字符串, 可选), pull_number (整数, 必需), per_page (整数, 可选, 默认30)create_file:在仓库中创建一个新文件,指定内容和提交消息。
owner (字符串, 可选), repo (字符串, 可选), path (字符串, 必需), content (字符串, 必需), message (字符串, 必需), branch (字符串, 可选), committer (对象, 可选)update_file:使用新提交更新现有文件的内容。
owner (字符串, 可选), repo (字符串, 可选), path (字符串, 必需), content (字符串, 必需), message (字符串, 必需), sha (字符串, 必需 - 当前文件的SHA), branch (字符串, 可选)upload_file:将本地文件上传到仓库(支持二进制文件)。
owner (字符串, 可选), repo (字符串, 可选), local_path (字符串, 必需), repo_path (字符串, 必需), message (字符串, 必需), branch (字符串, 可选)delete_file:从仓库中删除一个文件,指定提交消息。
owner (字符串, 可选), repo (字符串, 可选), path (字符串, 必需), message (字符串, 必需), sha (字符串, 必需 - 当前文件的SHA), branch (字符串, 可选)list_deploy_keys:列出仓库的所有部署密钥及其权限。
owner (字符串, 可选), repo (字符串, 可选), per_page (整数, 可选, 默认30)create_deploy_key:向仓库添加一个新的部署密钥,以实现安全访问。
owner (字符串, 可选), repo (字符串, 可选), title (字符串, 必需), key (字符串, 必需 - 公共SSH密钥), read_only (布尔值, 可选, 默认true)delete_deploy_key:从仓库中删除一个部署密钥。
owner (字符串, 可选), repo (字符串, 可选), key_id (整数, 必需)list_webhooks:列出为仓库配置的所有Webhook。
owner (字符串, 可选), repo (字符串, 可选), per_page (整数, 可选, 默认30)create_webhook:为仓库事件创建一个新的Webhook。
owner (字符串, 可选), repo (字符串, 可选), config (对象, 必需 - url和content_type), events (数组, 可选, 默认 ["push"]), active (布尔值, 可选)edit_webhook:更新Webhook的配置、事件或活动状态。
owner (字符串, 可选), repo (字符串, 可选), hook_id (整数, 必需), config (对象, 可选), events (数组, 可选), active (布尔值, 可选)delete_webhook:从仓库中删除一个Webhook。
owner (字符串, 可选), repo (字符串, 可选), hook_id (整数, 必需)list_secrets:列出仓库的秘密(仅名称,值已加密)。
owner (字符串, 可选), repo (字符串, 可选), per_page (整数, 可选, 默认30)update_secret:为Actions创建或更新仓库的秘密。
owner (字符串, 可选), repo (字符串, 可选), secret_name (字符串, 必需), encrypted_value (字符串, 必需), key_id (字符串, 必需)注意: 这些工具是未来GitHub Actions集成的占位符。
list_workflows:列出仓库中的所有GitHub Actions工作流。list_workflow_runs:列出工作流运行,并支持过滤选项。get_workflow_run_details:获取工作流运行的详细信息。trigger_workflow:手动触发工作流调度事件。download_workflow_artifacts:从工作流运行中下载工件。cancel_workflow_run:取消正在进行的工作流运行。get_repo_stats:获取仓库的全面统计信息,包括贡献者活动。
owner (字符串, 可选), repo (字符串, 可选)list_repo_topics:列出与仓库关联的所有主题(标签)。
owner (字符串, 可选), repo (字符串, 可选)update_repo_topics:更新主题,以提高仓库的发现性。
owner (字符串, 可选), repo (字符串, 可选), names (字符串数组, 必需)get_repo_languages:获取仓库中使用的编程语言及其字节数。
owner (字符串, 可选), repo (字符串, 可选)list_stargazers:列出为仓库加星的用户。
owner (字符串, 可选), repo (字符串, 可选), per_page (整数, 可选, 默认30)list_watchers:列出关注仓库以获取通知的用户。
owner (字符串, 可选), repo (字符串, 可选), per_page (整数, 可选, 默认30)list_forks:列出仓库的所有分叉,并支持排序选项。
owner (字符串, 可选), repo (字符串, 可选), sort (字符串, 可选 - "newest", "oldest", "stargazers"), per_page (整数, 可选)get_repo_traffic:获取仓库的流量数据,包括视图和克隆(需要管理员访问权限)。
owner (字符串, 可选), repo (字符串, 可选)search_issues:在GitHub上搜索问题和拉取请求。
query (字符串, 必需), sort (字符串, 可选 - "comments", "reactions", "interactions", "created", "updated"), order (字符串, 可选 - "asc", "desc"), per_page (整数, 可选)search_commits:在仓库中搜索提交。
query (字符串, 必需), sort (字符串, 可选 - "author-date", "committer-date"), order (字符串, 可选), per_page (整数, 可选)search_code:在GitHub仓库中搜索代码。
query (字符串, 必需), sort (字符串, 可选 - "indexed"), order (字符串, 可选), per_page (整数, 可选)search_users:搜索用户和组织。
query (字符串, 必需), sort (字符串, 可选 - "followers", "repositories", "joined"), order (字符串, 可选), per_page (整数, 可选)search_topics:搜索仓库主题。
query (字符串, 必需), per_page (整数, 可选, 默认30)list_org_repos:列出组织中的所有仓库。
org (字符串, 必需), type (字符串, 可选 - "all", "public", "private", "forks", "sources", "member"), sort (字符串, 可选), per_page (整数, 可选)list_org_members:列出组织的成员。
org (字符串, 必需), filter (字符串, 可选 - "2fa_disabled", "all"), role (字符串, 可选 - "all", "admin", "member"), per_page (整数, 可选)get_org_info:获取组织的详细信息。
org (字符串, 必需)list_org_teams:列出组织中的所有团队。
org (字符串, 必需), per_page (整数, 可选, 默认30)get_team_members:列出特定团队的成员。
org (字符串, 必需), team_slug (字符串, 必需), role (字符串, 可选 - "member", "maintainer", "all"), per_page (整数, 可选)manage_team_repos:为团队添加或删除仓库访问权限。
org (字符串, 必需), team_slug (字符串, 必需), owner (字符串, 必需), repo (字符串, 必需), permission (字符串, 可选 - "pull", "push", "admin"), action (字符串, 必需 - "add" 或 "remove")注意: 其中一些工具是未来增强功能的占位符。
list_repo_projects:列出仓库项目(经典项目)。code_quality_checks:未来代码质量分析的占位符。custom_dashboards:自定义仪表板创建的占位符。automated_reporting:自动报告生成的占位符。notification_management:通知设置的占位符。release_management:版本管理功能的占位符。dependency_analysis:依赖扫描的占位符。set_default_repo:为后续命令设置默认的所有者和仓库,以简化工作流程。
owner (字符串, 必需), repo (字符串, 必需)list_repos:列出经过身份验证的用户的GitHub仓库,并支持高级过滤。
per_page (数字, 可选, 默认10, 最大100), visibility (字符串, 可选, 枚举: "all", "public", "private", 默认 "all"), sort (字符串, 可选, 枚举: "created", "updated", "pushed", "full_name", 默认 "updated")get_repo_info:获取特定仓库的全面信息,包括统计数据和元数据。
owner (字符串, 必需, 如果没有默认值), repo (字符串, 必需, 如果没有默认值)search_repos:在GitHub上搜索仓库,并支持高级排序选项。
query (字符串, 必需), per_page (数字, 可选, 默认10, 最大100), sort (字符串, 可选, 枚举: "stars", "forks", "help-wanted-issues", "updated", 默认 "stars")get_repo_contents:浏览任何仓库中的文件和目录,并支持分支/提交。
owner (字符串, 必需, 如果没有默认值), repo (字符串, 必需, 如果没有默认值), path (字符串, 可选, 默认 ""), ref (字符串, 可选, 例如分支名称或提交SHA)list_issues:列出问题,并支持按状态过滤和全面的分页。
owner (字符串, 必需, 如果没有默认值), repo (字符串, 必需, 如果没有默认值), state (字符串, 可选, 枚举: "open", "closed", "all", 默认 "open"), per_page (数字, 可选, 默认10, 最大100)create_issue:创建功能丰富的问题,支持图像上传、标签和受让人。
owner (字符串, 必需, 如果没有默认值), repo (字符串, 必需, 如果没有默认值), title (字符串, 必需), body (字符串, 可选), image_path (字符串, 可选, 本地图像的完整路径), labels (字符串数组, 可选), assignees (字符串数组, 可选)edit_issue:修改现有问题,包括标题、正文、状态、标签、受让人以及图像上传。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需), title (字符串, 可选), body (字符串, 可选), state (字符串, 可选, 枚举: "open", "closed"), image_path (字符串, 可选, 本地图像的完整路径), labels (字符串数组, 可选), assignees (字符串数组, 可选)get_issue_details:获取任何特定问题的全面信息。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需)lock_issue:锁定问题,防止进一步评论,并支持自定义原因。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需), lock_reason (字符串, 可选, 枚举: "off-topic", "too heated", "resolved", "spam")unlock_issue:解锁之前锁定的问题,恢复讨论。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需)add_assignees_to_issue:为问题添加一个或多个团队成员。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需), assignees (字符串数组, 必需)remove_assignees_from_issue:从问题中移除受让人,以更好地管理任务。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需), assignees (字符串数组, 必需)list_issue_comments:列出问题的所有评论,并支持时间戳过滤。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需), per_page (整数, 可选, 默认30, 最大100), since (字符串, 可选, ISO 8601格式的日期时间)create_issue_comment:在正在进行的问题讨论中添加新评论。
owner (字符串, 可选), repo (字符串, 可选), issue_number (整数, 必需), body (字符串, 必需)edit_issue_comment:修改现有评论,进行更正或更新。
owner (字符串, 可选), repo (字符串, 可选), comment_id (整数, 必需), body (字符串, 必需)delete_issue_comment:在必要时删除评论,以进行内容管理。
owner (字符串, 可选), repo (字符串, 可选), comment_id (整数, 必需)list_prs:列出拉取请求,并支持状态过滤和分页。
owner (字符串, 必需, 如果没有默认值), repo (字符串, 必需, 如果没有默认值), state (字符串, 可选, 枚举: "open", "closed", "all", 默认 "open"), per_page (数字, 可选, 默认10, 最大100)list_branches:列出仓库中的所有分支,并显示其保护状态和提交信息。
owner (字符串, 可选), repo (字符串, 可选), protected_only (布尔值, 可选, 默认false), per_page (数字, 可选, 默认30)create_branch:从现有分支或提交创建一个新分支。
owner (字符串, 可选), repo (字符串, 可选), branch_name (字符串, 必需), from_branch (字符串, 可选, 默认仓库的默认分支)list_commits:列出仓库中的提交,并提供详细信息和过滤选项。
owner (字符串, 可选), repo (字符串, 可选), sha (字符串, 可选, 要列出的分支/标签/提交), per_page (数字, 可选, 默认20), since (字符串, 可选, ISO 8601日期时间), until (字符串, 可选, ISO 8601日期时间), author (字符串, 可选, GitHub用户名或电子邮件)get_commit_details:获取特定提交的详细信息,包括文件更改。
owner (字符串, 可选), repo (字符串, 可选), commit_sha (字符串, 必需)compare_commits:比较两个提交或分支,查看差异。
owner (字符串, 可选), repo (字符串, 可选), base (字符串, 必需, 基础分支或提交SHA), head (字符串, 必需, 头部分支或提交SHA)get_user_info:获取任何GitHub用户或你自己的详细信息。
username (字符串, 可选 - 默认经过身份验证的用户)list_repo_collaborators:列出仓库的协作者,并支持基于权限的过滤。
owner (字符串, 可选), repo (字符串, 可选), affiliation (字符串, 可选, 枚举: "outside", "direct", "all", 默认 "all"), permission (字符串, 可选, 枚举: "pull", "triage", "push", "maintain", "admin"), per_page (整数, 可选, 默认30, 最大100)list_repo_labels:列出仓库中的所有标签及其颜色和描述。
owner (字符串, 可选), repo (字符串, 可选), per_page (整数, 可选, 默认30, 最大100)create_label:创建自定义标签,指定颜色和描述,以更好地组织问题。
owner (字符串, 可选), repo (字符串, 可选), name (字符串, 必需), color (字符串, 可选, 不带#的十六进制颜色, 默认 "f29513"), description (字符串, 可选)edit_label:修改现有标签的属性,包括名称、颜色和描述。
owner (字符串, 可选), repo (字符串, 可选), current_name (字符串, 必需), name (字符串, 可选), color (字符串, 可选, 不带#的十六进制颜色), description (字符串, 可选)delete_label:在不再需要时从仓库中删除标签。
owner (字符串, 可选), repo (字符串, 可选), name (字符串, 必需)list_milestones:列出仓库的里程碑,并支持按状态过滤和排序选项。
owner (字符串, 可选), repo (字符串, 可选), state (字符串, 可选, 枚举: "open", "closed", "all", 默认 "open"), sort (字符串, 可选, 枚举: "due_on", "completeness", 默认 "due_on"), direction (字符串, 可选, 枚举: "asc", "desc", 默认 "asc"), per_page (整数, 可选, 默认30, 最大100)create_milestone:创建新的里程碑,指定截止日期,用于项目规划。
owner (字符串, 可选), repo (字符串, 可选), title (字符串, 必需), state (字符串, 可选, 枚举: "open", "closed", 默认 "open"), description (字符串, 可选), due_on (字符串, 可选, ISO 8601日期时间格式)edit_milestone:更新里程碑的详细信息,包括标题、描述、状态和截止日期。
owner (字符串, 可选), repo (字符串, 可选), milestone_number (整数, 必需), title (字符串, 可选), state (字符串, 可选, 枚举: "open", "closed"), description (字符串, 可选), due_on (字符串, 可选, ISO 8601日期时间格式)delete_milestone:在不再需要时从仓库中删除里程碑。
owner (字符串, 可选), repo (字符串, 可选), milestone_number (整数, 必需)令牌问题:
GH_TOKEN 值是否正确,没有拼写错误export TEMP_TOKEN="ghp_YOUR_TOKEN_TO_TEST"
curl -H "Authorization: token $TEMP_TOKEN" https://api.github.com/user
unset TEMP_TOKEN
这应该返回你的GitHub用户信息。配置问题:
GH_TOKEN 是否正确放置在MCP客户端服务器配置的 env 对象中server.cjs 的路径是绝对且正确的node --versionGH_DEFAULT_OWNER 和 GH_DEFAULT_REPO 环境变量,验证它们是否正确且仓库存在权限问题:
repo 或 public_repo(用于仓库访问)user(用于用户信息)read:org(如果需要访问组织信息)GH_DEFAULT_OWNER 和 GH_DEFAULT_REPO 的拼写--default-owner 和 --default-repo 标志时语法正确set_default_repo 工具中使用准确的仓库名称:owner/repo 格式server.cjs 是可执行的:chmod +x server.cjsGH_TOKEN 提交到版本控制或公开共享env 块提供令牌# 克隆并设置
mkdir github-repos-manager-mcp
cd github-repos-manager-mcp
# 添加服务器文件
npm install
chmod +x server.cjs
# 使用nodemon进行开发测试
npm run dev
推荐的方法是配置你的MCP客户端(如Claude Desktop)指向你的开发版本,并正确配置 GH_TOKEN。对 server.cjs 的更改需要重新启动服务器连接。
# 临时设置令牌以进行快速验证
export GH_TOKEN="ghp_YOUR_DEVELOPMENT_TOKEN"
node server.cjs
unset GH_TOKEN # 测试后始终清理
本MCP服务器采用MIT许可证,你可以自由使用、修改和分发。