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

Commit To Pr MCP

MCP Server

一个通过GitHub CLI从git提交哈希中提取PR详细信息的MCP服务器,适用于AI代理和开发者工具。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
GitHub工作流自动化JavaScriptClaude开发工具Claude DesktopClaudeCursorClineVS Code

安装说明

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

作者 / 组织

vltansky

提供方

vltansky

最后核验

2026/5/17 20:23

快速接入

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

详细介绍

致力于公关mcp

MCP(模型上下文协议)服务器,使AI代理能够使用GitHub CLI从git提交哈希中提取PR详细信息。

特性

  • 致力于公关解决方案:自动从提交哈希、合并提交和压缩提交中提取PR编号
  • 自动检测:自动从git工作目录中检测GitHub存储库
  • 全面的公关数据:检索完整的PR详细信息,包括标题、描述、作者、状态、标签和评论
  • 灵活输入:接受提交哈希(完整或简短)、分支名称或直接PR编号
  • 类型安全:使用TypeScript和Zod构建,用于运行时验证

先决条件

  • Node.js >= 18.0.0
  • **** 已安装并验证(gh auth login)
  • MCP兼容客户端(Cursor、Claude Desktop、VS Code等)

安装

入门指南

首先,在客户端安装提交到pr-mcp服务器。

标准配置 适用于大多数工具:

{
  "mcpServers": {
    "commit-to-pr": {
      "command": "npx",
      "args": [
        "commit-to-pr-mcp@latest"
      ]
    }
  }
}

Claude Code

使用Claude Code CLI添加服务器:

claude mcp add commit-to-pr npx commit-to-pr-mcp@latest

Claude Desktop

添加到您的Claude Desktop配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):

{
  "mcpServers": {
    "commit-to-pr": {
      "command": "npx",
      "args": ["commit-to-pr-mcp@latest"]
    }
  }
}

Cursor

单击按钮安装:

