Serial MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Serial MCP Serverconnect to COM3 with 115200 baud rate"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Serial MCP Server
嵌入式 AI 调试串口 MCP 服务,让 Claude Code / Codex CLI 等 AI 工具能够直接读写串口数据,实现编码→烧录→调试的完整闭环。
功能状态
功能 | 状态 |
串口连接/断开 | ✅ 稳定 |
数据收发 | ✅ 稳定 |
SQLite 数据持久化 | ✅ 稳定 |
多串口并发 | ✅ 稳定 |
设备自动检测 | ✅ 稳定 |
监控窗口 TUI | ✅ 稳定 |
定时发送 | ✅ 稳定 |
Modbus RTU | 🚧 开发中 |
Web 监控面板 | 🚧 规划中 |
架构
AI (Claude Code / Codex CLI)
│ MCP Protocol
▼
┌─────────────────┐
│ serial-mcp │ MCP Server (9 tools)
│ server.js │
└────────┬────────┘
│ HTTP POST localhost:7070
▼
┌─────────────────┐ ┌──────────────────┐
│ serial-db │◄──────►│ SQLite │
│ listener.js │ 读写 │ serial.db │
└────────┬────────┘ └──────────────────┘
│ UART COM3
▼
┌─────────────────┐
│ 单片机 / 虚拟 │ COM2 ↔ COM3
│ serial-virtual │
└─────────────────┘功能
实时接收串口数据,持久化到 SQLite
AI 主动查询历史数据,按 session / 时间范围检索
AI 发送指令并等待响应,120ms 内响应
支持多种响应边界模式(timeout / delimiter / length)
虚拟串口模拟器,无需真实硬件即可开发调试
一键启动/停止脚本
项目结构
serial-mcp/
├── serial-virtual/ 虚拟单片机模拟器
├── serial-db/ 串口监听 + SQLite 数据池 + HTTP 转发服务
├── serial-mcp/ MCP Server
├── start-all.bat 一键启动
├── stop-all.bat 一键停止
└── .mcp.json Claude Code MCP 配置依赖
Node.js v18+
Windows 系统
虚拟串口驱动(开发调试用):ELTIMA VSP 或 com0com
安装
Claude Code
claude mcp add serial -- npx -y @lckandyou/serial-mcpCodex CLI
codex mcp add serial -- npx -y @lckandyou/serial-mcp验证是否安装成功
# Claude Code
claude mcp list
# Codex CLI
codex mcp list看到 serial 状态为 connected 即成功。
使用方式
安装完成后,直接告诉 AI 你的串口信息: "我的设备接在 COM5,波特率 115200,帮我连接并开始调试"
AI 会自动完成连接,无需任何额外配置。
MCP 工具列表
工具 | 说明 |
| 扫描可用串口 |
| 连接指定串口并创建新会话 |
| 断开当前串口 |
| 发送数据 |
| 读取最新 N 条数据 |
| 读取指定时间后的数据 |
| 发送指令并等待响应 |
| 创建新会话(烧录后调用) |
| 获取当前串口状态 |
真实硬件接入
停止运行
serial-virtual把
serial-db/config.json的port改为实际串口号重启
serial-db
无需修改 MCP Server,AI 调试方式完全一致。
FAQ
Q: 为什么 list_ports 看不到 COM2/COM3?
A: ELTIMA VSP 的虚拟端口不走标准 WMI 枚举,但实际通信正常,不影响使用。
Q: 支持 Linux/Mac 吗?
A: 串口通信部分支持,但 start-all.bat 仅限 Windows,Linux/Mac 需手动启动各服务。
Q: 数据库会无限增长吗?
A: 不会,超过 10000 条自动清理最老的数据,可在 serial-db/config.json 的 maxRows 调整。
Q: 如何判断烧录前后的数据?
A: 烧录完成后调用 new_session 创建新会话,后续用 session_id 过滤数据即可。
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Hejun1998/serial-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server