Github Pr Mcp Server

Github Pr Mcp Server

🚀 GitHub PR 机器人管理服务器

GitHub PR 机器人管理服务器可帮助用户高效地创建、管理 Pull Request,提供基础和增强功能,提升开发协作效率。

🚀 快速开始

在使用 GitHub PR 机器人管理服务器之前,你需要完成安装和配置。

📦 安装指南

前提条件

  • Node.js 18+
  • npm 或 yarn
  • Git
  • GitHub 账户及个人访问令牌

全局安装

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

高级用法

create_pull_request

创建带增强功能的 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[];// 负责人
}

list_pull_requests

列出仓库中的 Pull Request:

{
owner: string; // 所有者
repo: string;  // 仓库名称
}

update_pull_request

更新 Pull Request:

{
owner: string;         // 所有者
repo: string;          // 仓库名称
pullRequestId: number; // Pull Request ID
title?: string;        // 新标题(可选)
body?: string;         // 新描述(可选)
labels?: string[];// 新标签(可选)
}

✨ 主要特性

核心功能

  1. 创建 Pull Request
    • 提供基础和增强功能,包括代码高亮、测试报告等。
  2. 管理 Pull Request
    • 列出、更新及关闭 Pull Request。

可用工具

提供了 create_pull_requestlist_pull_requestsupdate_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

贡献指南

提交代码

  1. 创建功能分支:git checkout -b feature/your-feature
  2. 提交更改:git commit -m "feat: 添加新功能"
  3. 推送到远程仓库:git push origin feature/your-feature

提交 Pull Request

  • 在GitHub仓库中提交Pull Request。
  • 包含详细的变更说明。

项目结构

github-pr-mcp/
├── src/                 # 源代码目录
│   ├── server.js        # 主服务器文件
│   └── config.js       # 配置管理
├── package.json         # 依赖管理
└── README.md            # 项目文档

📄 许可证

本项目采用 MIT License。

📞 联系方式

  • 0 关注
  • 0 收藏,12 浏览
  • system 提出于 2025-09-27 15:57

相似服务问题