GitHub资源管理器MCP
MCP服务器为MCP客户端(如Claude Desktop、Cursor等)提供GitHub存储库信息,包括文件内容、目录结构和其他元数据。
特性
- 存储库摘要:获取有关GitHub存储库的全面信息
- 目录结构:使用漂亮的ASCII树可视化查看任何存储库的完整文件结构
- 文件内容:访问特定文件的内容
- 元数据增强:获取星号、叉号、描述和上次更新信息
- 本地存储库克隆:在本地克隆存储库,以实现更快的处理和更完整的数据
- 缓存系统:高效缓存存储库数据以减少API调用
- 进度通知:长时间运行操作的更新
- 格式选项:获取文本或结构化JSON格式的数据
- 自动完成:对存储库所有者和名称的建议
- web界面:在HTTP模式下运行时的基本状态页面和信息
安装
使用NPM
# Install from npm
npm install @trishchuk/github-explorer-mcp -g
# Run the server (stdio mode for MCP clients)
github-explorer-mcp
# Or run in HTTP/SSE mode
github-explorer-mcp-sse使用Docker
# Build Docker image
docker build -t github-explorer-mcp .
# Run container
docker run -p 3000:3000 github-explorer-mcp与MCP客户端一起使用
克劳德桌面
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"github-explorer": {
"command": "npx",
"args": ["-y", "@trishchuk/github-explorer-mcp"]
}
}
}光标
添加到游标配置中:
{
"mcpServers": {
"github-explorer": {
"command": "npx",
"args": ["-y", "@trishchuk/github-explorer-mcp"]
}
}
}api参考
MCP服务器提供以下工具:
github \_仓库_摘要
获取GitHub存储库的摘要。
{
owner: string; // GitHub organization or username
repo: string; // Repository name
branch?: string; // Optional branch name
includeMetadata?: boolean; // Include stars, forks, etc.
}github目录结构
获取GitHub存储库的树结构。
{
owner: string; // GitHub organization or username
repo: string; // Repository name
branch?: string; // Optional branch name
}github read_important_files
从GitHub存储库获取特定文件的内容。
{
owner: string; // GitHub organization or username
repo: string; // Repository name
filePaths: string[]; // List of paths to files
branch?: string; // Optional branch name
format?: 'text' | 'json'; // Output format
}git_search(即将推出)
在GitHub存储库中搜索内容。
{
owner: string; // GitHub organization or username
repo: string; // Repository name
query: string; // Search query
branch?: string; // Optional branch name
maxResults?: number; // Maximum results to return
}git_diff(即将推出)
获取两个分支或提交之间的差异。
{
owner: string; // GitHub organization or username
repo: string; // Repository name
base: string; // Base branch/commit
head: string; // Head branch/commit
}发展
# Clone the repository
git clone https://github.com/x51xxx/github-explorer-mcp.git
cd github-explorer-mcp
# Install dependencies
npm install
# IMPORTANT: This project requires Node.js 18 or later
# If using nvm, run:
nvm use
# Build the project
npm run build
# Run the built server
npm start
# or
npm run start:sse故障排除
Node.js版本问题
此项目需要Node.js 18或更高版本,因为它使用现代Web API,如 ReadableStream。如果您遇到以下错误:
ReferenceError: ReadableStream is not defined您应该:
- 将Node.js更新到版本18或更高版本
- 如果使用nvm,请运行
nvm use在项目目录中 - 确保使用包含必要polyfills的修改后的脚本
贡献
欢迎投稿!请随时提交拉取请求。
许可证
麻省理工学院
