embedded-serial-mcp

embedded-serial-mcp

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.

Category
访问服务器

README

Embedded Serial MCP

Rust RMCP License

A professional Model Context Protocol (MCP) server for serial port communication. Provides AI assistants with comprehensive serial communication capabilities for embedded systems, IoT devices, and hardware debugging with real hardware integration.

📖 Language Versions: English | 中文

✨ Features

  • 🚀 Production Ready: Real hardware integration with 5 comprehensive serial communication tools
  • 🔌 Cross-Platform Support: Windows, Linux, macOS with automatic port detection
  • 📡 Complete Serial Control: List ports, connect, send/receive data with full configuration
  • 📝 Multiple Data Formats: UTF-8, Hex, Binary encoding support with timeout handling
  • 🛠️ Hardware Integration: Tested with STM32, Arduino, ESP32 and other embedded systems
  • 🤖 AI Integration: Perfect compatibility with Claude and other AI assistants
  • 🧪 Comprehensive Testing: All 5 tools validated with real hardware
  • High Performance: Built on Tokio async runtime with concurrent connection support

🏗️ Architecture

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   MCP Client    │◄──►│  Serial MCP      │◄──►│  Serial Device  │
│   (Claude/AI)   │    │  Server          │    │  Hardware       │
└─────────────────┘    └──────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌──────────────────┐
                       │  Target Device   │
                       │  (STM32/Arduino) │
                       └──────────────────┘

🚀 Quick Start

Prerequisites

Hardware Requirements:

  • Serial Device: STM32, Arduino, ESP32, or any UART-compatible device
  • Connection: USB-to-Serial converter or built-in USB-UART
  • USB Cables: For connecting device to PC

Software Requirements:

  • Rust 1.70+
  • Serial device drivers (automatically detected on most systems)

Installation

# Clone and build from source
git clone https://github.com/vividcodeAI/embedded-serial-mcp.git
cd embedded-serial-mcp
cargo build --release

Basic Usage

Configure MCP Clients

Claude Desktop Configuration Example

Add to Claude Desktop configuration file:

Windows Example:

{
  "mcpServers": {
    "serial": {
      "command": "C:\\path\\to\\embedded-serial-mcp\\target\\release\\embedded-serial-mcp.exe",
      "args": [],
      "env": {
        "RUST_LOG": "info"
      }
    }
  }
}

macOS/Linux Example:

{
  "mcpServers": {
    "serial": {
      "command": "/path/to/embedded-serial-mcp/target/release/embedded-serial-mcp",
      "args": [],
      "env": {
        "RUST_LOG": "info"
      }
    }
  }
}

Other examples for other tools like cursor, claude code etc. please refer to the corresponding tool documentation

🎯 Try the STM32 Demo

We provide a comprehensive STM32 Serial Communication Demo that showcases all capabilities:

# Navigate to the example
cd examples/STM32_demo

# Build and run the firmware  
cargo run --release

# Use with MCP server for complete serial communication experience

What the demo shows:

  • Interactive Serial Commands: Send commands and get real-time responses
  • All 5 MCP Tools: Complete validation with real STM32 hardware
  • Hardware Control: LED toggle, counter system, blink patterns
  • Command Interface: Help system with interactive command processing

📖 View STM32 Demo Documentation →

Usage Examples with AI Assistants

List Available Serial Ports

Please list available serial ports on the system

Connect to Serial Device

Connect to COM19 with baud rate 115200 for my STM32 device

Send Interactive Commands

Send 'H' command to get help menu, then send 'L' to toggle the LED

Read Device Responses

Read the response from the serial device with 2 second timeout

Complete Communication Test

Please help me test all 5 MCP serial tools with my STM32 board on COM19. Start by listing ports, then connect, send some commands, read responses, and finally close the connection.

🛠️ Complete Tool Set (5 Tools)

All tools tested and validated with real STM32 hardware:

📡 Serial Communication (5 tools)

Tool Description Status
list_ports Discover available serial ports on system ✅ Production Ready
open Open serial connection with configuration ✅ Production Ready
write Send data to connected serial device ✅ Production Ready
read Read data from serial device with timeout ✅ Production Ready
close Close serial connection cleanly ✅ Production Ready

✅ 5/5 Tools - 100% Success Rate with Real Hardware

🌍 Supported Hardware

Serial Devices

  • STM32: All STM32 series with UART capability
  • Arduino: Uno, Nano, ESP32, ESP8266
  • Embedded Systems: Any device with UART/USB-Serial interface
  • Industrial: Modbus, RS485 converters
  • IoT Devices: Sensors, actuators with serial communication
  • Other: Any device with UART/USB-Serial interface

Serial Interfaces

  • USB-to-Serial: CH340, CH343, FTDI, CP2102
  • Built-in USB: STM32 with USB-CDC, Arduino Leonardo
  • Hardware UART: Direct UART connections

Platform Support

Platform Port Format Examples
Windows COMx COM1, COM3, COM19
Linux /dev/ttyXXX /dev/ttyUSB0, /dev/ttyACM0
macOS /dev/tty.xxx /dev/tty.usbserial-1234

🏆 Production Status

✅ Fully Implemented and Tested

Current Status: PRODUCTION READY

  • Complete Serial Integration: Real hardware communication with all 5 tools
  • Hardware Validation: Tested with STM32 + CH343 USB-Serial on COM19
  • Interactive Communication: Full bidirectional command/response system
  • Multi-Platform: Windows, Linux, macOS support with automatic detection
  • Connection Management: Robust connection handling with proper cleanup
  • AI Integration: Perfect MCP protocol compatibility

📦 Technical Features

Serial Implementation

  • Cross-Platform: Automatic port detection and configuration
  • Multiple Encodings: UTF-8, Hex, Binary data support
  • Timeout Handling: Configurable read/write timeouts
  • Connection Pooling: Multiple concurrent serial connections

Performance Characteristics

  • Port Discovery: Fast enumeration of available ports
  • Connection Speed: Rapid connection establishment
  • Data Throughput: Efficient data transfer with minimal latency
  • Session Stability: Tested for extended operation periods

🙏 Acknowledgments

Thanks to the following open source projects:

📄 License

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


⭐ If this project helps you, please give us a Star!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选