Skip to main content
Glama
Serial MCP Server
by ifindv

Servidor MCP Serial

Un servidor del Protocolo de Contexto de Modelo (MCP) para la comunicación por puerto serie, que permite a los LLM interactuar con dispositivos de hardware a través de conexiones serie.

Características

  • Listar puertos serie disponibles

  • Abrir/cerrar conexiones de puerto serie

  • Leer y escribir datos en puertos serie

  • Controlar señales serie (DTR, RTS, CTS, DSR, DCD)

  • Soporte para velocidades en baudios, bits de datos, bits de parada y paridad personalizados

  • Formatos de salida JSON y Markdown

Related MCP server: UART MCP Server

Instalación

# Install from PyPI (when published)
pip install serial-mcp-new

Uso

Ejecución del servidor

# Run with stdio transport (default, for local use)
serial-mcp

Configuración en Claude Code

  "mcpServers": {
    "ssh-mcp": {
      "command": "C:\\Users\\DELL\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\Scripts\\serial-mcp.exe",
      "args": [],
      "env": {}
    }
  },

Herramientas disponibles

Herramienta

Descripción

serial_list_ports

Listar todos los puertos serie disponibles

serial_open

Abrir una conexión de puerto serie

serial_close

Cerrar una conexión de puerto serie

serial_write

Escribir datos en un puerto serie

serial_read

Leer datos de un puerto serie

serial_set_signals

Establecer estados de señales de control

serial_get_signals

Leer estados actuales de las señales

serial_list_connections

Listar todas las conexiones activas

Flujo de trabajo de ejemplo

  1. Listar puertos disponibles:

    serial_list_ports()
  2. Abrir una conexión:

    serial_open(port="COM3", baud_rate=115200)
  3. Escribir datos:

    serial_write(connection_id="conn_1", data="Hello, device!")
  4. Leer respuesta:

    serial_read(connection_id="conn_1", timeout=2.0)
  5. Cerrar al finalizar:

    serial_close(connection_id="conn_1")

Dependencias

  • Python 3.10+

  • mcp >= 1.6.1

  • pyserial >= 3.5

  • pydantic >= 2.0.0

Licencia

MIT

Available Tools

8 tools
serial_closeA
Idempotent

Close a serial port connection.

Closes the specified serial port connection and releases resources. The connection ID becomes invalid after closing.

Args: params (ClosePortInput): Validated input parameters containing: - connection_id (str): Connection ID returned by serial_open

Returns: str: Success message or error message.

Success response: "Connection closed: conn_1" Error response: "Error: Connection 'conn_1' not found"

Inputs: params (required). Returns: result

serial_get_signalsA
Read-onlyIdempotent

Read the current state of serial port signals.

Returns the current state of all control signals including input signals (CTS, DSR, DCD) and output signals (DTR, RTS).

Args: params (GetSignalsInput): Validated input parameters containing: - connection_id (str): Connection ID returned by serial_open - response_format (ResponseFormat): Output format (default: 'markdown')

Returns: str: Formatted signal states or error message.

Success format for JSON: { "connection_id": "conn_1", "dtr": true, "rts": false, "cts": true, "dsr": true, "dcd": false }

Error response: "Error: Connection 'conn_1' not found or not open"

Inputs: params (required). Returns: result

serial_list_connectionsA
Read-onlyIdempotent

List all active serial port connections.

Returns information about all currently open serial port connections.

Args: params (ListConnectionsInput): Validated input parameters containing: - response_format (ResponseFormat): Output format (default: 'markdown')

Returns: str: Formatted list of connections or empty message.

Success format for JSON: [ { "id": "conn_1", "port": "COM3", "baud_rate": 9600, "path": "COM3", "is_open": true, "created_at": "2024-01-15T10:30:00Z" } ]

Error response: "No active connections"

Inputs: params (required). Returns: result

serial_list_portsA
Read-onlyIdempotent

List all available serial ports on the system.

This tool scans the system for available serial ports and returns detailed information about each port including device path, manufacturer, and serial number.

Args: params (ListPortsInput): Validated input parameters containing: - response_format (ResponseFormat): Output format (default: 'markdown')

Returns: str: Formatted list of serial ports.

