
GitHub PR Helper
An MCP service that enables creating GitHub Pull Requests and adding code review comments using GitHub CLI, eliminating the need to manually handle authentication and permissions.
README
GitHub PR Helper
這是一個 GitHub Pull Request 創建工具 MCP Service,使用 GitHub CLI (gh
) 命令行工具來創建 PR 和進行代碼審查,無需手動處理權限問題。
功能
該服務提供以下功能:
-
創建 GitHub Pull Request:根據提供的標題、描述、票號和目標分支,自動創建 GitHub PR。PR 標題將由 "標題 [票號]" 組成,PR 描述將由 PR 標題和描述組成。
-
Code Review:在 PR 添加評論,方便進行代碼審查。
前置條件
-
安裝 GitHub CLI:
- macOS:
brew install gh
- Windows:
winget install --id GitHub.cli
- Linux: 參考 GitHub CLI 官方文檔
- macOS:
-
登入 GitHub CLI:
gh auth login
按照提示完成登入流程。這將自動處理身份驗證,無需手動管理 token。
安裝與設定
-
安裝依賴:
npm install
-
配置環境變數(可選): 在
.env
檔案中設定以下變數:PORT
:服務器端口(預設為 3000)
使用方式
HTTP 服務
開發模式
npm run dev
生產模式
npm start
MCP 服務
npm run mcp
API 端點
HTTP API
-
POST /api/github/pr
:創建 GitHub Pull Request- 請求體:
{ "repoPath": "本地 Git 倉庫路徑", "title": "PR 標題", "description": "PR 描述", "ticketNumber": "票號", "baseBranch": "目標分支" }
- 請求體:
-
POST /api/github/pr/comment
:在 PR 添加評論- 請求體:
{ "repoPath": "本地 Git 倉庫路徑", "baseBranch": "比較的基準分支", "filePath": "文件路徑", "lineNumber": 10, "comment": "評論內容" }
- 請求體:
MCP 工具
-
create_pull_request
:創建 GitHub Pull Request- 參數:
repoPath
:本地 Git 倉庫路徑title
:PR 標題description
:PR 描述ticketNumber
:票號baseBranch
:目標分支
- 參數:
-
add_pr_comment
:在 PR 添加評論- 參數:
repoPath
:本地 Git 倉庫路徑baseBranch
:比較的基準分支filePath
:文件路徑lineNumber
:行號comment
:評論內容
- 參數:
安裝到 AI 助手
安裝到 Roo Code (VSCode)
-
確保已經安裝並設定好 Roo Code 擴充功能。
-
找到 Roo Code 的 MCP 設定檔案:
/Users/aaron/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
-
編輯該檔案,在
mcpServers
物件中添加以下配置:"github-pr-helper": { "command": "node", "args": ["/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"], "disabled": false, "alwaysAllow": [] }
-
儲存檔案後,重新啟動 VSCode。
-
在 Roo Code 中,你現在應該可以使用
create_pull_request
和add_pr_comment
工具。
安裝到 Claude (Anthropic)
-
找到 Claude 的設定檔案:
/Users/aaron/Library/Application Support/Claude/claude_desktop_config.json
-
編輯該檔案,在
mcpServers
物件中添加以下配置:"github-pr-helper": { "command": "node", "args": ["/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"], "disabled": false, "alwaysAllow": [] }
-
儲存檔案後,重新啟動 Claude 應用程式。
-
在 Claude 中,你現在應該可以使用
create_pull_request
和add_pr_comment
工具。
安裝到 Windsurf
-
找到 Winsurf 的設定檔案,通常位於:
/Users/aaron/Library/Application Support/Winsurf/winsurf_config.json
如果找不到這個檔案,可以嘗試搜尋:
find ~/Library/Application\ Support -name "*winsurf*" -type f
-
編輯該檔案,在
mcpServers
物件中添加以下配置:"github-pr-helper": { "command": "node", "args": ["/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"], "disabled": false, "alwaysAllow": [] }
-
如果
mcpServers
物件不存在,則需要創建它:{ "mcpServers": { "github-pr-helper": { "command": "node", "args": ["/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"], "disabled": false, "alwaysAllow": [] } } }
-
儲存檔案後,重新啟動 Winsurf。
-
在 Winsurf 中,你現在應該可以使用
create_pull_request
和add_pr_comment
工具。
安裝到 Cursor
方法一:通過 GUI 設定(推薦)
-
在 Cursor 中,打開設定頁面。
-
找到 MCP 服務設定區域,點擊添加新服務。
-
填寫以下欄位:
- Name:
github-pr-helper
(服務名稱) - Type:
command
(選擇命令類型) - Command:
node /Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js
(MCP 服務路徑)
- Name:
-
儲存設定後,重新啟動 Cursor。
-
在 Cursor 中,你現在應該可以使用
create_pull_request
和add_pr_comment
工具。
方法二:通過編輯設定檔案
-
找到 Cursor 的設定檔案:
/Users/aaron/Library/Application Support/Cursor/User/settings.json
-
編輯該檔案,添加或修改
cursor.experimental.mcp.servers
設定:"cursor.experimental.mcp.servers": { "github-pr-helper": { "command": "node", "args": ["/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"], "disabled": false, "alwaysAllow": [] } }
-
儲存檔案後,重新啟動 Cursor。
-
在 Cursor 中,你現在應該可以使用
create_pull_request
和add_pr_comment
工具。
使用範例
在 AI 助手中,你可以使用以下提示來創建 GitHub PR:
請使用 create_pull_request 工具創建 GitHub Pull Request。
參數:
{
"repoPath": "/path/to/your/repo",
"title": "實現新功能",
"description": "這個 PR 實現了新功能,包括...",
"ticketNumber": "JIRA-123",
"baseBranch": "main"
}
你也可以使用以下提示在 PR 添加評論:
請使用 add_pr_comment 工具在 PR 添加評論。
參數:
{
"repoPath": "/path/to/your/repo",
"baseBranch": "main",
"filePath": "src/index.js",
"lineNumber": 42,
"comment": "這裡可以使用更簡潔的寫法"
}
注意事項
-
使用此工具前,請確保你已經:
- 使用
gh auth login
登入 GitHub CLI - 在本地 Git 倉庫中創建並切換到了你想要提交 PR 的分支
- 已經提交了所有更改
- 已經將分支推送到遠程倉庫
- 使用
-
此工具使用 GitHub CLI (
gh
) 來處理 GitHub 相關操作,無需手動管理 token,大大簡化了權限管理。 -
如果遇到權限問題,請確保你已經正確登入 GitHub CLI,可以通過以下命令檢查登入狀態:
gh auth status
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.