Skip to main content

serio-mcp

PyPI version Python Version CI License: MIT

serio-mcp is a high-performance Model Context Protocol (MCP) server that equips AI assistants (Claude Desktop, Cursor, Antigravity, VS Code) with reliable, zero-loss Serial / UART communication capabilities.

Engineered specifically for embedded Linux development, hardware debugging, router recovery (U-Boot / Bootloader), and IoT automation, featuring a dedicated Expect State-Machine Engine and a continuous background ingestion daemon to eliminate race conditions and dropped bytes.


✨ Features

  • Zero-Loss Background Daemon: A dedicated reader thread continuously ingests serial streams in the background—ensuring no characters or early bootlogs are dropped between tool calls.
  • 🎯 Atomic Expect Engine (serial_expect): Match multiple regular expressions or substring prompts (e.g. ['~ #', 'login:', 'Password:', 'IPQ807x#']) in real-time.
  • 🚀 Prompt-Aware Execution (serial_exec_expect): Send shell/bootloader commands and automatically wait for the prompt to return, returning clean, isolated output.
  • 🔌 Dynamic Port Discovery & Switching: Enumerate all attached hardware devices with VID/PID and switch ports or baud rates on the fly without restarting the server.
  • ⌨️ Raw Control Sequence Support: Send Ctrl+C (\x03), Enter (\r\n), break signals, and custom byte sequences.
  • 🛡️ Cross-Platform: Supports Linux, macOS, and Windows.

📦 Installation

Quick Start with uvx (Recommended)

No manual installation required! Run directly with uvx:

uvx serio-mcp

Installation with pip / pipx

pipx install serio-mcp
# or
pip install serio-mcp

⚙️ Configuration

1. Claude Desktop

Add this to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "serio": {
      "command": "uvx",
      "args": ["serio-mcp"]
    }
  }
}

2. Cursor IDE

Add to .cursor/mcp.json or Global Cursor Settings:

{
  "mcpServers": {
    "serio": {
      "command": "uvx",
      "args": ["serio-mcp"]
    }
  }
}

3. Antigravity / Google AI Assistant

Add to ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "serio": {
      "command": "uvx",
      "args": ["serio-mcp"]
    }
  }
}

🛠️ Available MCP Tools

Tool Description
serial_list_ports Enumerate all connected physical and virtual serial ports (with Device path, Description, VID, PID).
serial_configure Dynamically connect to or switch serial port (port='/dev/ttyUSB0', baudrate=115200).
serial_expect Atomically send an optional command and wait for prompt patterns (patterns=['# ', 'login:']).
serial_exec_expect Execute a command and automatically wait for the prompt to return, extracting clean output.
serial_send Send raw strings, keys, or escape sequences (e.g. \x03 for Ctrl+C, spaces for U-Boot intercept).
serial_read_buffer Non-blocking read of newly accumulated incoming stream from the background buffer.
serial_get_history Fetch recent line history captured by the background daemon.
serial_status Query connection health, baud rate, buffer usage, and background worker status.

💡 Practical Examples

1. Intercepting U-Boot Bootloader

// Tool call: serial_expect
{
  "patterns": ["IPQ807x#", "Hit any key to stop autoboot:"],
  "command": " ",
  "timeout": 15.0
}

2. Handling Login Prompts

// Step 1: Send username on login prompt
{
  "patterns": ["Password:", "# "],
  "command": "root",
  "timeout": 5.0
}

// Step 2: Send password on Password prompt
{
  "patterns": ["~ #", "# "],
  "command": "admin",
  "timeout": 5.0
}

3. Executing Shell Command

// Tool call: serial_exec_expect
{
  "command": "uname -a; ifconfig br0",
  "timeout": 5.0
}

🧪 Development & Testing

# Clone the repository
git clone https://github.com/weyou/serio-mcp.git
cd serio-mcp

# Set up virtual environment with uv
uv venv
source .venv/bin/activate

# Install in editable mode with development dependencies
uv pip install -e ".[dev]"

# Run tests
pytest -v

# Run linting
ruff check .

📄 License

This project is licensed under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

serio_mcp-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

serio_mcp-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file serio_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: serio_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for serio_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff2775cea32eb69e20faf5fd8c08abf784a7e77ba9c5ceff7f1f31e5f62f92a8
MD5 38f5b908b951f60a1c05199a44b17fee
BLAKE2b-256 61a51cb75aecdd0a0c442a671488e4aa37bc564176f7b40a40fc5eaed30a9527

See more details on using hashes here.

Provenance

The following attestation bundles were made for serio_mcp-0.1.0.tar.gz:

Publisher: publish.yml on weyou/serio-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file serio_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: serio_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for serio_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86e725551464aceebd3a341db531a1f5515dca7d5d56b64b7690c39108f46e58
MD5 794bf59bdda4d9a86067bdb54af69c5b
BLAKE2b-256 a10d33a2b233a312393d7d1955d3fe0279400a34191983af42142e1454175958

See more details on using hashes here.

Provenance

The following attestation bundles were made for serio_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on weyou/serio-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page