Success response format: For JSON: Array of port objects with path, manufacturer, serialNumber, etc. For Markdown: Formatted list with port details

Error response: "Error: "

Inputs: params (required). Returns: result

serial_openA
Destructive

Open a serial port connection.

Opens a new serial port connection with specified parameters. Returns a connection ID that must be used for subsequent operations on this port.

Args: params (OpenPortInput): Validated input parameters containing: - port (str): Serial port path (e.g., 'COM3', '/dev/ttyUSB0') - baud_rate (int): Baud rate (default: 9600) - data_bits (int): Data bits, 5-8 (default: 8) - stop_bits (float): Stop bits, 1.0-2.0 (default: 1.0) - parity (str): Parity: 'N', 'E', or 'O' (default: 'N')

Returns: str: Connection ID or error message.

Success response: "Connection opened: conn_1" Error response: "Error: "

Inputs: params (required). Returns: result

serial_readA
Read-only

Read data from a serial port connection.

Reads available data from the serial port up to the specified maximum bytes. Times out after the specified timeout period if no data is available.

Args: params (ReadDataInput): Validated input parameters containing: - connection_id (str): Connection ID returned by serial_open - max_bytes (int): Maximum bytes to read (default: 1024, max: 65536) - timeout (float): Read timeout in seconds (default: 1.0) - encoding (str): Text encoding (default: 'utf-8') - response_format (ResponseFormat): Output format (default: 'markdown')

Returns: str: Formatted data or error message.

Success format for JSON: { "connection_id": "conn_1", "bytes_read": 42, "hex": "48656c6c6f", "data": "Hello", "timestamp": "2024-01-15T10:30:00Z" }

Error response: "Error: Connection 'conn_1' not found or not open"

Inputs: params (required). Returns: result

serial_set_signalsA
Destructive

Set control signal states on a serial port connection.

Sets the DTR (Data Terminal Ready) and/or RTS (Request To Send) control signals.

Args: params (SetSignalsInput): Validated input parameters containing: - connection_id (str): Connection ID returned by serial_open - dtr (Optional[bool]): DTR signal state (True=HIGH, False=LOW, None=unchanged) - rts (Optional[bool]): RTS signal state (True=HIGH, False=LOW, None=unchanged)

Returns: str: Success message or error message.

Success response: "Signals set on conn_1: DTR=HIGH, RTS=LOW" Error response: "Error: Connection 'conn_1' not found or not open"

Inputs: params (required). Returns: result

serial_writeA
Destructive

Write data to a serial port connection.

Writes the specified data string to the serial port using the specified encoding.

Args: params (WriteDataInput): Validated input parameters containing: - connection_id (str): Connection ID returned by serial_open - data (str): Data to write as a string - encoding (str): Text encoding (default: 'utf-8') - timeout (float): Write timeout in seconds (default: 5.0)

Returns: str: Success message with bytes written or error message.

Success response: "Wrote 12 bytes to conn_1" Error response: "Error: Connection 'conn_1' not found or not open"

Inputs: params (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct operation on serial ports: opening, closing, listing ports/connections, reading, writing, and getting/setting signals. There is no ambiguity between them.

    Naming Consistency5/5

    All tools follow a consistent 'serial_verb' pattern (e.g., serial_open, serial_read, serial_write, serial_close, etc.), making it easy to predict tool names.

    Tool Count5/5

    With 8 tools covering connection management, data I/O, and signal control, the count is well-scoped for a serial port server. No tool feels unnecessary or missing.

    Completeness4/5

    The toolset covers the core operations: open, close, list ports, list connections, read, write, get/set signals. A potential gap is flushing buffers or handling break conditions, but these are advanced and not essential.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI assistants to interact with physical serial port devices across platforms (Windows COM/Linux tty) with support for asynchronous communication, URC pattern recognition, and structured logging.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to communicate with serial port devices, supporting port management, data transmission in text/binary modes, interactive terminal sessions, and automatic reconnection.
      14
      12
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Allows AI agents to interact with serial devices via RS232/UART, enabling port listing, connection, read/write, control line manipulation, and protocol specification for automated debugging and testing.
      27
      118 PyPI
      27
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to communicate with UART/serial devices, offering tools for port management, data read/write, and protocol handling.
      MIT