DivLens MCP
什么是 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.Related MCP server: GhostInTheShell MCP
✦ 17 种诊断工具
分类 | 工具 | 返回内容 |
⚡ 性能 |
| CPU 使用率、内存、交换空间、阻塞进程、运行时间 |
⚡ 性能 |
| 按 CPU/内存排序的顶级进程及 PID |
💾 存储 |
| 每个挂载点的空闲/已用/总空间 |
💾 存储 |
| 包含大小的完整文件类型清单 |
💾 存储 |
| 按扩展名分类的文件数量和大小 |
💾 存储 |
| 所有匹配特定扩展名的文件 |
💾 存储 |
| 前 50 个最大文件 + 陈旧数据分析 |
💾 存储 |
| IOPS、读写延迟、SMART 状态 |
🖥️ 硬件 |
| CPU/GPU 规格、电池百分比、温度、SMART |
🌐 网络 |
| 吞吐量、活动连接、信号强度 |
🌐 网络 |
| 每个适配器的 IP、DNS、接口配置 |
🔬 身份 |
| 操作系统、主机名、运行时间、机器指纹 |
🛠️ 开发栈 |
| Node、Python、Rust、Go、Java 运行时及包 |
🛠️ 开发栈 |
| 内核模块和设备驱动程序 |
📂 工具 |
| 递归目录列表及大小 |
🧠 记忆 |
| 对过往 AI 诊断结果进行语义搜索 |
📋 日志 |
| 按模式聚类的近期操作系统/内核错误 |
🚀 安装 — 一条命令,适用于任何平台
无需 Rust。无需编译。无需手动编辑配置。 安装程序会自动下载预构建的二进制文件并配置你的 AI 客户端。
macOS 和 Linux
curl -fsSL https://raw.githubusercontent.com/Lohithry/divlens-mcp/main/install.sh | bashWindows (PowerShell — 无需管理员权限)
irm https://raw.githubusercontent.com/Lohithry/divlens-mcp/main/install.ps1 | iex安装程序将:
✅ 检测你的操作系统和芯片架构(Apple Silicon / Intel / Linux / Windows)
✅ 从 GitHub Releases 下载正确的预构建二进制文件
✅ 验证 SHA-256 校验和
✅ 安装到你的 PATH 中,无需管理员权限
✅ 自动配置 Claude Desktop、Cursor、Windsurf 和 Antigravity
✅ 在完成前测试服务器是否正常工作
然后只需重启你的 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+P → Reload 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 贡献者。
This server cannot be deployed
Maintenance
Related MCP Connectors
An MCP memory server. One memory your agents share — across models, devices and apps.
Real-time planetary signal engine and Model Context Protocol (MCP) server for autonomous AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceMulti-machine system monitor with a built-in MCP server that enables AI agents to query health metrics, manage processes, schedule cron jobs, and run diagnostics across local and remote machines.133 npmApache 2.0
- AlicenseNot gradedqualityDmaintenanceA sandboxed, read-only MCP server that safely exposes system metrics, container diagnostics, and logs to AI agents with intelligent context compression and strict security measures.MIT
- AlicenseAqualityDmaintenanceHardware probe MCP server that provides deep hardware inventory and live sensor telemetry for AI agents, including CPU, memory, disk, GPU, and sensor data across platforms.6MIT
- AlicenseAqualityDmaintenanceA secure, read-only MCP server for AI-powered system monitoring. It provides real-time OS metrics, config discovery, and safe log tailing to enable autonomous infrastructure audits without shell access risks.41ISC