OpenMV MCP服务器
一 MCP(模型上下文协议) 用于通过HTTP+JSON-RPC 2.0控制OpenMV摄像机的服务器。
安装
Linux (x86_64/arm64):
curl -fsSL https://raw.githubusercontent.com/SingTown/openmv-mcp/main/install.sh | sh固定版本或选择其他安装目录:
curl -fsSL https://raw.githubusercontent.com/SingTown/openmv-mcp/main/install.sh | sh -s -- --version 2.3.1
curl -fsSL https://raw.githubusercontent.com/SingTown/openmv-mcp/main/install.sh | sh -s -- --dir ~/.local/binmacOS (苹果硅):
brew install SingTown/openmv/openmv-mcp视窗:
winget install SingTown.openmv-mcp或者从 发布 页面。
跑
openmv_mcp_server # default port 15257
openmv_mcp_server --port 9000 # custom port
openmv_mcp_server --level trace # verbose logging
openmv_mcp_server --version # print version and exit后台模式
与终端分离运行,以便服务器在shell关闭后继续运行:
openmv_mcp_server --daemon --log /tmp/openmv.log停止正在运行的服务器:
openmv_mcp_server --shutdown # default port 15257
openmv_mcp_server --shutdown --port 9000 # custom port旗帜: --daemon, -d (叉到背景), --shutdown (停止给定端口上正在运行的服务器), --log (重定向stdout/stderr;默认为 /dev/null 或 NUL), --level (日志级别: trace|debug|info|warn|error|critical|off,默认值 info).
MCP检查员
使用 mcp-inspector.json 随着 MCP检查员 用于调试:
npx @modelcontextprotocol/inspector --config mcp-inspector.jsonMCP工具
| 工具 | 说明 |
|---|---|
camera_list | 列出OpenMV摄像机及其连接状态 |
camera_connect | 通过串行端口路径连接到相机 |
camera_disconnect | 断开与摄像头的连接 |
camera_reset | 重置(重新启动)摄像头 |
camera_boot | 将相机重新启动到引导加载程序模式(用于固件闪烁) |
camera_info | 获取相机板/传感器/固件信息 |
script_run | 在相机上执行MicroPython脚本 |
script_stop | 停止当前运行的脚本 |
script_running | 检查脚本是否正在运行 |
script_output | 读取脚本输出(stdout/stderr) |
script_save | 将MicroPython脚本保存到相机USB驱动器上的main.py |
frame_capture | 以base64 JPEG格式捕获帧 |
frame_enable | 启用或禁用摄像头的帧流 |
license_register | 为连接的摄像头注册板密钥 |
HTTP流端点
| 端点 | 数据 | 格式 |
|---|---|---|
| `GET /stream/status?camera= | ||
| ` | 连接和脚本运行状态 | text/event-stream 上海证券交易所 |
| `GET /stream/frame?camera= | ||
| ` | 帧缓冲区 | multipart/x-mixed-replace; boundary=frame (MJPEG) |
| `GET /stream/terminal?camera= | ||
| ` | 终端输出 | text/plain; charset=utf-8 (大块) |
许可证
麻省理工学院
