GitHub Repo MCP 是一个开源的 MCP 服务器,它能让你的人工智能助手轻松浏览 GitHub 代码仓库,探索其目录结构并查看文件内容,为开发工作带来极大便利。
在系统上安装此服务器,需要满足以下要求:
# 使用 npm 安装 github-repo-mcp 包
npm install -g github-repo-mcp
# 启动 MCP 服务
github-repo-mcp start
stdio 协议的 MCP 客户端。GitHub Repo MCP 提供了三个核心功能,用于与 AI 助手交互:
show me the contents of the repository at https://github.com/Ryan0204/github-repo-mcp
what files are in the src directory of https://github.com/Ryan0204/github-repo-mcp?
show me the README.md file from https://github.com/Ryan0204/github-repo-mcp
以下是使用这些工具与 AI 助手交互的示例:
⚠️ 重要提示
- 未认证的情况下,GitHub API 有严格的速率限制(每小时 60 次请求)。
- 只能访问公开代码仓库,除非提供具备适当权限的令牌。
- 服务器检测常见的二进制文件扩展名并不会显示其内容。
- GitHub API 对可检索文件的大小有所限制。
以下是一些常见问题及其解决方案:
如遇其他问题,请查看输出中的错误信息或在 GitHub 项目中创建 issues。