Skip to main content
Glama
serial-mcp

serial-mcp

by davidalo

๐Ÿ”Œ serial-mcp

MCP server for serial port communication. Provides tools to open, read, write, and manage serial ports through the Model Context Protocol.

๐Ÿค– Written by and for AI.

โœจ Features

  • ๐Ÿ“‹ List available serial ports on the system

  • โš™๏ธ Open ports with configurable baud rate, parity, stop bits, and flow control

  • ๐Ÿ“– Read data by byte count, terminator character, or duration

  • โœ๏ธ Write string or hex data

  • ๐Ÿ’ฅ Send BREAK signals

  • ๐Ÿ“Š Monitor port status and control line states

Related MCP server: serial-mcp

๐Ÿ“ฆ Prerequisites

  • Python 3.10+

  • uv package manager

๐Ÿš€ Installation

Via PyPI

uvx serial-mcp@latest

Local Clone

git clone https://github.com/davidalo/serial-mcp.git
cd serial-mcp
uvx --from "$(pwd)" serial-mcp

๐Ÿ”— Integration

Via PyPI

# Claude Code
claude mcp add serial -- uvx serial-mcp@latest

# Codex CLI
codex mcp add serial -- uvx serial-mcp@latest

Local Clone

git clone https://github.com/davidalo/serial-mcp.git
cd serial-mcp

# Claude Code
claude mcp add serial -- uvx --from "$(pwd)" serial-mcp

# Codex CLI
codex mcp add serial -- uvx --from "$(pwd)" serial-mcp

๐Ÿ› ๏ธ Tools

Tool

Description

list_ports

List available system serial ports

open_port

Open a serial port with configuration (baud rate, parity, stop bits, etc.)

close_port

Close an open port

write_data

Write string or hex data to a port

read_bytes

Read N bytes with timeout

read_until

Read until a terminator character

read_for_duration

Read continuously for N seconds

send_break

Send a BREAK signal

get_port_status

Get port status and control line states

list_open_ports

List all currently managed ports

๐Ÿงช Testing with Virtual Ports

Use socat to create virtual serial port pairs for testing:

# Create virtual port pair
socat -d -d pty,raw,echo=0,link=/tmp/ttyV0 pty,raw,echo=0,link=/tmp/ttyV1

Then open /tmp/ttyV0 with the MCP server and /tmp/ttyV1 with another terminal program to test communication.

๐Ÿ“„ License

MIT

Available Tools

10 tools
close_portB

Close an open serial port.

The port_id is the identifier returned when the port was opened.

Inputs: port_id (required).

get_port_statusA

Get the current status of a managed serial port.

Returns configuration, buffer status, and control line states.

Inputs: port_id (required).

list_open_portsB

List all currently open/managed serial ports.

Returns information about each port that has been opened through this MCP server.

Inputs: no named parameters.

list_portsA

List all available serial ports on the system.

Returns information about each port including device path, description, manufacturer, and hardware IDs.

Inputs: no named parameters.

open_portA

Open a serial port with the specified configuration.

Returns a port_id that must be used for all subsequent operations on this port.

Inputs: port (required), baud_rate, data_bits, parity, +4 more.

read_bytesB

Read a specific number of bytes from the serial port.

Reads up to num_bytes, returning early if timeout is reached.

Inputs: port_id (required), num_bytes (required), timeout, encoding.

read_for_durationB

Read all data from serial port for a specified duration.

Continuously reads data for the specified time period, collecting all received bytes.

Inputs: port_id (required), duration (required), max_bytes, encoding.

read_untilA

Read from serial port until a terminator string is received.

Useful for reading line-based protocols (terminator='\n').

Inputs: port_id (required), terminator, timeout, max_bytes, +1 more.

send_breakA

Send a BREAK signal on the serial port.

A BREAK is a special signal where the TX line is held low for a specified duration, used for various protocols.

Inputs: port_id (required), duration.

write_dataB

Write data to an open serial port.

Data can be a regular string (encoded with the specified encoding) or a hex string if hex_mode is True.

Inputs: port_id (required), data (required), encoding, hex_mode.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A3.7/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. The three read functions (read_bytes, read_for_duration, read_until) are differentiated by reading mode, and all other tools serve unique roles in port management. No overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., close_port, list_open_ports, send_break). The naming is predictable and easy to interpret.

    Tool Count5/5

    10 tools is well-scoped for a serial port management server. The set covers opening, closing, reading (three variants), writing, status, port listing, and special signals without being excessive.

    Completeness4/5

    The tool set covers core serial operations (open/close, read/write, status, break signal). Minor gaps exist, such as buffer flushing or control line manipulation, but these are not critical for typical use.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server for seamless integration with peripheral devices connected to your computer. Control, monitor, and manage hardware devices through a unified API.
      5
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      MCP server that lets LLMs talk to serial devices: microcontrollers, routers, modems, embedded Linux, anything with a UART.
      24
      55 PyPI
      7
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A professional MCP server for serial port communication, enabling AI assistants to list, connect, send/receive data, and manage serial connections with embedded systems, IoT devices, and hardware debugging hardware.
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server for serial ports โ€” non-blocking reads, DTR/RTS, streaming subscriptions, port allowlist.
      19
      MIT