GitHub Repo MCP 是一个开源的 MCP 服务器,它能让您的人工智能助手浏览 GitHub 仓库、探索目录以及查看文件内容,为您的开发工作带来便利。
在系统上安装服务器需要以下内容:
您可以使用 Smithery、NPX 或在 IDE 的 mcp.json 中设置来安装和运行 GitHub Repo MCP:
npx github-repo-mcp
cmd /c npx -y github-repo-mcp
{
"mcp": {
"servers": [
{
"name": "GitHub Repo MCP",
"executable": "github-repo-mcp",
"args": []
}
]
}
}
在 config.json 中添加以下内容:
{
"repositories": [
{
"url": "https://github.com/Ryan0204/github-repo-mcp",
"name": "GitHub Repo MCP"
}
]
}
stdio 协议的 MCP 客户端。listRepositories()
listRepositories
getRepositoryContents(String url)
getRepositoryContents https://github.com/Ryan0204/github-repo-mcp
getDirectoryContents(String url, String path)
getDirectoryContents https://github.com/Ryan0204/github-repo-mcp src
getFileContents(String url, String path)
getFileContents https://github.com/Ryan0204/github-repo-mcp README.md
如果遇到以下情况,请按照步骤操作:
无法连接到 GitHub API:
npm start
找不到文件或目录:
超出速率限制:
config.json 中添加令牌。通过以上步骤,您应该能够顺利地使用 GitHub Repo MCP 服务器。如果有任何其他问题,请查看输出中的错误信息或在 GitHub 仓库中创建问题。
祝您愉快!😊