GitHub 集成
GitHub MCP 服务器提供了从 Pull 请求中提取差异的功能。
可用工具
获取差异
从 GitHub Pull Request 中检索差异内容。
参数:
owner:存储库所有者/组织名称repo:存储库名称pr_number:拉取请求编号
返回:包含以下内容的对象:
content:包含 PR diff 的字符串
验证
必需:将 GitHub 个人访问令牌设置为环境变量:
令牌至少需要repo范围的权限才能访问私有仓库。对于公共仓库,具有public_repo范围的令牌就足够了。
错误处理
服务器实现标准错误处理:
丢失或无效的令牌返回
ErrorCode.AuthenticationError无效的存储库详细信息返回
ErrorCode.InvalidParams不存在的 PR 返回
ErrorCode.NotFound差异提取失败会返回格式化的错误消息
SIGINT 信号正常关闭
技术细节
使用 Highlight AI MCP SDK 构建
使用 GitHub REST API v3
通过 Zod 进行输入验证
作为基于 stdio 的 MCP 服务器运行
支持 Node.js >=18.0.0
限制
根据 GitHub API 限制应用速率限制
根据 GitHub API 限制,较大的差异可能会被截断
令牌需要适当的存储库访问权限
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
从 GitHub Pull Requests 中提取差异,允许用户检索和分析存储库中分支之间的更改。
Related Resources
Related MCP Servers
- Asecurity-licenseAqualityGenerates comprehensive and formatted release notes from GitHub repositories, efficiently organizing commits by type and including detailed statistics using smart API usage.Last updated -2
- Asecurity-licenseAqualityProvides GitHub data analysis for repositories, developers, and organizations, enabling insights into open source ecosystems through API calls and natural language queries.Last updated -513MIT License
- -security-license-qualityA tool that integrates with GitHub and Notion to analyze and review pull requests, enabling automated code reviews and documentation in Notion.Last updated -
- -security-license-qualityA lightweight tool that uses Mistral AI running locally to generate structured GitHub pull request descriptions from git diffs.Last updated -