GitHub PR评论管理工具

一个用于管理和解决GitHub Pull Request中未解决评论的MCP服务器工具,支持与编辑器集成。

  • by makinokeiichi
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 makinokeiichi/mcp-github-resolver

使用说明

mcp github解析器

GitHub Pull Request使用上面的“对话(Review Threads)”MCP (Model Context Protocol) 服务器

概要

这MCP服务器GitHub Pull Request中描述的场景,使用以下步骤创建明细表,以便在概念设计中分析体量的体积。 Cursor等编辑器「PR的未解决评语“这样的自然的指示成为可能。

机能

1. get_unresolved_threads

指定的Pull Request的明细栏样式中定义的设置。

注意: 最多可获得100个审核线程。Pull Request如果有超过100个线程,则仅检索前100个线程。所有未解决的对话都可能无法显示。

参数:

  • owner:存储库所有者名称
  • repo:存储库名称
  • pullRequestNumber: Pull Request番号

返回值:

{
  "count": 2,
  "threads": [
    {
      "id": "PRRT_...",
      "firstComment": {
        "author": "username",
        "body": "コメント内容"
      }
    }
  ]
}

2. resolve_conversation

指定的线程ID中所述修改相应参数的值。

参数:

  • threadId:GraphQL节点ID(例如: PRRT_...)

返回值:

{
  "success": true,
  "threadId": "PRRT_...",
  "isResolved": true
}

3. reply_to_thread

向指定的拉式请求的对话线程添加回复注释。

参数:

  • threadId:GraphQL节点ID(例如: PRRT_...)
  • body:要回复的评论正文

返回值:

{
  "success": true,
  "commentUrl": "https://github.com/..."
}

安装,安装

1.安装

npm install

2.构建

npm run build

因此dist/index.js 中所述修改相应参数的值。

3. GitHub 标记设置

GitHub Personal Access Token中所述修改相应参数的值。每个操作所需的作用域如下:

  • get_unresolved_threads(未解析线程的取得):在公用存储库的情况下 read:repo 或 repo:status。对于专用存储库 repo 我需要一个作用域。
  • resolve_conversation(线程解析): repo(完全访问存储库)
  • reply_to_thread(回复线程): repo(完全访问存储库)

如果希望以更有限的权限运行,请执行公共存储库的只读操作: read:repo 等。执行专用存储库或两种操作时 repo 我需要一个作用域。 标记是环境变量 GITHUB_TOKEN 中所述修改相应参数的值。

Cursor中的设置方法

Settings > Features > MCP 的设置

Cursor的配置文件(~/.cursor/config.json 或设定画面)中请追加以下内容:

⚠️ 重要: args 在 dist/index.js 的绝对路径

{
  "mcpServers": {
    "github-resolver": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-github-resolver/dist/index.js"],
      "env": {
        "GITHUB_TOKEN": "your_personal_access_token_here"
      }
    }
  }
}

设定例

{
  "mcpServers": {
    "github-resolver": {
      "command": "node",
      "args": ["/Users/username/projects/mcp-github-resolver/dist/index.js"],
      "env": {
        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

用法

Cursor的,之Composer啊Chat您可以:

このPRの未解決のレビューコメントを全て解決してください

在内部:

  1. get_unresolved_threads 获取未解析线程
  2. 对于每个线程 resolve_conversation 执行

技术栈

  • 语言: TypeScript
  • 运行时间: Node.js
  • 主要库:
    • @modelcontextprotocol/sdk -MCP-SDK
    • @octokit/graphql - GitHub GraphQL API 客户机
    • zod -架构验证
    • dotenv -环境变数管理

开発

目录配置

mcp-github-resolver/
├── src/
│   └── index.ts          # メインエントリポイント
├── dist/                 # ビルド成果物(npm run build で生成)
│   └── index.js
├── package.json
├── tsconfig.json
└── README.md

构建

npm run build

TypeScript代码 dist/ 转储到目录。

许可证

ISC