GitHub MCP
GitHub MCP
一个通用的、只读的远程 MCP 连接器,用于查询通过 GitHub App 安装所选定的 GitHub 仓库。它专为自托管而设计,不包含任何 GitHub、Cloudflare 或 MCP 客户端的账户标识符。
该连接器使用两层授权机制:
用户授权 GitHub App 以证明其 GitHub 身份。只有操作者配置的登录账号才能完成连接。
工具调用使用短期有效的 GitHub App 安装令牌,并限定作用范围仅限被请求的已安装仓库。
GitHub 用户令牌在身份验证完成后即被丢弃。该连接器不暴露任何写入工具。
功能
发现 GitHub App 安装中所选定的仓库。
搜索代码并获取文本文件或目录列表。
检查提交、拉取请求、差异、审查和评论。
检查议题及议题评论。
使用 OAuth、PKCE 和 Dynamic Client Registration 对远程 MCP 客户端进行身份验证。
Related MCP server: GitHub Code Search MCP Server
本地开发
要求:Node 22 或更高版本,以及 Yarn 1.22。
yarn install
yarn type-check
yarn lint
yarn test
yarn build测试使用模拟身份和模拟的 GitHub 服务。本地验证无需 GitHub App 或 Cloudflare 账户。
要让 Worker 对接真实服务运行,请遵循操作设置者指南。请勿将 wrangler.jsonc、本地机密或 GitHub App 私钥提交到版本库。
MCP 工具
工具 | 用途 |
| 列出在应用安装中选择的仓库。 |
| 在单个已安装的仓库内搜索。 |
| 列出仓库在某个引用(ref)下的目录。 |
| 获取 UTF-8 文本文件,可选择按行范围获取。 |
| 检查仓库历史。 |
| 检查拉取请求、文件、审查和评论。 |
| 获取拉取请求的统一差异(unified diff)。 |
| 检查议题及评论。 |
结果为 GitHub API 实时响应,并经过规范化处理(不包含,包含规范 URL 的有限 JSON)。分页默认一次 20 项,最多 50 项。文本和 diff 输出上限为 100,000 个字符。
安全模型
AUTHORIZED_GITHUB_LOGINS为必填项;为空时默认拒绝(fail closed)。GitHub App 的安装决定了哪些仓库对连接器 `to 可用。
每次仓库工具调用仅生成一个对该仓库有效的一小时令牌。
所需 GitHub App 权限为只读的 Metadata、Contents、Issues 和 Pull Requests。
OAuth 授权码、用户令牌、安装令牌、客户端机密和私钥永远不会被返回,也不会被有意记录到日志中。
本项目定位为个人或小团队使用的连接器,而非托管的多租户服务。
许可证
本项目基于 MIT 许可证 发布。
This server cannot be deployed
Maintenance
Related MCP Connectors
GitHub MCP — wraps the GitHub public REST API (no auth required for public endpoints)
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Create, deploy, and operate MCP servers directly from your GitHub repositories.
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceRead-only MCP server for the GitHub REST API that enables agents to query repositories, issues, files, and users without any write access.-
- AlicenseNot gradedqualityBmaintenanceEnables searching GitHub code with filters and reading arbitrary file contents from any repository via MCP.GPL 3.0
- FlicenseNot gradedqualityCmaintenanceEnables read-only browsing and querying of GitHub repositories, including listing repos, reading files, fetching READMEs, searching code, and viewing commit history via MCP.-
- AlicenseNot gradedqualityBmaintenanceEnables remote MCP connections to GitHub, allowing users to list repositories, inspect repository details, manage issues, and read file contents via natural language or MCP clients.251 npmMIT