
cjznb/serialhub
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
常驻串口中枢:持久多口 + 每口环形缓冲(毫秒时间戳/全局序号) + Web UI(xterm/ANSI/中英) + TCP 桥 + MCP,面向 AI agent。Persistent serial hub daemon with Web UI, TCP bridge and an MCP server.
概要
Turn one or more serial ports into a service that's : - holds ports open and appends every line into a per-port (global monotonic seq + epoch-ms ts_ms). - (xterm.js) watches several ports live and lets you filter, search, export, and send. - expose the whole feature set; the and the share the same thin client. - relays a port over TCP (server listen / client dial-out). - let an agent block on a sentinel with wait_for and resume with a since_seq cursor, . The design contract (data model / Hub / REST / CLI / MCP, all frozen) is in docs/ARCHITECTURE.md. The MCP-specific guide is in docs/MCP.md (Chinese: docs/MCP.zh-CN.md). python -m serialhub serve --config config.example.yaml starts the daemon, then open http://127.0.0.1:8765/ in a browser; both python -m serialhub list on the command line and MCP wait_for work right away. After installing, two equivalent entry points: Open http://127.0.0.1:8765/ in a browser to see the Web UI. Config is (.yaml/.
README
以下は原文 README の抜粋です。原文を見る。
English · 简体中文
serialhub · Persistent Serial Hub
Turn one or more serial ports into a persistent, reviewable, incrementally readable service that’s very agent-friendly:
- The daemon holds ports open and appends every line into a per-port ring buffer (global monotonic
seq+ epoch-msts_ms). - Web UI (xterm.js) watches several ports live and lets you filter, search, export, and send.
- REST + WebSocket expose the whole feature set; the CLI and the MCP server share the same thin client.
- The TCP bridge relays a port over TCP (server listen / client dial-out).
- MCP tools let an agent block on a sentinel with
wait_forand resume with asince_seqcursor, without re-consuming.
The design contract (data model / Hub / REST / CLI / MCP, all frozen) is in
docs/ARCHITECTURE.md. The MCP-specific guide is indocs/MCP.md(Chinese:docs/MCP.zh-CN.md). The DSH (DeepSeek Harness) integration walkthrough is indocs/DSH.md(Chinese:docs/DSH.zh-CN.md).
0. In one line
python -m serialhub serve --config config.example.yaml starts the daemon, then open http://127.0.0.1:8765/
in a browser; both python -m serialhub list on the command line and MCP wait_for work right away.
You can run the entire pipeline without hardware by using loop://.
1. Features at a glance
| Capability | Description |
|---|---|
| Persistent multi-port | One reader thread per port; held open and reconnected with exponential backoff on disconnect (old buffer is kept) |
| Auto-discovery | A port may use a match spec instead of a fixed device; resolved at open and re-resolved on every reconnect, so a replugged adapter on a new COM is still found |
| Ring buffer | Per port, evicts the oldest lines on a dual threshold of line count + bytes; default 20000 lines / 8 MiB |
| Global sequence | seq is monotonic across all ports and thread-safe; ts_ms is the epoch-ms receive time |
| Line kind | kind ∈ {rx, tx, mark}: received / sent by this process (echo) / marker |
| No double consumption | read supports since_seq / since_ts cursors and returns next_seq for resuming |
| Blocking sentinel | wait_for blocks until a line matches a regex; a timeout is not an error (matched:false, still ok:true) |
| Search | search runs a regex over the whole buffer, optionally with a context window |
| Export | raw / noansi / json (JSONL) to disk |
| REST + WS | Every CLI action has a matching REST endpoint; /ws pushes live line events |
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"serialhub": {
"command": "python",
"args": ["<path-to-serialhub>/serialhub/mcp_server.py"],
"env": { "SERIALHUB_URL": "http://127.0.0.1:8765" }
}
}
}