trezor仿真器MCP
用于控制内部运行的Trezor模拟器的MCP服务器 trezor-user-env Docker容器。
运作原理
连接到 trezor-user-env 端口9001上的WebSocket API发送命令(启动/停止、单击、输入、设置等),并通过端口5900上的VNC捕获屏幕截图。
模拟器GUI在Docker容器内使用虚拟显示器和VNC服务器呈现:
Emulator binary → renders GUI via SDL2 → Xvfb (virtual framebuffer)
↓
x11vnc (reads pixels from Xvfb)
↓
VNC protocol on port 5900
↓
websockify (TCP→WebSocket bridge)
↓
noVNC in browser on port 6080需求
trezor-user-env运行Docker容器,暴露端口9001、5900和6080python3随着venv
设置
跑 ./run.sh --它创造了 .venv (或使用 $TREZOR_EMULATOR_VENV),安装依赖项,并启动服务器。
MCP配置示例(VS代码)
{
"servers": {
"trezor-emulator": {
"type": "stdio",
"command": "/usr/bin/env",
"args": [
"bash",
"/absolute/path/to/trezor-emulator-mcp/run.sh"
]
}
}
}工具
| 工具 | 参数 | 描述 |
|---|---|---|
emulator_start | model, version?, wipe? | 使用给定的型号/固件启动模拟器 |
emulator_start_from_url | url, model, wipe? | 从固件URL启动模拟器 |
emulator_start_from_branch | branch, model, btc_only?, wipe? | 从git分支构建启动模拟器 |
emulator_stop | -- | 停止模拟器 |
emulator_setup | mnemonic, pin, passphrase_protection, label, needs_backup? | 使用种子和设置设置设备 |
emulator_wipe | -- | 擦除所有设备数据 |
emulator_apply_settings | label?, passphrase_always_on_device?, auto_lock_delay_ms? | 应用设备设置 |
emulator_get_features | -- | 获取设备特性/功能 |
emulator_get_debug_state | -- | 获取调试状态(布局、PIN、助记符) |
emulator_screenshot | -- | 通过VNC将显示捕获为PNG |
emulator_click | x, y | 触摸显示坐标(412×552) |
emulator_swipe | direction | 向上/向下/向左/向右滑动 |
emulator_press_yes | -- | 按下物理“是”按钮 |
emulator_press_no | -- | 按下物理“否”按钮 |
emulator_input | value | 键入文本(PIN、密码) |
emulator_ping | -- | 检查WebSocket连接 |
bridge_start | version? | 启动Trezor大桥 |
bridge_stop | -- | 停下Trezor桥 |
background_check | -- | 检查所有正在运行的服务的状态 |