![Install in Cursor](https://cursor.com/en-US/install-mcp?name=commit-to-pr&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJjb21taXQtdG8tcHItbWNwQGxhdGVzdCJdfQ==)

或手动安装:

首选 Cursor SettingsMCPAdd new MCP Server.按你的喜好命名,使用 command 使用命令键入 npx commit-to-pr-mcp@latest。您还可以通过单击来验证配置或添加命令参数 Edit.

项目特定配置

创建 .cursor/mcp.json 在项目根目录中:

{
  "mcpServers": {
    "commit-to-pr": {
      "command": "npx",
      "args": ["commit-to-pr-mcp@latest"]
    }
  }
}

VS Code

跟随 MCP安装指南,使用上面的标准配置。

或者,使用VS Code CLI进行安装:

code --add-mcp '{"name":"commit-to-pr","command":"npx","args":["commit-to-pr-mcp@latest"]}'

Cline

通过Cline VS Code扩展设置或更新您的 cline_mcp_settings.json 文件:

{
  "mcpServers": {
    "commit-to-pr": {
      "command": "npx",
      "args": [
        "commit-to-pr-mcp@latest"
      ]
    }
  }
}

Zed

跟随 MCP服务器文档.使用上面的标准配置。

______________________________________________________________________

本地开发

对于本地开发和测试:

{
  "mcpServers": {
    "commit-to-pr": {
      "command": "node",
      "args": ["/absolute/path/to/commit-to-pr-mcp/dist/index.js"],
      "env": {
        "LOG_LEVEL": "debug"
      }
    }
  }
}

______________________________________________________________________

验证安装

安装后,验证提交到pr mcp是否正常工作:

  1. 重新启动MCP客户端 完全
  2. 检查连接状态:

- 光标:在设置中查找绿点→ 工具和集成→ MCP工具 - 克劳德桌面版:检查可用工具中的“commit_to_pr” - VS Code:在GitHub Copilot设置中验证

  1. 使用简单查询进行测试:
   Get PR details for commit abc123

如果你看到AI代理使用 get_pr 工具和返回PR信息,一切就绪! 🎉

用法

服务器提供了一个工具: get_pr

基本示例:从提交哈希中获取PR

{
  "commit": "abc123def456",
  "repo": "owner/repo"  // Optional: auto-detected from git working directory
}

示例:从分行名称获取PR

{
  "commit": "feature/new-feature",
  "cwd": "/path/to/repo"  // Optional: specify working directory for auto-detection
}

示例:直接通过数字获取PR

{
  "pr_number": 42,
  "repo": "owner/repo"  // Optional: auto-detected from git working directory
}

示例:自动检测存储库

在git存储库中工作时,可以省略 repo 参数:

{
  "commit": "abc123"
  // Repository is automatically detected from git remote
}

刀具参数

get_pr

通过提交哈希或PR编号获取PR详细信息。从git提交(合并提交、挤压提交)中提取PR编号,并返回完整的PR详细信息。

参数:

  • commit (可选):Git提交哈希(完整或简短)、分支名称或任何Git引用。使用此OR pr_number.
  • pr_number (可选):直接查找PR编号。使用此OR commit.
  • repo (可选):GitHub存储库 owner/repo 格式。如果未提供,则自动检测 cwd 或当前工作目录。
  • cwd (可选):从git remote自动检测GitHub存储库的工作目录路径。

注: 要么 commitpr_number 必须提供。

响应格式

该工具返回结构化响应:

{
  "number": 42,
  "title": "Add new feature",
  "body": "This PR adds a new feature...",
  "state": "MERGED",
  "url": "https://github.com/owner/repo/pull/42",
  "author": "username",
  "createdAt": "2025-01-15T10:30:00Z",
  "mergedAt": "2025-01-16T14:20:00Z",
  "baseRef": "main",
  "headRef": "feature/new-feature",
  "labels": ["enhancement", "ready-for-review"],
  "reviews": [
    {
      "author": "reviewer1",
      "state": "APPROVED",
      "submittedAt": "2025-01-16T12:00:00Z"
    },
    {
      "author": "reviewer2",
      "state": "CHANGES_REQUESTED",
      "submittedAt": "2025-01-16T13:00:00Z"
    }
  ]
}

响应字段

  • number:PR编号
  • title:PR标题
  • body:PR描述/正文
  • state:PR状态(OPEN, CLOSED, MERGED)
  • url:PR的GitHub URL
  • author:PR作者用户名
  • createdAt:创建时间戳(ISO 8601)
  • mergedAt:合并时间戳(ISO 8601), null 如果不合并
  • baseRef:目标分支名称
  • headRef:源分支名称
  • labels:标签名称数组
  • reviews:一系列审查对象 author, state,以及 submittedAt

运作原理

服务器使用GitHub CLI(gh)致:

  1. 从提交中提取PR编号:

- 搜索包含提交哈希的PR - 解析合并提交消息(Merge pull request #123) - 解析南瓜提交消息((#123))

  1. 检索PR详细信息:

- 通过以下方式获取全面的公关信息 gh pr view - 包括评论、标签和元数据

  1. 自动检测存储库:

- 阅读 git remote get-url origin 从工作目录 - 提取物 owner/repo 从远程URL格式化

发展

设置

npm install
npm run build

测试

对于本地测试:

  1. 构建项目:
   npm run build
  1. 配置您的MCP客户端以使用本地构建(请参阅上面的本地开发部分)
  1. 与MCP检查员或客户进行测试

开发脚本

  • npm run build:将TypeScript编译为JavaScript
  • npm run start:运行已编译的服务器
  • npm run dev:以开发模式运行服务器 tsx

建筑

src/
└── index.ts              # Main server implementation
    ├── Tool handlers     # get_pr tool logic
    ├── Git utilities     # Repository detection
    └── GitHub CLI        # PR extraction and details

许可证

ISC

贡献

欢迎投稿!请阅读投稿指南并提交PR。

相关项目

-

目录标签

目录标签

GitHub工作流自动化JavaScriptClaude开发工具GitHub集成本地部署PR管理自动化工作流TypeScript

支持客户端

Claude DesktopClaudeCursorClineVS Code

接入字段

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

未说明

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

session

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

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

0

权限和风险

未说明session部署方式未说明

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

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP