Serial-MCP: an MCP server for serial port communication

Serial-MCP: an MCP server for serial port communication

serial-mcp•bypadev1

A FastMCP-based MCP server that lets agents communicate with devices over serial ports, with buffering, error handling and connection management.

License: MIT License•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Sends messages through a serial connection and can optionally wait for a response within a timeout.
  • •Reads messages from a configurable buffer that stores each message with a timestamp.
  • •Lists available serial ports and reports connection status.
  • •Initializes, configures and closes serial connections, with automatic port detection and error reporting.

BEST FOR

  • •Agents that need to send commands to and read responses from microcontroller or other serial-connected devices.
  • •Setups that need a buffered, timestamped log of messages received over a serial connection.

ABOUT SERIAL-MCP

Serial-MCP: an MCP server for serial port communication is cataloged as an MCP server attributed to padev1. A FastMCP-based MCP server that lets agents communicate with devices over serial ports, with buffering, error handling and connection management. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Serial-MCP: an MCP server for serial port communication are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the server wait for a device response after sending a message?

Yes. send_message accepts wait_for_response and response_timeout parameters; the response status can be received, no_response, not_checked or error.

How can the serial connection be configured?

Configuration can come from environment variables SERIAL_PORT, SERIAL_BAUD_RATE and SERIAL_BUFFER_LENGTH, or via the configure_serial tool after initialization.

Upstream README

View this exact version on GitHub

README.md · c0d819b312f6 · Fetched 2026-11-13 10:35:53 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Serial-MCP

MCP server allowing Agents to talk to devices connected to serial port of the computer. Tested only with MAC atm.

A robust serial communication server built with FastMCP framework, providing a reliable interface for serial port communication with features like message buffering, error handling, and connection management.

Installation

  1. Clone the repository:
git clone https://github.com/PaDev1/Serial-MCP.git
cd Serial-MCP
  1. Install dependencies:
pip install -r requirements.txt

Add the server after installing to your Claude Desktop or similar with the following structure

"serial_MCP": { "command": "uv", "args": [ "run", "--with", "fastmcp,pyserial", "fastmcp", "run", "/serial_MCP.py" ], "env": { "SERIAL_PORT": "", "SERIAL_BAUD_RATE": "9600", "SERIAL_BUFFER_LENGTH": "100" } }

Features

  • Asynchronous Serial Communication: Built on asyncio for efficient I/O operations
  • Message Buffering: Configurable buffer size with timestamp support
  • Connection Management: Automatic port detection and connection handling
  • Error Handling: Comprehensive error detection and reporting
  • Environment Configuration: Support for environment variables and runtime configuration
  • Logging: Detailed logging with timestamps and error tracking

Available Tools

1. delay

Wait for a specified number of seconds.

Parameters:

  • delay (float): Number of seconds to wait (must be positive)

Returns:

  • Success status
  • Requested delay time
  • Actual delay time (measured)
  • Status message

Example:

await delay({
    "delay": 2.5  # Wait for 2.5 seconds
})

2. init_serial

Initialize a serial connection with specified parameters.

Parameters:

  • port (str): Serial port device path (e.g., '/dev/tty.usbmodem1101')
  • baudrate (int): Communication speed in bauds (default: 9600)
  • buffer_length (int): Maximum number of messages to buffer (default: 100)

Returns:

  • Status of initialization
  • Current mode (real/disconnected)
  • Port and baudrate information

3. send_message

Send a message through the serial connection and optionally wait for a response.

Parameters:

  • message (str): Message to send
  • wait_for_response (bool): Whether to wait for a response after sending (default: False)
  • response_timeout (float): Time in seconds to wait for a response (default: 0.5)

Returns:

  • success (bool): Overall operation success
  • status (str): Operation status ("success", "error", etc.)
  • mode (str): Current connection mode ("real", "disconnected")
  • write_status (str): Write operation status:
    • "success": Message was written successfully
    • "failed": Write operation failed
    • "timeout": Write operation timed out
  • connection_state (str): Current connection state:
    • "connected": Serial port is connected and available
    • "disconnected": No active serial connection
    • "error": Connection in error state
  • response_status (str): Response status:
    • "not_checked": Response check was not requested
    • "received": Response was received
    • "no_response": No response received within timeout
    • "error": Error occurred while checking for response
  • response_messages (list): List of received messages (if any)
  • bytes_written (int): Number of bytes successfully written
  • error_type (str): Type of error if operation failed
  • message (str): Human-readable status message
  • error_details (dict): Additional error information if applicable

