使用说明
OpenDigger MCP 服务器
一个针对OpenDigger的模型上下文协议(MCP)服务器,通过工具和提示提供高级仓库分析和见解。
快速入门
# Setup
git clone https://github.com/X-lab2017/open-digger-mcp-server.git
# (Optional) Ensure you're on the master branch
git checkout master
cd open-digger-mcp-server && cd mcp-server
npm install
npm run build
# Start server
npm start
[!重要]
别忘了配置 Cursor(在 .cursor/mcp.json 中更新路径)
预期输出:
OpenDigger MCP Server running (on stdio)...
[!重要]
如果你正在使用Cursor AI IDE,你应该能看到MCP服务器(open-digger-mcp)左下角有条消息提示。你应该 启用;使能够 现在,您可以开始使用MCP服务器提供的工具和提示了。为了验证,请打开Cursor设置并检查MCP服务器部分→您应该能看到open-digger-mcp列在上面。
为了进一步确认服务器运行正常,您可以在Cursor中检查以下指标:
- ✅ 绿点 紧挨着“open-digger-mcp”标题
- ✅ “6 tools”翻译成中文是“6个工具” 显示在服务器状态中
- ✅ “3个提示” 显示在服务器状态中
- ✅ 没有错误信息 或红色指示灯
[!TIP](注:这可能是某个特定应用或文档中的标记,直接翻译为“[提示]”可能不够准确,具体含义需结合上下文确定。) 请参阅
Installation.md对于不同集成开发环境(IDE)的详细安装说明和配置选项。
特点/特性
工具(6个可用)
| 编号 | 工具 | 描述 |
|---|---|---|
| 1 | get_open_digger_metric |
获取单个仓库的指标数据 |
| 2 | get_open_digger_metrics_batch |
多指标的批处理操作 |
| 3 | compare_repositories |
多仓库对比分析 |
| 4 | analyze_trends |
不同时期的增长趋势分析 |
| 5 | get_ecosystem_insights 生态系统分析与洞察 |
|
| 6 | server_health 系统诊断与健康监测(Beta版) |
提示(3个可用)
repo_health_analysis- 全面的仓库健康报告repo_comparison- 竞争性仓库分析developer_insights- 开发者活动与贡献分析
指标
-
核心指标:
openrank,stars,forks,contributors,participants,issues_new,issues_closed,pull_requests,commits,activity -
扩展指标:
technical_fork,bus_factor,releases,inactive_contributors,maintainer_count,community_activity -
额外指标:
change_requests,pull_requests_accepted,pull_requests_merged,issue_comments,issue_response_time,code_change_lines,developer_network
💡 使用示例
💠 仓库比较
Compare microsoft/vscode and facebook/react using the compare_repositories tool
💠 健康分析
Generate a health report for microsoft/vscode using the repo_health_analysis prompt
💠 趋势分析
Analyze the growth trends for contributors in microsoft/vscode over 2 years
服务器状态检查
启动服务器后,验证其是否正常运行:
# In a new terminal
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js
预期的响应应列出所有6个工具。
配置
环境变量(.env)
# Cache configuration (recommended)
CACHE_TTL_SECONDS=300
# Optional SSE server
SSE_PORT=3001
SSE_HOST=127.0.0.1
光标MCP(.cursor/mcp.json)
{
"mcpServers": {
"open-digger": {
"command": "node",
"args": ["/full/path/to/dist/index.js"],
"cwd": "/full/path/to/project",
"env": {
"CACHE_TTL_SECONDS": "300"
}
}
}
}
[提示] 替换
/full/path/to/open-digger-mcp-server使用您实际的项目目录路径。使用pwd获取当前目录路径。
发展
npm run watch # Development mode
npm run build # Compile TypeScript
npm run clean # Clean build files
npm run sse:test # Test SSE server
[提示] 除了Cursor,您还可以使用其他MCP客户端,如VS Code、Claude Chat或官方客户端 MCP 检测器。
故障排除
常见问题
服务器未出现在光标中:
- 验证其中的绝对路径
.cursor/mcp.json - 完全重启光标(Cmd+Q / Alt+F4)
- 检查MCP设置部分以查看错误信息
权限错误:
chmod +x dist/index.js
构建错误:
npm run clean
npm install
npm run build
缓存问题:
# Clear npm cache
npm cache clean --force
# Rebuild
npm run clean && npm run build
贡献
- 为仓库创建分支(或:克隆仓库)
- 创建你的特性分支(
git checkout -b feature/amazing-feature) - 提交更改(
git commit -m 'Add amazing feature') - 推送到分支(
git push origin feature/amazing-feature) - 提交一个拉取请求
许可证
Apache-2.0 许可证 - 详见 许可证 文件中有详细信息。
