npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vividcodeai/embedded-serial-mcp

v0.0.7

Published

MCP server for serial port communication

Readme

嵌入式串口 MCP

Rust RMCP License

专业的模型上下文协议 (MCP) 串口通信服务器。为 AI 助手提供包括嵌入式系统、IoT 设备和硬件调试在内的全面串口通信功能,支持真实硬件集成。

📖 语言版本: English | 中文

✨ 功能特性

  • 🚀 生产就绪: 真实硬件集成,提供5个综合串口通信工具
  • 🔌 跨平台支持: Windows、Linux、macOS,自动端口检测
  • 📡 完整串口控制: 列出端口、连接、发送/接收数据,完整配置
  • 📝 多种数据格式: UTF-8、Hex、二进制编码支持,带超时处理
  • 🛠️ 硬件集成: 经过STM32、Arduino、ESP32等嵌入式系统测试
  • 🤖 AI集成: 与Claude和其他AI助手完美兼容
  • 🧪 全面测试: 所有5个工具在真实硬件上验证通过
  • 高性能: 基于Tokio异步运行时,支持并发连接

🏗️ 架构

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   MCP 客户端    │◄──►│  串口 MCP        │◄──►│  串口设备       │
│   (Claude/AI)   │    │  服务器          │    │  硬件           │
└─────────────────┘    └──────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌──────────────────┐
                       │  目标设备        │
                       │  (STM32/Arduino) │
                       └──────────────────┘

🚀 快速开始

前置要求

硬件要求:

  • 串口设备: STM32, Arduino, ESP32, 或任何UART兼容设备
  • 连接: USB转串口转换器或内置USB-UART
  • USB线: 用于连接设备到PC

软件要求:

  • Rust 1.70+
  • 串口设备驱动程序(大多数系统自动检测)

安装

# 克隆并从源码构建
git clone https://github.com/vividcodeAI/embedded-serial-mcp.git
cd embedded-serial-mcp
cargo build --release

基本使用

配置 MCP 客户端

Claude Desktop 配置示例

添加到 Claude Desktop 配置文件:

Windows 示例:

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

macOS/Linux 示例:

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

其他例如cursor、claude code等参考对应工具文档

🎯 试试 STM32 演示

我们提供了一个全面的 STM32 串口通信演示,展示了所有功能:

# 进入示例目录
cd examples/STM32_demo

# 构建并运行固件
cargo run --release

# 与 MCP 服务器配合使用,获得完整的串口通信体验

演示内容:

  • 交互式串口命令: 发送命令并获得实时响应
  • 全部 5 个 MCP 工具: 在真实 STM32 硬件上完整验证
  • 硬件控制: LED 切换、计数器系统、闪烁模式
  • 命令接口: 帮助系统与交互式命令处理

📖 查看 STM32 演示文档 →

AI 助手使用示例

列出可用串口

请列出系统上可用的串口

连接串口设备

使用波特率115200连接到我的STM32设备的COM19端口

发送交互命令

发送 'H' 命令获取帮助菜单,然后发送 'L' 切换LED

读取设备响应

从串口设备读取响应,超时时间2秒

完整通信测试

请帮我测试COM19上STM32板的所有5个MCP串口工具。先列出端口,然后连接,发送一些命令,读取响应,最后关闭连接。

🛠️ 完整工具集 (5个工具)

所有工具均通过真实 STM32 硬件测试和验证:

📡 串口通信 (5个工具)

| 工具 | 描述 | 状态 | |------|------|------| | list_ports | 发现系统上可用的串口 | ✅ 生产就绪 | | open | 打开带配置的串口连接 | ✅ 生产就绪 | | write | 向连接的串口设备发送数据 | ✅ 生产就绪 | | read | 从串口设备读取数据(带超时) | ✅ 生产就绪 | | close | 清洁地关闭串口连接 | ✅ 生产就绪 |

✅ 5/5 工具 - 真实硬件 100% 成功率

🌍 支持的硬件

串口设备

  • STM32: 所有带UART功能的STM32系列
  • Arduino: Uno, Nano, ESP32, ESP8266
  • 嵌入式系统: 任何带UART/USB-Serial接口的设备
  • 工业设备: Modbus, RS485转换器
  • IoT设备: 带串口通信的传感器、执行器
  • 其他: 任何带UART/USB-Serial接口的设备

串口接口

  • USB转串口: CH340, CH343, FTDI, CP2102
  • 内置USB: 带USB-CDC的STM32, Arduino Leonardo
  • 硬件UART: 直接UART连接

平台支持

| 平台 | 端口格式 | 示例 | |------|---------|------| | Windows | COMx | COM1, COM3, COM19 | | Linux | /dev/ttyXXX | /dev/ttyUSB0, /dev/ttyACM0 | | macOS | /dev/tty.xxx | /dev/tty.usbserial-1234 |

🏆 生产状态

✅ 完全实现并测试

当前状态: 生产就绪

  • 完整的串口集成: 所有5个工具的真实硬件通信
  • 硬件验证: 在STM32 + CH343 USB-Serial COM19端口上测试
  • 交互式通信: 完整的双向命令/响应系统
  • 多平台支持: Windows、Linux、macOS支持,自动检测
  • 连接管理: 强大的连接处理与适当的清理
  • AI集成: 完美的MCP协议兼容性

📦 技术特性

串口实现

  • 跨平台: 自动端口检测和配置
  • 多种编码: UTF-8、Hex、二进制数据支持
  • 超时处理: 可配置的读写超时
  • 连接池: 多个并发串口连接

性能特征

  • 端口发现: 快速枚举可用端口
  • 连接速度: 快速建立连接
  • 数据吞吐: 高效数据传输,最小延迟
  • 会话稳定性: 经过长时间运行测试

🙏 致谢

感谢以下开源项目:

📄 许可证

本项目采用 MIT 许可证。详细信息请参阅 LICENSE 文件。


⭐ 如果这个项目对你有帮助,请给我们一个 Star!