GitHub PR评论MCP服务器
](https://smithery.ai/server/github-pr-mcp)
这是一个模型上下文协议(MCP)服务器,使用GitHub个人访问令牌获取GitHub Pull Request注释。
特性
- 获取带有文件路径、行范围和回复的PR注释
- 通过Octokit使用GitHub API
- 使用StdioServerTransport实现MCP服务器
- 以结构化JSON格式返回注释
安装
通过Smithery安装
通过以下方式自动安装Claude Desktop的github pr mcp 史密瑟里:
npx -y @smithery/cli install github-pr-mcp --client claude手动安装
- 克隆存储库
- 安装依赖项:
npm install- 创建一个
.env使用您的GitHub令牌的文件:
GITHUB_TOKEN=your_github_token_here用法
- 构建项目:
npm run build- 运行服务器:
npm start或者直接使用GitHub代币:
node dist/server.js your_github_token_here- 服务器公开了一个名为
get_pr_comments它接受以下参数:
- owner:存储库所有者(用户名或组织) - repo:存储库名称 - pull_number:拉取请求号
与Cursor集成
要与Cursor集成,请在Cursor的MCP服务器配置中使用以下命令:
node /path/to/dist/server.js your_github_token_here替换 /path/to 了解项目的实际路径,以及 your_github_token_here 使用您的GitHub个人访问令牌。
测试
包含一个测试客户端来验证服务器功能:
- 构建项目:
npm run build- 运行测试客户端:
npm test测试客户端将启动服务器,连接到服务器,并调用 get_pr_comments 带有示例参数的工具。
响应格式
服务器以以下格式返回注释:
{
"comments": [
{
"id": 123456789,
"path": "src/example.js",
"body": "This is a comment on a specific line",
"line": 42,
"start_line": 40,
"user": {
"login": "username"
},
"created_at": "2023-01-01T00:00:00Z",
"replies": [
{
"id": 987654321,
"body": "This is a reply to the comment",
"user": {
"login": "another-username"
},
"created_at": "2023-01-02T00:00:00Z"
}
]
}
]
}发展
要在开发模式下运行服务器,请执行以下操作:
npm run dev许可证
国际协调委员会
