Metadata-Version: 2.4
Name: mcp-snap7
Version: 0.1.0
Summary: MCP server for python-snap7, enabling MCP clients to interact with Siemens PLCs
Project-URL: Homepage, https://github.com/daedalus/mcp-snap7
Project-URL: Repository, https://github.com/daedalus/mcp-snap7
Project-URL: Issues, https://github.com/daedalus/mcp-snap7/issues
Author-email: Dario Clavijo <clavijodario@gmail.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: fastmcp
Requires-Dist: python-snap7
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-snap7

> MCP server for python-snap7, enabling MCP clients to interact with Siemens PLCs

[![PyPI](https://img.shields.io/pypi/v/mcp-snap7.svg)](https://pypi.org/project/mcp-snap7/)
[![Python](https://img.shields.io/pypi/pyversions/mcp-snap7.svg)](https://pypi.org/project/mcp-snap7/)
[![Coverage](https://codecov.io/gh/daedalus/mcp-snap7/branch/main/graph/badge.svg)](https://codecov.io/gh/daedalus/mcp-snap7)
[![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)

## Install

```bash
pip install mcp-snap7
```

## Requirements

- python-snap7 requires the libsnap7 library to be installed on your system.
  See [python-snap7 documentation](https://python-snap7.readthedocs.io/) for installation instructions.

## Usage

### As MCP Server

Configure your MCP client to use `mcp-snap7` as a stdio server:

```json
{
  "mcpServers": {
    "mcp-snap7": {
      "command": "mcp-snap7"
    }
  }
}
```

### Available Tools

- `connect_plc` - Connect to a Siemens PLC
- `disconnect_plc` - Disconnect from PLC
- `get_connected` - Check connection status
- `db_read` / `db_write` - Read/write data blocks
- `mb_read` / `mb_write` - Read/write memory bytes
- `tm_read` / `tm_write` - Read/write timers
- `ct_read` / `ct_write` - Read/write counters
- `eb_read` / `eb_write` - Read/write edge inputs
- `ab_read` / `ab_write` - Read/write absolute bytes
- `get_cpu_info` - Get CPU information
- `get_cpu_state` - Get CPU state
- `get_protection` - Get PLC protection level
- `plc_cold_start` - Trigger cold start
- `plc_hot_start` - Trigger hot start
- `plc_stop` - Stop PLC
- `get_error_text` - Get error description

## Development

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

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/
```
