Serial MCP Server
シリアルMCPサーバー
シリアルポート通信用のModel Context Protocol (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-mcpClaude 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(port="COM3", baud_rate=115200)データを書き込む:
serial_write(connection_id="conn_1", data="Hello, device!")応答を読み取る:
serial_read(connection_id="conn_1", timeout=2.0)完了したら閉じる:
serial_close(connection_id="conn_1")
依存関係
Python 3.10+
mcp >= 1.6.1
pyserial >= 3.5
pydantic >= 2.0.0
ライセンス
MIT
Available Tools
8 toolsserial_closeAIdempotent
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_signalsARead-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_connectionsARead-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_portsARead-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_openADestructive
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_readARead-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_signalsADestructive
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_writeADestructive
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
Scored across 8 tools
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.
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.
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.
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
Related MCP Connectors
PDF, image, video, OCR, screenshot, SQL, QR and text tools for agents. No API key, no signup.
Connect your AI to your own devices, 3D printers, factory tools and a shared agent task pool.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Access Pollinations models and API capabilities through agent tools.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables 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-
- AlicenseAqualityDmaintenanceEnables AI assistants to communicate with serial port devices, supporting port management, data transmission in text/binary modes, interactive terminal sessions, and automatic reconnection.1412MIT
- AlicenseAqualityCmaintenanceAllows 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.27118 PyPI27MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to communicate with UART/serial devices, offering tools for port management, data read/write, and protocol handling.MIT