Token导航 LogoToken导航TokenDH.com
GitHub Pr Automation MCP logo
开发工具未说明官方级别未说明来源级核验

GitHub Pr Automation MCP

MCP Server

一个提供AI辅助的GitHub Pull Request自动化管理工具,包括测试失败分析、评论解决、堆叠PR管理和工作流优化等功能。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
开发工具TypeScriptClaudeCI/CDClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jmalicki

提供方

jmalicki

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

GitHub公关自动化

MCP(模型上下文协议)服务器和CLI,为自动化GitHub Pull Request管理提供AI辅助工具,包括测试失败分析、评论解析、堆叠PR管理和工作流优化。

🚀 快速开始

# Install and use the CLI
git clone https://github.com/jmalicki/github-pr-automation-mcp.git
cd github-pr-automation-mcp
npm install && npm run build
npm run install:cli:npm-link

# Set your GitHub token
export GITHUB_TOKEN="your_token_here"

# Use the CLI
github-pr-automation get-failing-tests --pr "owner/repo#123"

或用作MCP服务器 与Claude Desktop合作,进行人工智能辅助的公关管理。

特性

核心工具

  1. get_failing_tests -分析PR CI故障并获得有针对性的修复说明

- 从PR检查中获取失败的测试信息 - 等待CI完成或立即返回的选项 - 可以放弃第一次失败以获得更快的反馈 - 对大型测试套件的分页支持 - 返回可操作的修复说明

  1. find_unresolved_comments -查找并管理未解决的公关评论

- 识别未解决的审查意见和对话 - :分析审查机构,从人工智能工具(CodeRabbit等)中提取可操作的建议 - 机器人评论的可选过滤(例如,@coderabbitai) - 生成响应命令以实现高效解决 - 总结需要人类判断的评论 - 具有可配置页面大小的分页

  1. manage_stacked_prs -自动化堆叠式PR管理

- 验证PR之间的依赖链 - 检测何时需要传播基础PR更改 - 生成重基指令和自动化命令 - 与集成 get_failing_tests 用于自动修复循环 - 带分页的批处理命令生成

其他工具

  1. detect_merge_conflicts -主动冲突检测

- 在尝试合并之前检查合并冲突 - 提供文件级冲突详细信息 - 建议冲突解决策略

  1. check_merge_readiness -全面的PR健康检查

- 验证所有合并要求 - 检查CI状态、批准、分支保护规则 - 报告缺失的要求,并采取可操作的步骤

  1. rebase_after_squash_merge -上游挤压合并后清理基础

- 处理上游PR被挤压合并的情况 - 用途 git rebase --onto 跳过上游提交 - 只重设你的提交,避免冲突 - 自动检测哪些提交是跳过还是重基

  1. resolve_review_thread -解决特定的审核线程

- 解决个人评论或评论 - 支持线程ID和评论ID定位 - 无需人工干预即可立即解决

需求

  • Node.js v20或更高版本 -所需的最低版本(建议使用v22 LTS)
  • GitHub代币 -设置 GITHUB_TOKEN API访问的环境变量
  • Git -堆叠PR管理中git操作所需

Node.js版本管理

此项目默认配置为使用Node.js v22 LTS:

  • CI/CD -所有GitHub Actions工作流都使用Node.js v22
  • engines 领域 -NPM将警告版本不匹配(最低v20)

安装

快速开始

# Clone the repository
git clone https://github.com/jmalicki/github-pr-automation-mcp.git
cd github-pr-automation-mcp

# Install dependencies
npm install

# Build the project
npm run build

CLI安装

安装CLI以在系统范围内使用:

# Method 1: NPM Link (Recommended)
npm run install:cli:npm-link

# Method 2: Global Installation
npm run install:cli:global

# Method 3: Interactive Installer
npm run install:cli

验证安装:

# Test the CLI
github-pr-automation --help

# Test a specific command
github-pr-automation get-failing-tests --help

卸载:

# NPM Link
npm unlink github-pr-automation

# Global
npm uninstall -g github-pr-automation

有关详细的安装选项,请参阅 CLI安装指南.

运作原理

这是一个 MCP(模型上下文协议)服务器 它通过 标准 (非HTTP):

  • 没有HTTP服务器 -通过stdin/stdout进行通信
  • 没有守护进程 -由MCP客户端按需生成
  • 无端口 -无网络暴露
  • 安全 -孤立子流程

