English
MCP: let an AI client drive the app
SeaHi Serial ships a Model Context Protocol server inside the app process. Once a client (Claude Code, Cursor, VS Code, Cline…) connects, the model can open ports, send data, read BLE notifications and run workflows — through the same code paths as the UI, not a separate side channel.
How it runs
| Process | In-process with the app, started with it |
| Transports | Streamable HTTP (POST /mcp) and legacy SSE (GET /sse + POST /messages), same tools and sessions |
| Binding | Loopback only (127.0.0.1 / ::1 / localhost) |
| Auth | Token on every request (?token= or Authorization: Bearer); /healthz is the only unauthenticated endpoint and returns {"ok":true} |
| Toggle | MCP button in the title bar; state lives in ai-config.json |
Connect
bash
npx seahi-serial-mcp install # detect a running instance and write the client config
npx seahi-serial-mcp install --dry-run
npx seahi-serial-mcp status
npx seahi-serial-mcp uninstallYou can also copy the endpoint from the MCP dialog in the app.
Safety model
- Read-only mode: every write tool is rejected with
-32007; UI and config stay untouched. Only the user can turn it off. - Dangerous actions need
confirm:true, otherwise the tool returns-32006with the consequences spelled out. - Limits: sessions, queue length, request body (1 MiB) and call rate are all bounded; input array/string parameters are checked before the app is touched.
Tools
54 built-in tools in five families: app info, serial semantics, BLE (central), ADB, and UI/log access. The serial happy path:
serial_get_state → serial_select_port → serial_set_baud → serial_open
→ serial_send → serial_get_output → serial_closeThe full per-tool reference (arguments and return shapes) is generated from the source: MCP_TOOLS.md (Chinese).
