
Smolmux Mcp
io.github.magnusmalm由 GitHub 帳號 magnusmalm 發布v0.5.2更新於 Oct 25, 2026
Serial console MCP server over a smolmux broker: shared UART, send/expect, history, boot stages.
概覽
連接到執行中的 smolmux broker 的 MCP 伺服器,讓助理操作共用的序列埠主控台:送出指令、讀取輸出、追蹤開機階段。
- 可以做什麼
- 對序列埠裝置送出指令並讀取輸出,支援送出後等待符合的回應
- 讀取帶時間戳的輸出歷史,讓較晚加入的用戶端重播裝置已印出的內容
- 檢視開機狀態:有序開機階段、停滯事件與開機進度
- 管理常駐自動回應規則,在出現特定樣式時自動回覆
- 中斷 U-Boot 自動開機,並與需要佔用序列埠的燒錄工具搭配使用
- 可選搭 GDB MCP 伺服器進行中斷點、單步執行、暫存器讀取與未知板卡探測
- 適用情境
- 適合 Linux 上的嵌入式與韌體開發:需要助理觀察或驅動板卡序列埠主控台的情境,例如新板卡 bring-up、U-Boot 打斷、開機問題排查,以及在監看程式、腳本與燒錄工具之間共用同一個 UART。
- 執行需求
- 需要 Linux 以及一個執行中並持有裝置的 smolmux broker(需從原始碼建置:C11 編譯器、CMake 3.21+、含 kconfiglib 的 Python 3);MCP 伺服器透過依埠名自動探索的 Unix socket 連線 broker。本機 stdio 程序;清單未宣告任何套件或憑證。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Smolmux Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
smolmux
A portable C11 device multiplexer. Holds a device connection open (serial UART, GDB stub) and multiplexes access to multiple clients over Unix sockets using newline-delimited JSON.
Single static binary, low latency, small footprint - built for daily serial and GDB bring-up on Linux.
New here? docs/START-HERE.md is a one-screen router - find your intent (run it, bring up a new board with an AI agent, understand the architecture, hack on the code) and it points you to the right doc.
One port, three clients
One broker holds an ESP32-S3's UART. The monitor (top) watches it live. In the
bottom pane a script sends temp and gets the reply on the same wire, resets
the board and waits for its prompt, then esptool reads the flash ID through
with-port: the broker suspends, esptool runs, the broker resumes, and the
monitor never loses the port.
Example: probe an unknown board
One broker holds SWD; smolmux-gdb-mcp runs probe_unknown_board. On a
SAM C21 Xplained Pro that path decoded Cortex-M0+ from CPUID, named the
part via SAM DSU DID, rejected a false STM32 match, and wrote a starter
*.gdb-profile.json. Tools, register values, and profile shape:
docs/demo-samc21-probe-transcript.md.
Day-to-day serial (multi-client, U-Boot break-in, flasher handoff): docs/daily-driver.md.
Features
- Serial UART, GDB MI, and serial-over-TCP (telnet + RFC2217) device links via vtable polymorphism
- Multiple concurrent clients over Unix sockets with role-based access (observer/controller/takeover)
- Expect engine - concurrent regex matching on the device byte stream with timeouts
- Anomaly detection - pattern-based crash/error detection with cooldown and incident tracking
- Output history - timestamped ring buffer for replay by late-joining clients
- Structured logging - JSONL I/O log + human-readable text log with rotation
(the I/O log records everything sent to and from the device, including
anything typed at a login prompt — it is created
0600under your private state directory, and smolmux refuses to write it through a symlink or to a file owned by another user) - Network sinks - TCP and WebSocket for remote access (loopback by default).
The wire protocol is cleartext, and any client that completes the handshake
gets full control of the device — console writes, pins, BREAK, SysRq, GDB.
On loopback without
--auth-token, the broker generates a token into a0600file in$XDG_RUNTIME_DIR(or/tmp), so other local users and processes cannot connect; your ownsmolmux-monitor/smolmux-mcpread it automatically, andsmolmux-cli tokenprints it. For remote use, keep the bind on loopback and reach it over an SSH tunnel or WireGuard rather than exposing the port; smolmux refuses to serve a non-loopback TCP bind with no--auth-token.--insecure-no-authturns both protections off. - MCP servers - standalone
smolmux-mcp/smolmux-gdb-mcpattach to a running broker; optional in-process--mcpsink for single-process stdio - Boot tracking & autoresponder - ordered boot stages, stall events, standing expect->send rules
- Autoboot interrupt - broker-side key flood (and optional DTR/RTS reset) for
bootdelay=0U-Boot - Device profiles / board manifests - JSON configs for prompts, anomalies, multi-wire boards
- Auto-reconnect - exponential backoff recovery on USB-serial disconnect
- Build-time feature selection - Kconfig-based; UART-only builds carry no GDB/TCP/WebSocket code
Quick start
Prerequisites: Linux, a C11 compiler, CMake 3.21+, Python 3 with
kconfiglib (the configure step
generates the feature header with it). libpcre2-8 is optional; without it
regex matching falls back to POSIX.
Connect a client:
Day-to-day workflows (profiles, logs, U-Boot break-in, multi-wire boards): docs/daily-driver.md. Intent router: docs/START-HERE.md.
Build
Feature profiles
Or toggle features directly:
Developer benchmarks (e.g. the output coalescer harness) are off by default:
Interactive configuration:
Static builds
Usage
Wire protocol
Newline-delimited JSON over Unix sockets (also TCP/WS sinks). Binary data is base64-encoded. Message set covers session control, expect, history, anomaly, boot stages, autoboot flood, and autoresponder.
Full reference: ./build/smolmux --help-protocol (always matches this binary).
Client -> Broker: hello, send, send_expect, takeover, release, status, pin_control, set_baud, suspend, resume, history_request, incidents_request, configure_anomaly, interrupt_autoboot, configure_autoresponder, autoresponders_request
Broker -> Client: welcome, output, input_echo, expect_result, status_response, error, history_response, incidents_response, anomaly, autoboot_result, boot_stage, boot_stall, autoresponders_response, autoresponder_fired, suspended, resumed, link_down, link_up
Example session:
Architecture
See DESIGN.md for full architecture documentation.
Dependencies
Required: cJSON (vendored, single file)
Auto-detected: PCRE2 (libpcre2-8). Used as the regex engine when
present, because it bounds backtracking internally; the build falls back to
POSIX ERE automatically when it is absent, so it is never required. Force
either way with -DSM_ENABLE_PCRE2=ON (error if missing) or
-DSM_ENABLE_PCRE2=OFF.
Core has zero required external dependencies beyond POSIX + cJSON.
Companion tools
- smolmux-cli - command-line client (send commands, read output;
with-port <cmd>suspends the port, runs an external tool like a flasher, then always resumes) - smolmux-monitor - interactive terminal client with escape sequences (prefix key then a command; prefix defaults to Ctrl-], change with
-e, e.g.-e escor-e ^A) - smolmux-mcp - standalone MCP server: connects to a running broker and exposes serial tools (
serial_send_command,serial_read,serial_boot_status,serial_add_autoresponder, ...). Alternative: broker--mcpsink embeds MCP in-process. - smolmux-gdb-mcp - standalone MCP server for GDB debugging: 21 tools over a
broker holding a
--gdblink - breakpoints, stepping, backtrace, name-labeled registers, memory, expression eval, fault-register decode (where the core has them), peripheral reads,gdb_interrupt, and unknown-board probing on ARM Cortex-M today (gdb_identify_target/gdb_generate_profile; other architectures are planned). Resources and prompts includesmolmux-gdb://board-probingandprobe_unknown_board. Built whenSM_ENABLE_GDBis on; chip-ID validated on a SAM C21 Xplained Pro. - smolmux-watcher - daemon that monitors for anomalies and saves incident reports to disk
Related Documentation
- Start here - One-screen intent router (daily use, new board, architecture, hacking).
- MCP setup - Register
smolmux-mcp/smolmux-gdb-mcpwith Claude Code, Claude Desktop, or Cursor. - Daily driver - Recommended build, runtime flags, U-Boot break-in, boot stages, boards, coexistence with flashers.
- Board Exploration Workflow - Runbook for a fresh board (manually or with an AI agent): wires, SWD identify, console, peripherals.
- Board Bring-up Template - Copy-per-board fact-capture template.
- Persistent Serial Device Names - Stable names for UART dongles (
/dev/serial/rpi-consoleetc.). - Hardware validation matrix - What is validated on real hardware vs not yet proven.
- DESIGN.md / CLAUDE.md - Architecture and contributor map.
Free vs Pro
Everything in this repository is MIT-licensed - full source, wire protocol, generic device profiles, build system. Build it yourself and you have the complete product.
smolmux Pro is convenience, not a feature gate: prebuilt static binaries
(x86_64 + aarch64, musl, zero runtime dependencies), the curated profile pack
with per-profile notes, and 6 months of email support. One-time purchase
($79). MCP setup for zip paths is docs/MCP-SETUP-FULL.md (also in
this public tree).
Buy smolmux Pro - $79 one-time - download includes current static binaries and the profile pack.
License
MIT. cJSON is vendored under its own MIT license
(deps/cJSON/LICENSE).
來源:README.md,提交 b846879
工具
0版本歷史
3- v0.5.2最新Oct 4, 2026
- v0.5.1Oct 3, 2026
- v0.4.0Sep 30, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分