Ryan Malloy f9f5f3527f Add advanced pyserial features
Flow control:
- xonxoff, rtscts, dsrdtr in open_serial_port and configure_serial

Timeouts:
- write_timeout and inter_byte_timeout support

New tools:
- read_until: read until custom terminator (not just newline)
- set_rs485_mode: half-duplex RS-485 for industrial/Modbus
- set_low_latency_mode: reduce kernel buffering latency (Linux)
- set_break_condition: hold/release break state

Also:
- exclusive port locking option in open_serial_port
- updated get_connection_status with all new fields
2026-01-27 22:19:29 -07:00

MCP Serial Server

FastMCP server for serial port access via Model Context Protocol.

Features

  • Tools for serial port control (open, close, write, configure)
  • Dynamic Resources for reading data (serial://{port}/data)
  • Full pyserial support (baudrate, parity, stop bits, etc.)
  • Multiple concurrent port connections
  • Raw byte and text modes

Installation

# With uvx (recommended)
uvx mcserial

# Or install directly
uv pip install mcserial

Usage with Claude Code

# Add to Claude Code
claude mcp add mcserial "uvx mcserial"

Tools

Tool Description
list_serial_ports Discover available serial ports
open_serial_port Open a connection with config
close_serial_port Close a connection
write_serial Send text data
write_serial_bytes Send raw bytes
read_serial Read available data
read_serial_line Read until newline
configure_serial Change port settings
flush_serial Clear buffers
get_connection_status List open connections

Resources

URI Description
serial://ports List available ports
serial://{port}/data Read data from open port
serial://{port}/status Port configuration info
serial://{port}/raw Read as hex dump

Environment Variables

Variable Default Description
MCSERIAL_DEFAULT_BAUDRATE 9600 Default baud rate
MCSERIAL_DEFAULT_TIMEOUT 1.0 Read timeout (seconds)
MCSERIAL_MAX_CONNECTIONS 10 Max concurrent ports

Example Workflow

1. list_serial_ports → find /dev/ttyUSB0
2. open_serial_port(port="/dev/ttyUSB0", baudrate=115200)
3. write_serial(port="/dev/ttyUSB0", data="AT\r\n")
4. Read resource: serial:///dev/ttyUSB0/data
5. close_serial_port(port="/dev/ttyUSB0")

License

MIT

Description
MCP server for serial port communication — RS-232, RS-485, and file transfers
Readme 232 KiB
Languages
Python 100%