Skip to main content
Glama
Serial MCP Server
by ifindv

직렬 MCP 서버

직렬 포트 통신을 위한 모델 컨텍스트 프로토콜(MCP) 서버로, LLM이 직렬 연결을 통해 하드웨어 장치와 상호 작용할 수 있게 합니다.

기능

  • 사용 가능한 직렬 포트 나열

  • 직렬 포트 연결 열기/닫기

  • 직렬 포트로 데이터 읽기 및 쓰기

  • 직렬 신호 제어 (DTR, RTS, CTS, DSR, DCD)

  • 사용자 지정 보드 레이트, 데이터 비트, 정지 비트 및 패리티 지원

  • JSON 및 Markdown 출력 형식

Related MCP server: UART MCP Server

설치

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

사용법

서버 실행

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

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": {}
    }
  },

사용 가능한 도구

도구

설명

serial_list_ports

사용 가능한 모든 직렬 포트 나열

serial_open

직렬 포트 연결 열기

serial_close

직렬 포트 연결 닫기

serial_write

직렬 포트로 데이터 쓰기

serial_read

직렬 포트에서 데이터 읽기

serial_set_signals

제어 신호 상태 설정

serial_get_signals

현재 신호 상태 읽기

serial_list_connections

활성 연결 모두 나열

예시 워크플로우

  1. 사용 가능한 포트 나열:

    serial_list_ports()
  2. 연결 열기:

    serial_open(port="COM3", baud_rate=115200)
  3. 데이터 쓰기:

    serial_write(connection_id="conn_1", data="Hello, device!")
  4. 응답 읽기:

    serial_read(connection_id="conn_1", timeout=2.0)
  5. 완료 후 닫기:

    serial_close(connection_id="conn_1")

종속성

  • Python 3.10+

  • mcp >= 1.6.1

  • pyserial >= 3.5

  • pydantic >= 2.0.0

라이선스

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.
      1
      MIT