Serial MCP

io.github.qarnet由 GitHub 帳號 qarnet 發布v0.9.3更新於 Oct 24, 2026

MCP server for serial port communication. 25 tools, resources, prompts, and stdio/HTTP transports.

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

讓助理開啟、讀取、寫入並解析序列埠,用於 UART 與 USB 序列埠嵌入式裝置。

可以做什麼
提供 25 個序列埠工具:裝置探索(list_ports、list_connections)、連線生命週期(open、close、reconnect、reconfigure)以及 I/O(read、write、transact、capture_boot、flush)。常開的環形緩衝區持續擷取接收位元組,分幀與解析器涵蓋行、分隔符、長度前綴、起訖符、SLIP、COBS,以及 AT、JSON、shell、NMEA-0183、Modbus ASCII,並支援總和檢查碼驗證。裝置設定檔可持久保存學到的設定,日誌可匯出為 JSONL。
適用情境
適合助理需要透過序列埠直接與微控制器、Arduino 或 STM32 開發板等嵌入式目標通訊的情境,包括開機載入程式重置與開機橫幅擷取。適用於命令與回應互動、非請求資料讀取以及協定感知解析,而非一般序列埠監看工具。
執行需求
以本機程序在使用者機器上執行(僅桌面端),預設使用 stdio,也可用 --transport=http 走 HTTP。可透過 Cargo、Nix 或各平台預先建置的執行檔安裝。在 Linux 上,使用者需加入 dialout 群組才能存取序列埠。未宣告任何帳號、API 金鑰或環境變數。
安裝前請注意
它會讀寫硬體序列埠,送出的命令可能重置、重新設定或改變所連接的裝置。序列埠存取由 --allowlist 選項控制,未設定時範圍更廣。透過 export_log 的持久擷取會寫入 JSONL 檔案,未設定 --capture-dir 時為停用狀態。設定檔存放區是一個共用的 TOML 檔案,可用 --profiles-path 隔離。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Serial MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

serial-mcp for UART and USB serial access

[GitHub Release] [crates.io] [Rust] [License]

serial-mcp is an MCP server for direct access to serial ports. It reads, writes, and streams UART or USB-serial data to microcontrollers, Arduino boards, STM32 chips, and other embedded targets. Reads use timeouts and pattern matching instead of blocking on a serial monitor.

The server provides always-on RX capture. It decodes TX and RX frames using line, delimiter, length-prefixed, start/end, SLIP, and COBS formats. It provides AT, JSON, shell, NMEA-0183, and Modbus ASCII parsers.

Protocol presets provide checksum validation. The server also supports auto-reconnect, event logging, DTR/RTS, BREAK, and flow control. MCP clients can use these features with serial bootloaders, resets, and embedded boards.

Quick start

  1. Install the server. See Install for Cargo, Nix, and prebuilt binary options.
  2. Connect an agent. Follow the agent configuration guide, or use the example below.
  3. Discover devices. Call list_ports() and inspect profile_matches. The result shows what a bare open would reuse.
  4. Open a port. Call open(port=...) with only the port. Baud defaults to 115200/8-N-1. The server reuses the most recently used high-confidence profile for a known device. It creates a durable generated profile for a new device.
  5. Talk to the device. Use transact() for command and response exchanges. Use read() for buffered or unsolicited data. Use write() for send-only operations.

Capabilities

AreaWhat it provides
RX modelAn always-on ring buffer captures bytes from open to close. read returns buffered bytes immediately. It can also wait, match, and replay history.
Framing and parsingBoth directions support line, delimiter, length-prefixed, start/end, SLIP, and COBS framing. Parsers include AT, JSON, shell, NMEA-0183, and Modbus ASCII.
Protocol presetsSeven presets are available. They are at_command, slip, json_lines, cobs, ndjson, nmea0183, and modbus_ascii. Checksum validation is included.
Device profilesThe server creates automatic profile sessions. High-confidence devices get durable generated profiles. Learned settings persist across sessions.
Boot capturecapture_boot handles Arduino auto-reset, power-cycle banners, and boot prompts in one atomic call.
ReliabilityRing wrap is reported through bytes_lost. Encoding fallback is lossless. The server also supports auto-reconnect and reports partial failures.
OperationsEvent logging supports persistent JSONL capture through export_log. The server also provides port allowlisting and stdio and HTTP transports.

