Skip to main content
Glama
Lohithry

DivLens MCP

by Lohithry

什么是 DivLens MCP?

DivLens MCP 是一个使用 Rust 编写的高性能 模型上下文协议 (MCP) 服务器。

它架起了 AI 助手与你的机器之间的桥梁 —— 让 Claude、Cursor、Windsurf 以及任何其他兼容 MCP 的智能体能够实时、结构化地访问硬件传感器、存储指标、网络诊断、进程树、开发运行时、系统日志等信息。

无需云端。无需 API 密钥。无需配置。只需构建并运行即可。

"Why is my Mac slow?" → Claude calls get_live_metrics() → Instant answer.
"Is my SSD healthy?"  → Claude calls get_hardware_diagnostics() → SMART data returned.
"What's eating disk?"  → Claude calls get_advanced_storage_stats() → Largest files listed.

✦ 17 种诊断工具

分类

工具

返回内容

性能

get_live_metrics

CPU 使用率、内存、交换空间、阻塞进程、运行时间

性能

get_process_list

按 CPU/内存排序的顶级进程及 PID

💾 存储

get_storage_health

每个挂载点的空闲/已用/总空间

💾 存储

scan_storage_inventory

包含大小的完整文件类型清单

💾 存储

get_file_type_summary

按扩展名分类的文件数量和大小

💾 存储

get_specific_file_type

所有匹配特定扩展名的文件

💾 存储

get_advanced_storage_stats

前 50 个最大文件 + 陈旧数据分析

💾 存储

get_storage_diagnostics

IOPS、读写延迟、SMART 状态

🖥️ 硬件

get_hardware_diagnostics

CPU/GPU 规格、电池百分比、温度、SMART

🌐 网络

get_network_diagnostics

吞吐量、活动连接、信号强度

🌐 网络

get_network_config

每个适配器的 IP、DNS、接口配置

🔬 身份

get_system_dna

操作系统、主机名、运行时间、机器指纹

🛠️ 开发栈

get_dev_stack

Node、Python、Rust、Go、Java 运行时及包

🛠️ 开发栈

get_drivers

内核模块和设备驱动程序

📂 工具

scan_directory

递归目录列表及大小

🧠 记忆

recall_memory

对过往 AI 诊断结果进行语义搜索

📋 日志

get_system_logs

按模式聚类的近期操作系统/内核错误


🚀 安装 — 一条命令,适用于任何平台

无需 Rust。无需编译。无需手动编辑配置。 安装程序会自动下载预构建的二进制文件并配置你的 AI 客户端。

macOS 和 Linux

curl -fsSL https://raw.githubusercontent.com/Lohithry/divlens-mcp/main/install.sh | bash

Windows (PowerShell — 无需管理员权限)

irm https://raw.githubusercontent.com/Lohithry/divlens-mcp/main/install.ps1 | iex

安装程序将:

  • ✅ 检测你的操作系统和芯片架构(Apple Silicon / Intel / Linux / Windows)

  • ✅ 从 GitHub Releases 下载正确的预构建二进制文件

  • ✅ 验证 SHA-256 校验和

  • ✅ 安装到你的 PATH 中,无需管理员权限

  • ✅ 自动配置 Claude DesktopCursorWindsurfAntigravity

  • ✅ 在完成前测试服务器是否正常工作

然后只需重启你的 AI 客户端并询问 “现在是什么进程占用了我的 CPU?”


从源码构建(高级)

需要 Rust 1.82+。

git clone https://github.com/Lohithry/divlens-mcp.git
cd divlens-mcp/apps/core
cargo build --release
./target/release/divlens-core --mcp

连接到你的 AI

Claude Desktop

配置文件:~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "divlens": {
      "command": "/usr/local/bin/divlens-core",
      "args": ["--mcp"]
    }
  }
}

退出并重启 Claude Desktop。看到 🔌 插头图标即表示连接成功。

Cursor

配置文件:~/.cursor/mcp.json

{
  "mcpServers": {
    "divlens": {
      "command": "/usr/local/bin/divlens-core",
      "args": ["--mcp"]
    }
  }
}

Cmd+Shift+PReload Window (重新加载窗口)

Windsurf

配置文件:~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "divlens": {
      "command": "/usr/local/bin/divlens-core",
      "args": ["--mcp"]
    }
  }
}

有关完整的设置详情,请参阅 DEPLOYMENT.md


工作原理

  ┌─────────────────────────────────────────┐
  │   AI Client  (Claude / Cursor / etc.)   │
  │         LLM reasoning lives here        │
  └──────────────────┬──────────────────────┘
                     │  JSON-RPC 2.0  (stdio)
                     ▼
  ┌─────────────────────────────────────────┐
  │          divlens-core  (Rust)           │
  │                                         │
  │  ┌───────────────┐  ┌───────────────┐   │
  │  │  MCP Layer    │  │  17 Tools     │   │
  │  │  (JSON-RPC)   │  │  (Rust + OS)  │   │
  │  └───────────────┘  └───────────────┘   │
  │  ┌───────────────┐  ┌───────────────┐   │
  │  │  SQLite Cache │  │  Native APIs  │   │
  │  │  (sysinfo/OS) │  │  (IOKit/WMI)  │   │
  │  └───────────────┘  └───────────────┘   │
  └─────────────────────────────────────────┘

      Zero cloud.  Zero API keys.  100% local.

传输: 每个 MCP 消息都是通过 stdio 传输的换行符分隔的 JSON-RPC 2.0 对象。 AI 逻辑: DivLens 从不运行 LLM 推理 —— 它仅收集并返回原始系统数据。 隐私: 所有数据都保留在你的机器上。不会发送到任何地方。


项目结构

divlens-mcp/
└── apps/
    └── core/                      # Rust MCP engine
        ├── src/
        │   ├── tools/             # 17 tool implementations
        │   ├── mcp/               # JSON-RPC 2.0 protocol handler
        │   ├── mcp_server.rs      # stdio transport loop
        │   ├── collectors/        # Native OS data collectors
        │   │   ├── volatile/      # CPU, RAM, network (live)
        │   │   ├── persistent/    # Storage, hardware (cached)
        │   │   └── ondemand/      # Drivers, logs, packages
        │   ├── modules/           # Core business logic
        │   ├── db/                # SQLite caching layer
        │   ├── models/            # Shared data types
        │   └── utils/             # Shell env rehydration
        ├── Cargo.toml
        └── env.example

可选:语义记忆

启用 vector-memory 功能,通过本地 ONNX 嵌入模型为 recall_memory 提供真正的语义搜索(无需云端,无需 API 密钥):

cargo build --release --features vector-memory

启用后,DivLens 会创建一个本地 LanceDB 向量存储,并使用 fastembed 对过往诊断进行语义嵌入和检索。

禁用时(默认),recall_memory 将返回空列表 —— 不会影响其他功能。


验证服务器

在没有客户端的情况下测试 MCP 有线协议:

# Initialize handshake
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"test","version":"0.1"}}}' \
  | divlens-core --mcp

# Call a tool directly
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_live_metrics","arguments":{}}}' \
  | divlens-core --mcp

许可证

采用 Apache License, Version 2.0 许可。 请参阅 LICENSE 获取全文。

版权所有 © 2024 DivLens 贡献者。


F
license - not found
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Lohithry/divlens-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server