Serial ports meet the Model Context Protocol. Discover, configure, read, write, and transfer files -- RS-232, RS-422, RS-485, and 7 URL schemes, all callable as MCP tools.
Full RS-232 modem line control — RTS, DTR, CTS, DSR, break signals, device reset pulses. RS-422 mode for full-duplex differential links over long distances. RS-485 mode for half-duplex bus communication with automatic TX/RX direction, device scanning, and Modbus transactions.
File Transfers
Send and receive files over serial using XMODEM (128B blocks), XMODEM-1K, YMODEM (batch mode), or ZMODEM (streaming with auto-resume). Batch transfers supported for YMODEM and ZMODEM.
Network and Virtual Ports
Connect to serial-over-ethernet bridges via socket://, configure remote ports with rfc2217://, test without hardware on loop://, or debug traffic with spy://. Seven URL schemes total.
Baud Rate Detection
Omit the baud rate when opening a port and mcserial will detect it automatically by analyzing data patterns, sync bytes, and byte distributions. Returns a confidence score and ranked candidates.
Install mcserial and register it with your MCP client:
Terminal window
# Add to Claude Code (one-time setup)
claudemcpaddmcserial--uvxmcserial
Then ask your assistant to work with serial ports. It calls the tools behind the scenes:
list_serial_ports() # find available ports
open_serial_port(port="loop://", baudrate=9600) # open (loop:// = no hardware needed)
write_serial(port="loop://", data="hello\n") # send data
read_serial(port="loop://") # read response
close_serial_port(port="loop://") # release the port
You interact in natural language — “list my serial ports,” “open the loopback port at 9600 baud,” “send hello.” See the Getting Started tutorial for the full walkthrough with example responses.
Ports open in RS-232 mode by default. Use set_port_mode() or the mode parameter on open_serial_port() to switch to RS-422 for differential links or RS-485 for multi-drop buses. Common tools work in all three modes.