Tool catalog (25 tools)

GroupTools
Discoverylist_ports, list_connections
Connection lifecycleopen, close, reconnect, get_status, reconfigure
I/Oread, write, transact, capture_boot, flush
Line controlset_dtr_rts, set_flow_control, send_break
Profiles & configlist_profiles, open_profile, save_profile, delete_profile, configure, rollback_profile
Logs & captureget_log, clear_log, export_log
Utilitycompute_checksum

Resources and prompts

KindItems
Resources (5)serial://ports, serial://connections (static); serial://connections/{id}, serial://connections/{id}/raw, serial://connections/{id}/log (templates)
Prompts (2)diagnose_port, interactive_terminal

Install

Cargo (all platforms)

bash
cargo install serial-mcp

Nix

bash
nix profile install github:qarnet/serial-mcp

Prebuilt binary

No toolchain is required. Each release publishes one binary per platform. The latest/download URLs resolve to the newest release.

PlatformCommand
Linux x86_64curl -L https://github.com/qarnet/serial-mcp/releases/latest/download/serial-mcp-x86_64-linux -o serial-mcp && sudo install -m 755 serial-mcp /usr/local/bin/
Linux ARM64Same command with the serial-mcp-aarch64-linux asset
macOS (Apple Silicon)Same command with the serial-mcp-aarch64-macos asset
Windows (x86_64)Download serial-mcp-x86_64-windows.exe and place it on your PATH

On Linux, add your user to the dialout group for port access:

bash
sudo usermod -aG dialout $USER

Connect an agent

For client-specific setup, see the agent configuration guide. It covers Claude Code CLI, Claude Desktop, Cursor, VS Code, Zed, opencode, Codex, Hermes, and HTTP transport.

Quick example (Claude Code, Linux/macOS)
json
{  "mcpServers": {    "serial": {      "type": "stdio",      "command": "serial-mcp",      "args": ["--allowlist=/dev/ttyACM*,/dev/ttyUSB*"]    }  }}

Core workflow

Use this sequence for common work: discover, open, talk, verify the learned profile, then use advanced tools when needed.

  1. Call list_ports(). Its profile_matches entries correspond to ports.
    • selected means a bare open reuses selected_profile.
    • ambiguous means equal-ranked profiles require open_profile.
    • duplicate, ineligible, and none mean a bare open starts fresh or transient.
  2. Call bare open(port=...). The result includes the profile binding. The binding reports its name, source, confidence, persistence, generated flag, revision, and dirty state.
  3. Use transact(data=..., match=..., timeout_ms=...) to write and await a response in one call. Use read() for buffered or unsolicited data.
  4. After reconfigure, set_flow_control, or connection-mode configure, inspect profile_persistence. It reports persisted, not_needed, transient, or failed. Also inspect the updated profile binding.
  5. Call close(). A clean close retries a dirty binding as a safety measure.

For boot and reset capture, call capture_boot. It handles Arduino auto-reset, power-cycle banners, and boot prompts.

The call purges unread OS input. It marks the RX live edge. It can pulse DTR/RTS, with guaranteed release. It captures only post-mark bytes on a private cursor. The result is bounded in memory and does not write a file. See RX and reading for the from cursor model. See Device profiles for profile behavior.

Protocols

The protocol field supplies framing and parser defaults for both directions. NMEA and Modbus ASCII presets validate checksums:

PresetWire nameFraming / parser
AT commandsat_commandLine (CR) + AT parser
SLIPslipRFC 1055 byte stuffing
JSON linesjson_linesLine + JSON-lines parser
COBScobsConsistent Overhead Byte Stuffing
NDJSONndjsonLine + JSON-lines parser, skips blank lines
NMEA-0183nmea0183Start/end $/! + NMEA parser, *XX checksum
Modbus ASCIImodbus_asciiStart/end : + Modbus ASCII parser, LRC

Field precedence is explicit call field, call-time preset, connection default, then connection preset. The Protocol guide documents this order, checksum behavior, and the framing and parser reference.