MCP客户端(如Claude Desktop)将此作为子进程生成,并通过stdio上的JSON-RPC进行通信。

配置

设置以下环境变量:

export GITHUB_TOKEN="your_github_personal_access_token"

令牌需要以下作用域:

  • repo (完全控制私有存储库)
  • read:org (阅读组织成员资格)

用法

MCP模式(主)

添加到您的Claude Desktop MCP配置中:

{
  "mcpServers": {
    "github-pr-automation": {
      "command": "node",
      "args": ["/path/to/github-pr-automation/dist/index.js"],
      "env": {
        "GITHUB_TOKEN": "your_github_token"
      }
    }
  }
}

CLI模式(直接使用)

直接从命令行使用工具:

# Get failing tests for a PR
github-pr-automation get-failing-tests --pr "owner/repo#123" --wait --bail-on-first

# Find unresolved comments
github-pr-automation find-unresolved-comments --pr "owner/repo#456" --include-bots

# Manage stacked PRs
github-pr-automation manage-stacked-prs --base-pr "owner/repo#100" --dependent-pr "owner/repo#101"

# Resolve review thread
github-pr-automation resolve-review-thread --pr "owner/repo#123" --thread-id "thread_id"

# Output as JSON for scripting
github-pr-automation get-failing-tests --pr "owner/repo#123" --json

CLI使用案例:

  • 🚀 快速PR检查 -获取PR状态的即时反馈
  • 🤖 自动化脚本 -集成到CI/CD管道中
  • 🔧 开发工作流程 -开发过程中的测试工具
  • 📊 数据提取 -获取结构化JSON输出以供分析

环境设置:

# Set your GitHub token
export GITHUB_TOKEN="your_github_personal_access_token"

# Or use a .env file
echo "GITHUB_TOKEN=your_token_here" > .env

工具参考

get_failing_tests

{
  pr: "owner/repo#123",           // PR identifier
  wait: false,                     // Wait for CI completion (default: false)
  bail_on_first: true,            // 💾 Stop at first failure (default: true)
  page: 1,                         // Page number (default: 1)
  page_size: 10                    // 💾 Results per page (default: 10)
}

// 💾 = User preference hint - AI agents may learn and remember your preference

查找_未解决_评论

{
  pr: "owner/repo#123",           // PR identifier
  include_bots: true,             // 💾 Include bot comments (default: true)
  page: 1,                         // Page number (default: 1)
  page_size: 20,                   // 💾 Results per page (default: 20)
  sort: "chronological"            // 💾 Sort order (default: chronological)
}

manage_stacked_prs

{
  base_pr: "owner/repo#123",      // Earlier PR in stack
  dependent_pr: "owner/repo#124", // Later PR in stack
  auto_fix: true,                  // Auto-fix test failures (default: true)
  use_onto: true,                  // Use --onto rebase strategy (optional)
  max_iterations: 3                // Max fix iterations (default: 3)
}

resolve_review_thread

{
  pr: "owner/repo#123",           // PR identifier
  thread_id: "thread_id",         // Review thread GraphQL node ID (optional)
  comment_id: "comment_id",       // Comment GraphQL node ID (optional)
  prefer: "thread"                // Prefer "thread" or "comment" when both provided
}

发展

# Watch mode for development
npm run watch

# Build for production
npm run build

# Test MCP server (stdio mode)
npm run dev

# Test CLI mode
npm run cli -- get-failing-tests --pr "owner/repo#123"

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

建筑

服务器是使用以下方式构建的:

  • @模型上下文协议/sdk -MCP协议实现
  • @奥克托基特/休息 -GitHub API客户端
  • @octokit/auth应用程序 -GitHub应用程序身份验证
  • 萨德 -工具输入的运行时类型验证
  • 指挥官 -CLI框架
  • Vitest -测试框架
  • TypeScript -类型安全和开发经验

文档

综合文档可在 docs/ 目录:

快速链接

许可证

麻省理工学院

仓库

  • GitHub: https://github.com/jmalicki/github-pr-automation-mcp
  • NPM: https://www.npmjs.com/package/github-pr-automation
  • 问题: https://github.com/jmalicki/github-pr-automation-mcp/issues

目录标签

目录标签

开发工具TypeScriptClaudeCI/CDGitHub自动化本地部署PR管理AI辅助

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP