GitHub Integration MCP Server

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.

Integrations

  • Provides functionality to extract diffs from GitHub Pull Requests, allowing retrieval of PR diff content by specifying repository owner, repo name, and PR number.

  • Serves as the runtime environment for the MCP server, requiring version 18.0.0 or higher for operation.

  • Used for input validation within the MCP server to ensure proper parameter formatting before API requests are processed.

GitHub 集成

GitHub MCP 服务器提供了从 Pull 请求中提取差异的功能。

可用工具

获取差异

从 GitHub Pull Request 中检索差异内容。

参数

  • owner :存储库所有者/组织名称
  • repo :存储库名称
  • pr_number :拉取请求编号

返回:包含以下内容的对象:

  • content :包含 PR diff 的字符串

验证

必需:将 GitHub 个人访问令牌设置为环境变量:

export GITHUB_TOKEN=<your-github-token>

令牌至少需要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 限制,较大的差异可能会被截断
  • 令牌需要适当的存储库访问权限
-
security - not tested
F
license - not found
-
quality - not tested

从 GitHub Pull Requests 中提取差异,允许用户检索和分析存储库中分支之间的更改。

  1. Available Tools
    1. get_diff_pr
  2. Authentication
    1. Error Handling
      1. Technical Details
        1. Limitations
          ID: hs0xf42a7n