返回市场
开源挖掘器-MCP服务器

开源挖掘器-MCP服务器

作者:X-lab20176 星标更新:2025-10-12

项目介绍

OpenDigger MCP Server

一个用于OpenDigger的模型上下文协议(MCP)服务器,通过工具和提示提供高级仓库分析和洞察。

快速开始

# 设置
git clone https://github.com/X-lab2017/open-digger-mcp-server.git

# (可选)确保你在master分支上
git checkout master

cd open-digger-mcp-server && cd mcp-server
npm install
npm run build

# 启动服务器
npm start

[!IMPORTANT]
不要忘记配置Cursor(更新.path/.cursor/mcp.json中的路径)

预期输出:

OpenDigger MCP Server 正在运行(在stdio中)...
<br/>

[!IMPORTANT]
如果您使用的是Cursor AI IDE,您应该在左下角看到MCP服务器(open-digger-mcp)的通知。您应该启用它,现在您可以开始使用MCP服务器提供的工具和提示了。为了验证,请打开Cursor设置并检查MCP服务器部分→您应该在那里看到open-digger-mcp

opendigger-mcp-img

为了进一步确认服务器正常工作,您可以在Cursor中检查以下指标:

  • ✅ “open-digger-mcp”标题旁边的绿色点
  • ✅ 服务器状态显示**“6个工具”**
  • ✅ 服务器状态显示**“3个提示”**
  • ✅ 没有错误消息或红色指示器
<br/> <div style="display: flex; justify-content: center;"> <div style="width: 500px; height: 300px; border: 2px solid #ccc; border-radius: 8px; padding: 10px; display: flex; justify-content: center; align-items: center;"> <img src="https://gips0.baidu.com/it/u=3174284897,3875149250&fm=3081&app=3081&f=GIF?w=800&h=664" alt="demo-mcp-opendigger" style="max-width: 100%; max-height: 100%;"> </div> </div> <br/>

[!TIP] 请参阅安装.md以获取详细的安装说明和不同IDE的配置选项。


功能

工具(6个可用)

序号工具名称描述
1get_open_digger_metric获取单个仓库的度量标准
2get_open_digger_metrics_batch批量操作多个度量标准
3compare_repositories多仓库比较分析
4analyze_trends时间段内的增长趋势分析
5get_ecosystem_insights生态系统分析及洞察
6server_health系统诊断和健康监控(测试版)

提示(3个可用)

  1. repo_health_analysis - 综合仓库健康报告
  2. repo_comparison - 竞争性仓库分析
  3. developer_insights - 开发者活动和贡献分析

度量标准

  • 核心度量标准openrankstarsforkscontributorsparticipantsissues_newissues_closedpull_requestscommitsactivity
  • 扩展度量标准technical_forkbus_factorreleasesinactive_contributorsmaintainer_countcommunity_activity
  • 附加度量标准change_requestspull_requests_acceptedpull_requests_mergedissue_commentsissue_response_timecode_change_linesdeveloper_network

💡 使用示例

💠 仓库比较

使用compare_repositories工具比较microsoft/vscode和facebook/react

💠 健康分析

使用repo_health_analysis提示生成microsoft/vscode的健康报告

💠 趋势分析

分析microsoft/vscode在过去两年内贡献者的增长趋势

<br/>

服务器状态检查

启动服务器后,验证其是否正常工作:

# 在新的终端中
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js

预期响应应列出所有6个工具。

<br/>

配置

环境变量(.env)

# 缓存配置(推荐)
CACHE_TTL_SECONDS=300

# 可选的SSE服务器
SSE_PORT=3001
SSE_HOST=127.0.0.1

Cursor 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"
      }
    }
  }
}

[!TIP] 将/full/path/to/open-digger-mcp-server替换为您实际的项目目录路径。使用pwd获取当前目录路径。

开发

npm run watch           # 开发模式
npm run build           # 编译TypeScript
npm run clean           # 清理构建文件
npm run sse:test        # 测试SSE服务器

[!TIP] 除了Cursor,您还可以使用其他MCP客户端,如VS Code、Claude Chat或官方的MCP Inspector

故障排除

常见问题

服务器未出现在Cursor中:

  1. 验证.cursor/mcp.json中的绝对路径
  2. 完全重启Cursor(Cmd+Q / Alt+F4)
  3. 检查MCP设置部分是否有错误消息

权限错误:

chmod +x dist/index.js

构建错误:

npm run clean
npm install
npm run build

缓存问题:

# 清除npm缓存
npm cache clean --force

# 重新构建
npm run clean && npm run build

贡献

  1. 分叉仓库
  2. 创建您的功能分支(git checkout -b feature/amazing-feature
  3. 提交更改(git commit -m '添加惊人的功能'
  4. 推送到分支(git push origin feature/amazing-feature
  5. 打开拉取请求

许可证

Apache-2.0许可证 - 详情请参阅LICENSE文件。