Example Send Without Response Check:

await send_message({
    "message": "Hello",
    "wait_for_response": False
})
# Returns:
{
    "success": True,
    "status": "success",
    "mode": "real",
    "write_status": "success",
    "connection_state": "connected",
    "response_status": "not_checked",
    "response_messages": [],
    "bytes_written": 6,
    "message": "Message sent successfully in real mode"
}

Example Send With Response Check:

await send_message({
    "message": "Hello",
    "wait_for_response": True,
    "response_timeout": 1.0
})
# Returns:
{
    "success": True,
    "status": "success",
    "mode": "real",
    "write_status": "success",
    "connection_state": "connected",
    "response_status": "received",
    "response_messages": [
        {
            "timestamp": "2024-03-14T15:30:45.123456",
            "message": "Hello received"
        }
    ],
    "bytes_written": 6,
    "message": "Message sent successfully in real mode"
}

Example No Response Within Timeout:

await send_message({
    "message": "Hello",
    "wait_for_response": True,
    "response_timeout": 0.5
})
# Returns:
{
    "success": True,
    "status": "success",
    "mode": "real",
    "write_status": "success",
    "connection_state": "connected",
    "response_status": "no_response",
    "response_messages": [],
    "bytes_written": 6,
    "message": "Message sent successfully in real mode"
}

4. read_message

Read messages from the buffer.

Parameters:

  • wait (bool): Whether to wait for messages if buffer is empty (default: False)
  • timeout (float): Time to wait for messages in seconds (default: 1.0)

Returns:

  • List of messages with timestamps
  • Current mode
  • Status of read operation

5. list_serial_ports

List all available serial ports on the system.

Parameters: None

Returns:

  • List of available ports with details
  • Port names and descriptions
  • Hardware IDs

6. get_serial_status

Get the current status of the serial connection.

Parameters: None

Returns:

  • Current mode
  • Port and baudrate information
  • Buffer length
  • Available ports
  • Last error message
  • Serial module availability

7. configure_serial

Configure the serial connection after initialization.

Parameters:

  • port (str, optional): New port to use
  • baudrate (int, optional): New baudrate to use
  • list_ports (bool): Whether to just list ports (default: False)

Returns:

  • Updated configuration
  • Current mode
  • Available ports (if list_ports is True)

8. close_serial

Close the current serial connection.

Parameters: None

Returns:

  • Status of closure
  • Current mode

9. help

Get detailed instructions on how to use the Serial MCP server.

Parameters: None

Returns:

  • Detailed help information including:
    • Tool descriptions and parameters
    • Example usage for each tool
    • Common response formats
    • Connection states
    • Response statuses
    • Important usage notes

Example:

await help()
# Returns comprehensive help information about all available tools and their usage

Configuration

The server can be configured using environment variables:

  • SERIAL_PORT: Serial port device path (default: '/dev/tty.usb*')
  • SERIAL_BAUD_RATE: Communication speed in bauds (default: 9600)
  • SERIAL_BUFFER_LENGTH: Maximum number of messages to buffer (default: 100)

Usage

Starting the Server

python serial_MCP.py

API Endpoints

Initialize Serial Connection

await init_serial({
    "port": "/dev/tty.usbmodem1101",
    "baudrate": 9600,
    "buffer_length": 100
})

Send Message

await send_message({
    "message": "Hello, device!"
})

Read Messages

await read_message({
    "wait": False,  # Whether to wait for messages
    "timeout": 1.0  # Timeout in seconds
})

List Available Ports

await list_serial_ports()

Get Connection Status

await get_serial_status()

Configure Connection

await configure_serial({
    "port": "/dev/tty.usbmodem1101",
    "baudrate": 9600,
    "list_ports": False
})

Close Connection

await close_serial()

Message Format

Messages in the buffer are stored with timestamps:

{
    "timestamp": "2024-03-14T15:30:45.123456",  # ISO format
    "message": "Actual message content"
}

Error Handling

The server provides detailed error messages for various scenarios:

  • Connection failures
  • Invalid parameters
  • Timeout conditions
  • Buffer overflow
  • Invalid messages

Logging

Logs are written to logs/serial_MCP.log with the following format:

[timestamp] - [level] - [message]

Requirements

  • Python 3.7+
  • pyserial>=3.5
  • fastmcp>=0.1.0
  • pydantic>=2.0.0
  • asyncio>=3.4.3

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • FastMCP framework for the server infrastructure
  • pyserial for the serial communication capabilities

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Serial-MCP: an MCP server for serial port communication from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/serial-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools