Metadata-Version: 2.4
Name: mcp-rs232
Version: 0.1.0
Summary: An MCP server that exposes RS232 serial port connectivity
Project-URL: Homepage, https://github.com/daedalus/mcp-rs232
Project-URL: Repository, https://github.com/daedalus/mcp-rs232
Project-URL: Issues, https://github.com/daedalus/mcp-rs232/issues
Author-email: Dario Clavijo <clavijodario@gmail.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: fastmcp
Requires-Dist: pyserial
Provides-Extra: all
Requires-Dist: hatch; extra == 'all'
Requires-Dist: hypothesis; extra == 'all'
Requires-Dist: mypy; extra == 'all'
Requires-Dist: pytest; extra == 'all'
Requires-Dist: pytest-asyncio; extra == 'all'
Requires-Dist: pytest-cov; extra == 'all'
Requires-Dist: pytest-mock; extra == 'all'
Requires-Dist: ruff; extra == 'all'
Provides-Extra: dev
Requires-Dist: hatch; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: lint
Requires-Dist: mypy; extra == 'lint'
Requires-Dist: ruff; extra == 'lint'
Provides-Extra: test
Requires-Dist: hypothesis; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-mock; extra == 'test'
Description-Content-Type: text/markdown

# mcp-rs232

> An MCP server that exposes RS232 serial port connectivity

[![PyPI](https://img.shields.io/pypi/v/mcp-rs232.svg)](https://pypi.org/project/mcp-rs232/)
[![Python](https://img.shields.io/pypi/pyversions/mcp-rs232.svg)](https://pypi.org/project/mcp-rs232/)
[![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)

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

## Install

```bash
pip install mcp-rs232
```

## Usage

```python
from mcp_rs232 import list_ports, open_port, close_port, read_port, write_port

# List available ports
ports = list_ports()
print(ports)

# Open a port
open_port("COM1", baud_rate=9600)

# Write data (hex encoded)
write_port("COM1", "48656c6c6f")  # "Hello"

# Read data (returns hex encoded)
data = read_port("COM1")

# Close the port
close_port("COM1")
```

## CLI

```bash
mcp-rs232 --help
```

## API

### Resources

- `serial://ports` - Lists all available serial ports with their details
- `serial://port/{port_name}` - Get details about a specific port

### Tools

- `list_ports_tool()` - Returns list of available serial ports
- `open_port(port, baud_rate, ...)` - Opens a serial connection
- `close_port(port)` - Closes a serial connection
- `read_port(port, size, timeout)` - Reads data from port (hex encoded)
- `write_port(port, data)` - Writes hex-encoded data to port
- `get_port_config(port)` - Returns current port configuration

## Development

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

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/
```
