Mcp Rs485

io.github.daedalus由 GitHub 账号 daedalus 发布v0.1.0更新于 Oct 24, 2026

MCP server that exposes RS485 bus connectivity for reading and writing serial data

概览

AI 生成的概览

让助手列出串口,并在本机打开、读取、写入和关闭 RS485 总线连接。

可以做什么
这个本地 MCP 服务器向助手提供 RS485 串行总线连接能力。其工具可列出可用串口,按可配置的波特率、校验位、停止位、数据位和超时打开连接,以十六进制字符串读取接收数据,向总线写入十六进制数据,查询连接状态与统计信息,并关闭连接。
适用场景
适合助手需要与本机连接的 RS485 或 Modbus RTU 设备通信的场景,例如读取传感器寄存器或发送命令帧。它面向本地硬件操作,而非通用软件任务。
运行要求
作为本地进程在用户机器上运行,从 PyPI 安装 mcp-rs485,通过 stdio 启动。需要串口路径(如 /dev/ttyUSB0)以及该机器可访问的 RS485 适配器或设备。未声明账号、API 密钥或环境变量。
安装前请注意
写入工具会向已连接的总线发送数据,可能改变所连设备的状态;写入前应确认目标设备和数据帧。读写依赖正确的端口和串口参数,且该服务器仅限桌面环境,无法在浏览器中运行。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Rs485,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-rs485

MCP server that exposes RS485 bus connectivity for reading and writing serial data.

mcp-name: io.github.daedalus/mcp-rs485

[PyPI] [Python] [Ruff]

Install

bash
pip install mcp-rs485

Configuration

json
{  "mcpServers": {    "mcp-rs485": {      "command": "mcp-rs485",      "env": {},      "name": "io.github.daedalus/mcp-rs485"    }  }}

Usage

This MCP server exposes RS485 serial bus connectivity through the Model Context Protocol. It allows AI assistants to interact with RS485 devices.

Tools

  • list_ports: Lists all available serial ports on the system
  • connect_rs485: Opens a connection to an RS485 device
  • disconnect_rs485: Closes an RS485 connection
  • read_rs485: Reads data from an open RS485 connection
  • write_rs485: Writes data to an RS485 connection
  • get_connection_status: Gets the status of an RS485 connection

Example

python
from mcp_rs485.server import connect_rs485, write_rs485, read_rs485
# Connect to a deviceconn_id = connect_rs485("/dev/ttyUSB0", baudrate=9600)
# Write data (Modbus RTU example)write_rs485(conn_id, "01 03 00 00 00 0A")
# Read responseresponse = read_rs485(conn_id)
# Cleanupdisconnect_rs485(conn_id)

Development

bash
git clone https://github.com/daedalus/mcp-rs485.gitcd mcp-rs485pip install -e ".[test]"
# run testspytest
# formatruff format src/ tests/
# lintruff check src/ tests/
# type checkmypy src/

API

list_ports()

Lists all available serial ports.

Returns: List of port dictionaries with port, description, and hwid.

connect_rs485(port, baudrate=9600, parity="N", stopbits=1, bytesize=8, timeout=1.0)

Opens a connection to an RS485 device.

Parameters:

  • port: Serial port path (e.g., "/dev/ttyUSB0")
  • baudrate: Communication speed (default: 9600)
  • parity: "N" (none), "E" (even), "O" (odd)
  • stopbits: Number of stop bits
  • bytesize: Data bits per frame
  • timeout: Read timeout in seconds

Returns: Connection ID string.

read_rs485(connection_id, length=1024)

Reads data from an open RS485 connection.

Parameters:

  • connection_id: Connection ID from connect_rs485
  • length: Maximum bytes to read

Returns: Hex string of received data.

write_rs485(connection_id, data)

Writes data to an RS485 connection.

Parameters:

  • connection_id: Connection ID from connect_rs485
  • data: Hex string (e.g., "01 03 00 00 00 0A")

Returns: Number of bytes written.

get_connection_status(connection_id)

Gets connection status and statistics.

Returns: Dictionary with connection state and statistics.

来源:README.md,提交 4e0026a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分