Skip to main content

MCP server that exposes RS485 bus connectivity

Project description

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

pip install mcp-rs485

Configuration

{
  "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

from mcp_rs485.server import connect_rs485, write_rs485, read_rs485

# Connect to a device
conn_id = connect_rs485("/dev/ttyUSB0", baudrate=9600)

# Write data (Modbus RTU example)
write_rs485(conn_id, "01 03 00 00 00 0A")

# Read response
response = read_rs485(conn_id)

# Cleanup
disconnect_rs485(conn_id)

Development

git clone https://github.com/daedalus/mcp-rs485.git
cd mcp-rs485
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_rs485-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_rs485-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_rs485-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_rs485-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_rs485-0.1.0.tar.gz
Algorithm Hash digest
SHA256 91b02c3b19ba0aa859fc524da7bbabea5e6fe5549189d00a920c1db0e7017579
MD5 7b6fdc10c5fff17bf2da41768c7e4f20
BLAKE2b-256 2228bbb957a3b0ecdc8ebef4df3fffc8ea5bdf5ea4b57ad480a17029f0f09331

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_rs485-0.1.0.tar.gz:

Publisher: pypi-publish.yml on daedalus/mcp-rs485

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_rs485-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_rs485-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_rs485-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da077642ad7a783e73151295ccf43ab341d19b2c6200e18059d1d3b72582ae28
MD5 fb56bd2c7d90573564522b5c8e4e7510
BLAKE2b-256 bc6e33b8ef1b0a634ab80230d02dce80a392e748ce9764781ab59e6c470f24b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_rs485-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on daedalus/mcp-rs485

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page