GitHub探索器MCP服务器借助MCP(中间件协议),为Claude Desktop、Cursor等客户端提供GitHub仓库的各类信息,涵盖文件内容、目录结构以及其他元数据,助力客户端更高效地使用GitHub仓库资源。
本服务器可提供丰富的GitHub仓库信息,支持多种使用模式和客户端配置,能有效满足不同场景下对仓库数据的获取需求。
# 从npm安装
npm install @trishchuk/github-explorer-mcp -g
# 运行服务器(MCP客户端的stdio模式)
github-explorer-mcp
# 或者在HTTP/SSE模式下运行
github-explorer-mcp-sse
# 构建Docker镜像
docker build -t github-explorer-mcp .
# 运行容器
docker run -p 3000:3000 github-explorer-mcp
在Claude Desktop配置中添加:
{
"mcpServers": {
"github-explorer": {
"command": "npx",
"args": ["-y", "@trishchuk/github-explorer-mcp"]
}
}
}
在Cursor配置中添加:
{
"mcpServers": {
"github-explorer": {
"command": "npx",
"args": ["-y", "@trishchuk/github-explorer-mcp"]
}
}
}
MCP服务器提供以下工具:
获取GitHub仓库的摘要信息。
{
owner: string; // GitHub组织或用户名
repo: string; // 仓库名称
branch?: string; // 可选分支名称
includeMetadata?: boolean; // 是否包含stars、forks等元数据
}
获取GitHub仓库的目录结构。
{
owner: string; // GitHub组织或用户名
repo: string; // 仓库名称
branch?: string; // 可选分支名称
}
获取GitHub仓库中文件的内容。
{
owner: string; // GitHub组织或用户名
repo: string; // 仓库名称
file_path: string; // 文件路径
branch?: string; // 可选分支名称
}
使用以下命令克隆项目:
git clone https://github.com/yourusername/github-explorer-mcp.git
cd github-explorer-mcp
安装项目所需的依赖项:
npm install
运行项目:
npm start
⚠️ 重要提示
请确保使用Node.js 18或更高版本。若出现问题,请检查并升级Node.js。
⚠️ 重要提示
若在Docker部署时遇到问题,请确认镜像是否正确构建,并且容器配置无误。
欢迎提交Pull Request,帮助改进此项目!