概述
安裝
內容詳情
替代品
什麼是GitHub Repos Manager MCP服務器?
這是一個Model Context Protocol (MCP)服務器,允許您通過GitHub個人訪問令牌(PAT)與GitHub倉庫進行交互。它簡化了GitHub倉庫管理,避免了Docker的複雜性,直接使用GitHub API進行操作。如何使用GitHub Repos Manager MCP服務器?
只需提供一個GitHub個人訪問令牌,即可快速啟動並運行該服務器。您可以使用命令行或集成到MCP客戶端中,如Claude Desktop、Roo Code等。適用場景
適用於需要頻繁管理GitHub倉庫、創建和維護問題、拉取請求以及協作開發的開發者和團隊。主要功能
如何使用
使用案例
常見問題
相關資源
安裝
{
"mcpServers": {
"github-repos-manager": {
"command": "npx",
"args": [
"-y",
"github-repos-manager-mcp"
],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE"
}
}
}
}
{
"mcpServers": {
"github-repos-manager": {
"command": "npx.cmd",
"args": [
"-y",
"github-repos-manager-mcp"
],
"env": {
"GH_TOKEN": "ghp_YOUR_ACTUAL_TOKEN_HERE"
}
}
}
}
{
"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"
}
}
}
}
{
"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"
}
}
}
}
{
"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"
}
}
}
}
{
"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"
}
}
}
}
{
"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"
}
}
}
}🚀 GitHub Repos Manager MCP Server
這是一個全面的模型上下文協議(MCP)服務器,允許你的MCP客戶端(如Claude Desktop、Roo Code、Cline、Cursor、Windsurf等)使用你的GitHub個人訪問令牌與GitHub倉庫進行交互。它基於令牌實現了GitHub自動化管理,無需Docker以實現最佳性能,並且提供靈活的配置,支持細粒度控制,擁有89個可直接集成API的工具。
🚀 快速開始
前提條件
- Node.js(版本18或更高)
- GitHub個人訪問令牌(PAT):這是唯一需要配置的內容。你可以前往GitHub → 設置 → 開發者設置 → 個人訪問令牌 → 令牌(經典)或細粒度令牌,生成一個至少具有以下作用域的新令牌:
repo(對私有倉庫的完全控制):推薦用於完整功能。user:read或user:email(用於讀取用戶個人資料數據)。read:org(如果你需要訪問組織信息)。
快速設置和MCP客戶端配置
使用npx(最簡單 - 無需安裝!)
確保你已安裝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 的示例文件位置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json(路徑可能會有所不同)
✨ 主要特性
相較於其他GitHub自動化MCP服務器的關鍵優勢
🎯 簡單性:基於令牌的訪問消除了複雜性。 🌿 高效性:無需Docker,確保輕量級和最佳性能。 💪 強大功能:89個可直接集成API的工具提供了無與倫比的靈活性。 🔒 靈活性:可配置的工具支持細粒度控制。
簡單的設置和操作
✅ 無需Docker - 一個簡單的Node.js服務器,可以在任何地方運行
✅ 單令牌設置 - 僅需一個GitHub個人訪問令牌即可工作
✅ 直接API集成 - 不依賴 gh CLI,更快、更可靠
✅ 零配置 - 只需令牌即可開箱即用
高級安全和控制
✅ 允許的倉庫 - 將操作限制在特定的倉庫或所有者範圍內 ✅ 工具管理 - 啟用/禁用特定工具以進行細粒度控制 ✅ 默認倉庫 - 設置默認倉庫以簡化工作流程 ✅ 靈活的權限 - 精確配置服務器可以訪問的內容
強大的功能
✅ 全面的工具包 - 89個強大的工具,可實現完整的GitHub工作流程 ✅ 分支和提交管理 - 創建分支、查看歷史記錄、比較更改 ✅ 圖像上傳支持 - 直接在問題中上傳和嵌入圖像 ✅ 高級過濾 - 支持多種條件的排序、過濾和搜索 ✅ 速率限制處理 - 內置GitHub API速率限制管理
📦 安裝指南
最低要求 - 就這麼簡單!
- Node.js(版本18或更高)
- GitHub個人訪問令牌(PAT):這是唯一需要的配置。你可以前往GitHub → 設置 → 開發者設置 → 個人訪問令牌 → 令牌(經典)或細粒度令牌,生成一個至少具有以下作用域的新令牌:
repo(對私有倉庫的完全控制):推薦用於完整功能。user:read或user:email(用於讀取用戶個人資料數據)。read:org(如果你需要訪問組織信息)。- 重要提示:請安全地存儲此令牌,你需要在MCP客戶端的配置中直接提供它。
💻 使用示例
基礎用法
配置完成後,你可以讓你的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'."
📚 詳細文檔
完整的功能集
倉庫管理
- 智能倉庫列表:支持按可見性(公共/私有/全部)過濾和排序選項
- 詳細的倉庫信息:包括統計數據、URL和元數據
- 文件和目錄瀏覽:支持特定分支/提交
- 倉庫搜索:支持在整個GitHub上進行高級排序搜索
- 默認倉庫設置:簡化工作流程
高級問題管理
- 完整的問題生命週期 - 創建、編輯、列出和管理狀態
- 豐富的內容支持 - 直接在問題中上傳和嵌入圖像
- 標籤管理 - 添加、刪除和組織自定義標籤
- 受讓人管理 - 分配/取消分配團隊成員
- 問題鎖定/解鎖:支持自定義原因
- 評論系統 - 創建、編輯、刪除和列出問題評論
- 狀態管理 - 打開、關閉和跟蹤問題進度
拉取請求管理
- 拉取請求列表:支持狀態過濾和排序
- 全面的PR信息:包括分支詳細信息和狀態
分支和提交管理
- 分支操作 - 列出所有分支及其保護狀態和最新提交
- 分支創建 - 從現有分支或提交創建新分支
- 提交歷史 - 支持高級過濾(日期、作者、分支)查看提交歷史
- 提交詳情 - 獲取包括文件更改在內的全面提交信息
- 提交比較 - 比較任意兩個提交、分支或標籤以查看差異
協作和用戶管理
- 任何GitHub用戶或你自己賬戶的用戶資料信息
- 倉庫協作者管理:支持權限過濾
- 團隊協作工具:用於管理訪問和權限
高級功能
- 圖像上傳和嵌入 - 直接將本地圖像上傳到GitHub
- 批量操作 - 管理多個受讓人、標籤和評論
- 靈活的身份驗證 - 基於安全令牌的GitHub API訪問
- 智能錯誤處理 - 全面的錯誤報告和恢復
配置選項
默認倉庫設置
你可以設置默認倉庫以簡化工作流程,避免在每個命令中都指定 owner 和 repo。有三種配置方式:
1. 環境變量(推薦用於MCP客戶端)
在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"
}
}
}
}
2. 命令行參數
直接運行服務器時,可以傳遞默認倉庫設置:
node server.cjs --default-owner octocat --default-repo Hello-World
3. 運行時工具調用
在會話期間使用 set_default_repo 工具設置或更改默認倉庫:
- "Set default repository to
microsoft/vscode" - "Change the default to my own repo
username/my-project"
配置優先級(從高到低):
- 命令行參數 (
--default-owner,--default-repo) - 環境變量 (
GH_DEFAULT_OWNER,GH_DEFAULT_REPO) - 運行時工具調用 (
set_default_repo)
默認倉庫的好處:
- 無需在每個命令中指定
owner和repo - 主要處理一個倉庫時簡化工作流程
- 可以在會話期間隨時使用
set_default_repo工具更改 - 可選 - 所有工具在未設置默認倉庫的情況下也能工作
一旦設置了默認倉庫,你可以在命令中省略 owner 和 repo 參數:
- 之前:"List issues for microsoft/vscode"
- 之後:"List issues"(在將microsoft/vscode設置為默認倉庫後)
倉庫訪問控制
你可以使用 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和工作流
注意: 這些工具是未來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(整數, 必需)
- 參數:
🔧 技術細節
故障排除
身份驗證問題
-
令牌問題:
- 仔細檢查MCP客戶端配置中的
GH_TOKEN值是否正確,沒有拼寫錯誤 - 確保令牌未過期或被撤銷
- 使用curl驗證令牌有效性:
這應該返回你的GitHub用戶信息。export TEMP_TOKEN="ghp_YOUR_TOKEN_TO_TEST" curl -H "Authorization: token $TEMP_TOKEN" https://api.github.com/user unset TEMP_TOKEN
- 仔細檢查MCP客戶端配置中的
-
配置問題:
- 驗證
GH_TOKEN是否正確放置在MCP客戶端服務器配置的env對象中 - 確保
server.cjs的路徑是絕對且正確的 - 檢查Node.js版本是否為18或更高:
node --version - 默認倉庫:如果你設置了
GH_DEFAULT_OWNER和GH_DEFAULT_REPO環境變量,驗證它們是否正確且倉庫存在
- 驗證
-
權限問題:
- 確保你的令牌具有所需的作用域:
repo或public_repo(用於倉庫訪問)user(用於用戶信息)read:org(如果需要訪問組織信息)
- 默認倉庫訪問:如果使用默認倉庫,確保你的令牌可以訪問該特定倉庫
- 確保你的令牌具有所需的作用域:
默認倉庫配置問題
- 環境變量不生效:仔細檢查MCP客戶端配置中
GH_DEFAULT_OWNER和GH_DEFAULT_REPO的拼寫 - 命令行參數:確保使用
--default-owner和--default-repo標誌時語法正確 - 工具調用問題:在
set_default_repo工具中使用準確的倉庫名稱:owner/repo格式 - 覆蓋行為:請記住,運行時工具調用可以覆蓋環境變量,而命令行參數可以覆蓋兩者
性能和速率限制
- GitHub API速率限制:經過身份驗證的用戶每小時允許5000個請求
- 如果達到限制,請等待重置窗口或使用不同的令牌
- 服務器包含內置的速率限制錯誤處理
常見設置問題
- 路徑問題:驗證Claude Desktop配置中的絕對路徑是否正確
- Node.js版本:確保使用的是Node.js 18或更高版本
- 文件權限:確保
server.cjs是可執行的:chmod +x server.cjs
圖像上傳故障排除
- 確保圖像文件存在於指定的本地路徑
- 支持的格式:PNG、JPG、JPEG、GIF、WebP
- 檢查文件權限和可訪問性
- 驗證文件未損壞或過大(GitHub有大小限制)
API速率限制和性能
- 標準速率限制:GitHub API允許經過身份驗證的用戶每小時進行5000次請求
- 內置處理:服務器包含全面的速率限制響應錯誤處理
- 性能優化:直接的HTTP請求確保比CLI工具更快的響應時間
- 緩存建議:考慮為頻繁訪問的數據實施緩存策略
安全最佳實踐
- 令牌安全:切勿將你的
GH_TOKEN提交到版本控制或公開共享 - 最小權限:使用僅具有你的用例所需最小作用域的令牌
- 環境變量:始終通過MCP客戶端配置中的
env塊提供令牌 - 令牌輪換:定期輪換你的GitHub令牌以增強安全性
- 安全存儲:使用系統的憑證管理安全地存儲令牌
開發和貢獻
本地開發設置
# 克隆並設置
mkdir github-repos-manager-mcp
cd github-repos-manager-mcp
# 添加服務器文件
npm install
chmod +x server.cjs
# 使用nodemon進行開發測試
npm run dev
使用MCP客戶端進行測試
推薦的方法是配置你的MCP客戶端(如Claude Desktop)指向你的開發版本,並正確配置 GH_TOKEN。對 server.cjs 的更改需要重新啟動服務器連接。
直接腳本測試
# 臨時設置令牌以進行快速驗證
export GH_TOKEN="ghp_YOUR_DEVELOPMENT_TOKEN"
node server.cjs
unset GH_TOKEN # 測試後始終清理
📄 許可證
本MCP服務器採用MIT許可證,你可以自由使用、修改和分發。
替代品








