GitHub PR 机器人管理服务器可帮助用户高效地创建、管理 Pull Request,提供基础和增强功能,提升开发协作效率。
在使用 GitHub PR 机器人管理服务器之前,你需要完成安装和配置。
npm install -g github-pr-mcp
github-pr-mcp start
// config.json
{
"servers": [
{
"name": "github",
"type": "github",
"token": "your_github_token"
},
{
"name": "github-pr",
"type": "github-pr",
"token": "your_github_token",
"enhancedFeatures": true
}
]
}
github-pr-mcp start --config config.json
创建带增强功能的 Pull Request:
{
// 必填字段(兼容基础功能)
owner: string; // 所有者
repo: string; // 仓库名称
title: string; // 标题
head: string; // 分支名(例如:feature-branch)
base: string; // 基础分支(例如:main)
// 可选字段(兼容基础功能)
body?: string; // 描述
draft?: boolean; // 是否为草稿
maintainer_can_modify?: boolean; // 维护者是否可以修改
// 增强功能字段
overview?: string; // 概要
keyChanges?: string[];// 关键变更点
codeHighlights?: string[];// 代码高亮部分
testing?: string[];// 测试报告
links?: Array<{ title: string; url: string }>; // 链接列表
additionalNotes?: string; // 补充说明
issueIds?: string[];// 关联的Issue ID
checklist?: {
adhereToConventions?: boolean; // 是否符合规范
testsIncluded?: boolean; // 是否包含测试
documentationUpdated?: boolean; // 文档是否更新
changesVerified?: boolean; // 变更是否验证
screenshotsAttached?: boolean; // 截图是否上传
};
attachments?: Array<{
type: "image" | "video" | "diagram"; // 类型
alt: string; // 替代文本
url: string; // 链接
width?: number; // 宽度(可选)
}>;
labels?: string[];// 标签
reviewers?: string[];// 审查人
assignees?: string[];// 负责人
}
列出仓库中的 Pull Request:
{
owner: string; // 所有者
repo: string; // 仓库名称
}
更新 Pull Request:
{
owner: string; // 所有者
repo: string; // 仓库名称
pullRequestId: number; // Pull Request ID
title?: string; // 新标题(可选)
body?: string; // 新描述(可选)
labels?: string[];// 新标签(可选)
}
提供了 create_pull_request
、list_pull_requests
、update_pull_request
等工具,满足不同场景下的 Pull Request 操作需求。
git clone https://github.com/yourusername/github-pr-mcp.git
cd github-pr-mcp
npm install
npm run dev
npm run build
npm test
npm run integration-test
git checkout -b feature/your-feature
git commit -m "feat: 添加新功能"
git push origin feature/your-feature
github-pr-mcp/
├── src/ # 源代码目录
│ ├── server.js # 主服务器文件
│ └── config.js # 配置管理
├── package.json # 依赖管理
└── README.md # 项目文档
本项目采用 MIT License。