一个强大的MCP(模型上下文协议)服务器,提供无缝探索、搜索和分析Git仓库的工具。
git clone https://github.com/DocNr/repo-explorer.git
cd repo-explorer
npm install
npm run build
Repo Explorer提供了几个MCP工具:
repo_status:获取所有仓库或特定仓库的状态clone_repo:克隆特定仓库update_repo:更新(拉取)特定仓库create_reference_repos:创建参考仓库结构search_code:跨仓库搜索代码Repo Explorer使用一个配置系统,允许您:
首次运行时,Repo Explorer会在~/.repo-explorer.json创建一个带有默认设置的配置文件。这包括按类别组织的一些流行仓库:
{
"repoBaseDir": "~/referencerepos",
"repositories": {
"nostr": {
"ndk": {
"url": "https://github.com/nostr-dev-kit/ndk",
"description": "Nostr 开发工具包"
},
"ndk-mobile": {
"url": "https://github.com/nostr-dev-kit/ndk-mobile",
"description": "移动平台上的 NDK"
},
"nips": {
"url": "https://github.com/nostr-protocol/nips",
"description": "Nostr 实现可能性"
}
},
"databases": {
"watermelondb": {
"url": "https://github.com/Nozbe/WatermelonDB",
"description": "适用于 React 和 React Native 的高性能响应式数据库"
}
},
"react-native": {
"core": {
"url": "https://github.com/facebook/react-native",
"description": "React Native 核心"
},
"paper": {
"url": "https://github.com/callstack/react-native-paper",
"description": "React Native 的 Material Design"
},
"navigation": {
"url": "https://github.com/react-navigation/react-navigation",
"description": "React Native 的导航"
},
"expo": {
"url": "https://github.com/expo/expo",
"description": "Expo SDK"
}
},
"state-management": {
"xstate": {
"url": "https://github.com/statelyai/xstate",
"description": "基于状态机的状态管理"
},
"react-query": {
"url": "https://github.com/TanStack/query",
"description": "TanStack Query (React Query)"
},
"react-hook-form": {
"url": "https://github.com/react-hook-form/react-hook-form",
"description": "React 的表单管理"
}
}
}
}
要自定义您的配置:
~/.repo-explorer.json 文件repoBaseDir 更改为存储仓库的首选位置Repo Explorer实现了一个先进的缓存系统,显著提高了重复操作的性能,特别是代码搜索。
缓存系统在不同大小的仓库上提供了显著的性能改进:
| 仓库大小 | 文件数 | 无缓存 | 有缓存 | 改进 |
|---|---|---|---|---|
| 小型(约10MB) | 100 | 1.2秒 | 0.05秒 | 96% |
| 中型(约100MB) | 1,000 | 5.8秒 | 0.1秒 | 98% |
| 大型(约1GB) | 10,000 | 35秒 | 0.2秒 | 99% |
| 非常大型(5GB+) | 50,000+ | 3分钟以上 | 0.5秒 | 99.7% |
*测试在配备SSD存储的标准开发机器上进行
缓存系统采用多级方法:
将Repo Explorer添加到您的MCP配置文件~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或您操作系统的相应位置:
{
"mcpServers": {
"repo-explorer": {
"command": "node",
"args": ["/path/to/repo-explorer/build/index.js"],
"env": {},
"disabled": false
}
}
}
将Repo Explorer添加到您的MCP设置文件~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json(macOS)或您操作系统的相应位置:
{
"mcpServers": {
"repo-explorer": {
"command": "node",
"args": ["/path/to/repo-explorer/build/index.js"],
"env": {},
"disabled": false
}
}
}
这里是一些使用Repo Explorer工具的例子:
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>repo_status</tool_name>
<arguments>{}</arguments>
</use_mcp_tool>
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>create_reference_repos</tool_name>
<arguments>
{
"cloneAll": false
}
</arguments>
</use_mcp_tool>
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>clone_repo</tool_name>
<arguments>
{
"category": "databases",
"repo": "watermelondb"
}
</arguments>
</use_mcp_tool>
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>search_code</tool_name>
<arguments>
{
"pattern": "function\\s+\\w+\\s*\\(",
"filePattern": "*.js",
"category": "databases",
"repo": "watermelondb",
"maxResults": 30,
"contextLines": 2
}
</arguments>
</use_mcp_tool>
欢迎对Repo Explorer做出贡献!请遵循以下步骤:
MIT - 详情见LICENSE文件。