The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Serial MCP Server listing page.
serial-mcp-server provides serial port access for AI workflows in two forms:
Current release target: 0.3.0.
Language versions: English | Chinese
macro validate, macro list, macro plan, and macro run.Use macros when a serial workflow is more than a single read or write. Many devices require a timed sequence: send a command, wait a few milliseconds, read until a prompt or acknowledgement appears, then send the next command. A macro pack records that procedure as JSON so a human, CLI script, or AI agent can validate it, inspect the plan, simulate it without hardware, and run it against a real port when a device is attached.
Typical macro use cases:
OK, READY, PONG, prompts, or other expected responses.The v0.3 DSL is intentionally small:
send: write UTF-8, hex, or base64 bytes.delay: wait for a fixed number of milliseconds.expect: read until the response contains or equals expected bytes.assembly: compose named macros into a longer workflow.AI agents can discover macro support from this README, from the bundled skills/serial-debug skill, by running serial-mcp-server macro --help, or through MCP tool discovery when the server is configured. Agents that do not use MCP can still use the CLI plus the skill docs.
The binary is built at:
To install the CLI onto your PATH from a checkout:
Use the CLI when you want direct serial operations without an MCP client.
timeout-ms keeps its original one-read meaning: wait up to that many
milliseconds for one read operation, then return as soon as bytes are available.
Use --duration-ms when an AI or script needs one bounded collection window.
Capture mode keeps reading internally and returns one combined response with
completion_reason, waited_ms, elapsed_ms, and per-chunk metadata.
Capture options:
--duration-ms: collection window length after capture starts.--start-trigger first-byte: wait for the first byte before starting the
duration clock. This is the default for capture mode.--start-trigger immediate: start the duration clock when the command starts.--initial-timeout-ms: maximum wait for the first byte in first-byte mode.
If omitted, the command uses --timeout-ms.--idle-timeout-ms: stop after this many quiet milliseconds once capture has
started.--max-bytes: hard cap on the combined response bytes.write --read accepts the same capture options after the write:
Macro automation commands:
Macro packs are JSON files with schema_version set to 0.3. v0.3 supports send, delay, and expect steps inside macros, plus assemblies that call macros by name. expect supports contains and equals.
The macro DSL is intentionally restricted. It does not run shell commands, JavaScript, Python, file operations, loops, variables, if/else branches, Quick commands, or RTS/DTR macro steps.
Configuration commands:
CLI output rules:
--json output should be parseable by tools such as jq.Supported CLI data formats are utf8, hex, and base64. Use hex or base64 for binary payloads.
Use MCP when your client supports MCP tools and you want a long-running stdio server.
Recommended server command:
No-subcommand startup is retained as a compatibility path for existing MCP setups, but new configurations should use serve.
Claude Desktop example for macOS/Linux:
Windows example:
| Tool | Purpose |
|---|---|
list_ports | Discover available serial ports. |
open | Open a serial connection. |
write | Write UTF-8, hex, or base64 data to an open connection. |
read | Read data from an open connection with timeout handling or a bounded capture window. |
close | Close an open connection. |
set_control_lines | Set RTS and/or DTR on an open connection. |
macro_load | Validate and load an inline macro pack or pack file path into the server's in-memory registry. |
macro_list | List loaded macro packs, macros, and assemblies. |
macro_unload | Remove a loaded macro pack from the in-memory registry. |
macro_plan | Expand a loaded, inline, or file-backed macro or assembly without opening hardware. |
macro_run | Run a loaded macro or assembly against an existing connection or explicit simulation input. |
macro_run_inline | Validate, plan, and run an inline macro pack without storing it in the registry. |
The MCP macro registry is runtime-only. Restarting the server clears loaded packs, and the server does not write a persistent macro library.
MCP read accepts these optional capture fields in addition to
connection_id, timeout_ms, max_bytes, and encoding:
When duration_ms is absent, MCP read keeps the existing single-read
behavior. When duration_ms is present, the tool returns structured JSON text
with completion_reason, waited_ms, elapsed_ms, and chunks.
The repository includes a Claude Code and Codex compatible skill at:
The skill is CLI-first and documents MCP as an optional configured path. It is intended for agents that need to list ports, run serial smoke tests, run macro automation, control RTS/DTR, or troubleshoot UART/USB-serial devices.
For local development, copy the skill folder into the agent skill roots:
Tested explicit triggers:
Claude Code --bare mode did not resolve /serial-debug in local testing; use normal Claude Code print or interactive mode for skill-trigger smoke tests.
Serial commands can affect real hardware.
serial-mcp-server list-ports --json.The STM32 demo is under:
It provides firmware for an interactive serial command interface. See examples/STM32_demo/README.md for wiring, firmware commands, MCP usage, and CLI smoke commands.
Release work uses the checked-in Cargo.lock and these gates:
CLI smoke:
This project is licensed under the MIT License. See LICENSE.