Key concepts and guides

GuideWhat it covers
RX and readingRing buffer and shared cursor. Tagged from forms. Timeouts, silence, and matching. Ring wrap and bytes_lost. Encoding fallback, flow control, capture_boot, and subscriptions.
Device profilesprofile_matches outcomes and identity rules. Generated and reused selection. Learning, revision CAS, rollback, and deletion guards.
Persistent captureThe export_log contract. Quotas, portable filenames, atomicity, and failure semantics.
Agent configurationClient setup. HTTP transport. Troubleshooting.
Protocol guideFraming and parsers. Presets and precedence. Checksum behavior.
Documentation indexUser and development guides

Transports and options

ModeHow to activateUse case
stdiodefaultDesktop agents
HTTP--transport=httpRemote and headless use
CLI options
serial-mcp [OPTIONS]
  --transport <stdio|http>          Transport to use (default: stdio)  --allowlist <patterns>            Comma-separated glob patterns for allowed ports  --bind <addr>                     HTTP bind address (default: 127.0.0.1:8000)  --max-program-buffered-bytes <N>  Global budget for all in-flight RX tools  --max-tool-buffered-bytes <N>     Per-tool ceiling for max_buffered_bytes  --profiles-path <path>            Profile store file path (default: OS user config dir + serial-mcp/profiles.toml)  --capture-dir <absolute-dir>      Enable persistent export_log capture into an existing absolute directory (disabled by default; no fallback to cwd/config/temp)  --capture-max-file-bytes <N>      Per-file quota for a capture JSONL snapshot (default: 16777216 / 16 MiB)  --capture-max-total-bytes <N>     Total-byte quota across committed capture files (default: 268435456 / 256 MiB)  --capture-max-files <N>           File-count quota across committed capture files (default: 256)  -V, --version                     Print version and exit (also: `serial-mcp version`)  -h, --help                        Print help
  RUST_LOG                   Log level env var (error/warn/info/debug/trace)

The profile store is one TOML file shared by every session. Use --profiles-path for an isolated store. See Device profiles.

Persistent capture

export_log writes portable .jsonl filenames into the --capture-dir root. It never accepts arbitrary paths and never overwrites files. See Persistent capture.

MCP compatibility

serial-mcp supports MCP 2025-11-25. This version uses the legacy session lifecycle.

It also supports MCP 2026-07-28. This version uses modern discovery and stateless requests with SEP-2549 cache fields. Both stdio and HTTP transports support the port allowlist.

CI runs official conformance checks and Inspector interoperability checks. The validation tools come from the committed npm lockfile. CI installs them with npm ci --ignore-scripts. It runs them as local binaries, never through npx.

An actual historical rmcp 1.7.0 client tests backward compatibility over HTTP and stdio. Run the complete local and CI version gate with:

bash
bash scripts/test-mcp-compat.sh

Development

Before pushing or opening a pull request, run cargo fmt --all. CI runs cargo fmt --all -- --check once in standalone Ubuntu format job first. Formatting failures block dependent expensive Nix, build/test/Clippy, and MCP conformance jobs.

bash
cargo test --lockedcargo clippy --all-targets --locked -- -D warningscargo fmt --all -- --check
# Linux-only required Rust PTY fixture suitescargo test --locked --test device_fixture -- --test-threads=1cargo test --locked --test device_command_parity -- --test-threads=1cargo test --locked --test device_framing_parity -- --test-threads=1cargo test --locked --test device_protocol_parity -- --test-threads=1cargo test --locked --test device_parity_repeat public_boundary_repeat_gate -- --ignored --test-threads=1

Production-path real-PTY fixture tests run on Linux. macOS and Windows run normal Rust build/test/clippy plus controlled-backend coverage.

Documentation and status

The product backlog tracks planned and in-progress work, and the documentation index links user guides, reference contracts, and reports. Report issues and feature requests on the tracker.

MCP registry

The package is available on the MCP Registry as:

mcp-name: io.github.qarnet/serial-mcp

License

MIT. See LICENSE.

來源:README.md,提交 a76f02f

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.9.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分