DevDash MCP服务器
模型上下文协议(MCP)服务器为Claude Code提供DevDash开发和调试工具。
建筑
Claude Code CLI
│
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────┐
│ devdash-mcp (Python) │
│ │
│ ┌─────────────┐ ┌─────────────────┐ │
│ │ qml-gauges │ │ Screenshot │ │
│ │ (WebSocket) │ │ (X11) │ │
│ └──────┬──────┘ └────────┬────────┘ │
│ │ │ │
│ ┌──────┴──────┐ ┌────────┴────────┐ │
│ │ devdash │ │ devdash │ │
│ │ (Telemetry) │ │ (Logs) │ │
│ └─────────────┘ └─────────────────┘ │
└─────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ QML Gauges │ │ DevDash │
│ Explorer │ │ (DevTools) │
│ (port 9876) │ │ (port 18080) │
└─────────────────┘ └─────────────────┘安装
# Install in development mode
pip install -e .
# Or install normally
pip install .系统要求
通过X11进行屏幕截图:
# Ubuntu/Debian
sudo apt install wmctrl imagemagick scrot配置
1.创建本地.env文件
复制示例配置并为您的设置进行自定义:
cd devdash-mcp
cp .env.example .env
# Edit .env with your paths2.将MCP服务器添加到Claude Code
添加到 .mcp.json 在项目根目录中:
{
"mcpServers": {
"devdash": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "/path/to/devdash-mcp"
}
}
}环境变量
配置可以在中设置 .env 或作为环境变量:
| 变量 | 默认值 | 描述 |
|---|---|---|
DEVDASH_EXPLORER_WS_PORT | 9876 | 浏览器WebSocket端口 |
DEVDASH_EXPLORER_WS_HOST | localhost | 资源管理器WebSocket主机 |
DEVDASH_DEVTOOLS_PORT | 18080 | DevTools HTTP API端口 |
DEVDASH_DEVTOOLS_HOST | 127.0.0.1 | DevTools HTTP API主机 |
DEVDASH_QML_GAUGES_PATH | (必填) | qml仪表库的绝对路径 |
可用工具
qml仪表库(qml仪表资源管理器)
| 工具 | 说明 |
|---|---|
qml_explorer_build | 构建资源管理器(cmake-config+Build) |
qml_explorer_launch | 使用正确的库路径启动资源管理器 |
qml_explorer_kill | 终止正在运行的资源管理器进程 |
qml_explorer_get_state | 获取当前页面和属性值 |
qml_explorer_navigate | 导航到组件页面 |
qml_explorer_get_property | 获取单个属性值 |
qml_explorer_set_property | 设置属性值 |
qml_explorer_list_properties | 列出带有元数据的可用属性 |
devdash-repo(通过HTTP API运行devdash)
| 工具 | 说明 |
|---|---|
devdash_telemetry_get_state | 获取当前车辆遥测数据(RPM、temps等) |
devdash_telemetry_get_warnings | 获取活动警告和警报 |
devdash_telemetry_list_windows | 通过DevTools列出DevDash窗口 |
devdash_telemetry_screenshot | 通过DevTools API截取截图 |
devdash_logs_get | 通过过滤(级别、类别、计数)检索日志 |
系统(X11窗口捕获-适用于任何窗口)
| 工具 | 说明 |
|---|---|
screenshot_list_windows | 列出可用窗口 |
screenshot_capture | 将窗口捕获为PNG格式 |
用法示例
User: What QML Gauges windows are open?
Claude: [uses screenshot_list_windows] The DevDash Gauges Explorer is running.
User: Show me the explorer window
Claude: [uses screenshot_capture with window="explorer"] Here's the current view...
User: Navigate to the GaugeTick page
Claude: [uses qml_explorer_navigate with page="GaugeTick"] Navigated to GaugeTick.
User: What properties are available?
Claude: [uses qml_explorer_list_properties] Here are the available properties...
User: Set the tick color to red
Claude: [uses qml_explorer_set_property with name="color", value="#ff0000"] Done.
User: What's the current RPM?
Claude: [uses devdash_telemetry_get_state] Current RPM is 3500...发展
项目结构
devdash-mcp/
├── src/
│ ├── __init__.py
│ ├── server.py # FastMCP entry point
│ ├── config.py # Configuration management
│ └── tools/
│ ├── __init__.py
│ ├── explorer.py # qml-gauges: QML Gauges Explorer (WebSocket)
│ ├── screenshot.py # System: X11 window capture
│ ├── telemetry.py # devdash: Runtime telemetry (HTTP)
│ └── logs.py # devdash: Application logs (HTTP)
├── pyproject.toml
└── README.md添加新工具
- 在中创建新文件
src/tools/或添加到现有类别 - 创建
register_*_tools(mcp: FastMCP)功能 - 在中添加导入和注册
src/tools/__init__.py - 注册于
src/server.py
例子:
from mcp.server.fastmcp import FastMCP
def register_my_tools(mcp: FastMCP) -> None:
@mcp.tool()
def my_tool(param: str) -> dict:
"""Tool description."""
return {"result": param}故障排除
“无法连接到QML仪表资源管理器”
- 确保QML仪表资源管理器正在运行:
cd qml-gauges && ./build/explorer/qml-gauges-explorer - 检查WebSocket端口(默认值:9876)
“无法连接到DevDash”
- 确保DevDash正在运行:
cd devdash && ./build/dev/devdash --profile profiles/haltech-vcan.json - 检查HTTP端口(默认值:18080)
“找不到窗口”
- 使用
screenshot_list_windows查看可用窗口 - 窗口匹配是不区分大小写的子字符串搜索
“未能捕获屏幕截图”
- 安装
imagemagick或scrot - 确保窗口未最小化
