{
  "markdown": "# mcp-rs485\n\n> MCP server that exposes RS485 bus connectivity for reading and writing serial data.\n\nmcp-name: io.github.daedalus/mcp-rs485\n\n[![PyPI](https://img.shields.io/pypi/v/mcp-rs485.svg)](https://pypi.org/project/mcp-rs485/)\n[![Python](https://img.shields.io/pypi/pyversions/mcp-rs485.svg)](https://pypi.org/project/mcp-rs485/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n## Install\n\n```bash\npip install mcp-rs485\n```\n\n## Configuration\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-rs485\": {\n      \"command\": \"mcp-rs485\",\n      \"env\": {},\n      \"name\": \"io.github.daedalus/mcp-rs485\"\n    }\n  }\n}\n```\n\n## Usage\n\nThis MCP server exposes RS485 serial bus connectivity through the Model Context Protocol. It allows AI assistants to interact with RS485 devices.\n\n### Tools\n\n- `list_ports`: Lists all available serial ports on the system\n- `connect_rs485`: Opens a connection to an RS485 device\n- `disconnect_rs485`: Closes an RS485 connection\n- `read_rs485`: Reads data from an open RS485 connection\n- `write_rs485`: Writes data to an RS485 connection\n- `get_connection_status`: Gets the status of an RS485 connection\n\n### Example\n\n```python\nfrom mcp_rs485.server import connect_rs485, write_rs485, read_rs485\n\n# Connect to a device\nconn_id = connect_rs485(\"/dev/ttyUSB0\", baudrate=9600)\n\n# Write data (Modbus RTU example)\nwrite_rs485(conn_id, \"01 03 00 00 00 0A\")\n\n# Read response\nresponse = read_rs485(conn_id)\n\n# Cleanup\ndisconnect_rs485(conn_id)\n```\n\n## Development\n\n```bash\ngit clone https://github.com/daedalus/mcp-rs485.git\ncd mcp-rs485\npip install -e \".[test]\"\n\n# run tests\npytest\n\n# format\nruff format src/ tests/\n\n# lint\nruff check src/ tests/\n\n# type check\nmypy src/\n```\n\n## API\n\n### list_ports()\n\nLists all available serial ports.\n\n**Returns:** List of port dictionaries with `port`, `description`, and `hwid`.\n\n### connect_rs485(port, baudrate=9600, parity=\"N\", stopbits=1, bytesize=8, timeout=1.0)\n\nOpens a connection to an RS485 device.\n\n**Parameters:**\n- `port`: Serial port path (e.g., \"/dev/ttyUSB0\")\n- `baudrate`: Communication speed (default: 9600)\n- `parity`: \"N\" (none), \"E\" (even), \"O\" (odd)\n- `stopbits`: Number of stop bits\n- `bytesize`: Data bits per frame\n- `timeout`: Read timeout in seconds\n\n**Returns:** Connection ID string.\n\n### read_rs485(connection_id, length=1024)\n\nReads data from an open RS485 connection.\n\n**Parameters:**\n- `connection_id`: Connection ID from connect_rs485\n- `length`: Maximum bytes to read\n\n**Returns:** Hex string of received data.\n\n### write_rs485(connection_id, data)\n\nWrites data to an RS485 connection.\n\n**Parameters:**\n- `connection_id`: Connection ID from connect_rs485\n- `data`: Hex string (e.g., \"01 03 00 00 00 0A\")\n\n**Returns:** Number of bytes written.\n\n### get_connection_status(connection_id)\n\nGets connection status and statistics.\n\n**Returns:** Dictionary with connection state and statistics.\n",
  "bytes": 2974,
  "sha": "dcc0663cec14e1b730aa06988a785d07ed2ed28f4d2d3db2e22280fc2808174d",
  "repo_slug": "daedalus/mcp-rs485",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_daedalus_mcp_rs485_1d4a4979/readme"
}