MCP Serial Port Tool

MCP Serial Port Tool

Enables 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.

Category
Visit Server

README

MCP串口工具 (MCP Serial Port Tool)

基于MCP(Model Context Protocol)协议的串口工具,为AI助手提供与物理串口设备交互的能力。

功能特性

  • 🔄 基于MCP协议的标准化接口
  • 🔌 跨平台串口支持(Windows COM / Linux tty)
  • ⚡ 异步事件驱动架构
  • 🔒 写入互斥锁保证数据完整性
  • 🎯 配置化URC识别与过滤
  • 📊 结构化日志与健康检查
  • 🧪 完整的测试覆盖

快速开始

安装依赖

npm install

开发模式

npm run dev

构建项目

npm run build

运行测试

npm test

项目结构

mcp2serial/
├── src/                    # 源代码
│   ├── core/              # 核心引擎层
│   ├── adapters/          # 硬件适配层
│   ├── services/          # 业务服务层
│   ├── mcp/               # MCP协议层
│   ├── utils/             # 工具模块
│   └── types/             # 类型定义
├── config/                # 配置文件
├── tests/                 # 测试代码
├── docs/                  # 文档
└── examples/              # 示例配置

API接口

串口操作

  • serial.open - 打开串口
  • serial.close - 关闭串口
  • serial.write - 写入数据并读取响应
  • serial.list - 获取可用串口列表
  • serial.status - 查询串口状态

通知

  • serial.report - 异步事件通知(URC、错误、状态变化)

健康检查

  • health.status - 获取系统健康状态
  • health.metrics - 获取性能指标

日志

  • trace.get_log - 获取日志记录

配置说明

主要配置文件位于 config/ 目录:

  • default.yaml - 默认配置
  • urc-patterns.yaml - URC模式配置

详细配置说明请参考 配置文档

开发指南

代码规范

项目使用ESLint和TypeScript严格模式,请确保代码符合规范:

npm run lint
npm run lint:fix

测试

# 运行所有测试
npm test

# 监视模式
npm run test:watch

# 覆盖率报告
npm run test:coverage

许可证

MIT License

贡献

欢迎提交Issue和Pull Request!

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured