modbus-connector-mcp
MCP server that gives LLM agents (Claude Desktop, CLI agents) access to Modbus devices through the Modbus Connector backends: reading and writing registers, unit/address scanners, and long-running jobs — device simulator, gateway, RTU sniffer and polling.
No Qt, no GUI — the only dependencies are modbus-connector (pymodbus-only
base) and the official mcp SDK.
Installation
pip install modbus-connector-mcp
Standalone binaries (modbus-connector-mcp-macos / -linux /
-windows.exe, no Python needed) are attached to
Releases.
Running with Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"modbus": {
"command": "modbus-connector-mcp",
"args": []
}
}
}
Start the server with --read-only to forbid all writes (modbus_write
and the simulate/gateway jobs are rejected; reads, scanners,
sniff/poll jobs keep working).
The server speaks stdio (JSON-RPC 2.0) and exits when the client disconnects — all running jobs stop with it.
Connection specs
Every tool takes a conn (or listen/target) spec string:
tcp:192.168.1.10:502— Modbus TCP (default port 502)rtu:/dev/ttyUSB0,baud=9600,bits=8,parity=N,stop=1— Modbus RTU serialrtuovertcp:192.168.1.10:502— RTU framing over TCP (alsortu-over-tcp:),rtuoverudp:...
Tools
| Tool | What it does |
|---|---|
modbus_read |
One-shot read of coils/discrete_inputs/holding/input registers, decoded values (format/order/scale/offset) |
modbus_write |
Write coils/holding registers |
modbus_scan_units |
Scan a unit-id range |
modbus_scan_addresses |
Scan a register address range of one unit |
templates_list / templates_get |
Bundled device templates catalog |
job_start / job_stop / job_list / job_status / job_events |
Long-running jobs (see below) |
Jobs
job_start(kind, params) returns immediately with a job_id; the process
keeps running inside the server:
simulate—{"listen": "tcp:1502", "unit": 1|null, "map": {"registers": [...]}}(map = template/session JSON register list; master writes become events)gateway—{"listen": "tcp:5020", "target": "rtu:/dev/ttyUSB0,baud=9600", "units": [1,5]|null}sniff—{"port": "/dev/cu.usbserial", "baud": 19200, ...}(passive RTU listening)poll—{"conn": "tcp:...", "unit": 1, "kind": "holding_registers", "address": 0, "count": 2, "interval_ms": 1000}
job_events(job_id, since_seq, limit) returns up to limit events newer
than since_seq plus a next_seq cursor for the next call — poll it
incrementally to follow the traffic.
Port conflicts
The server does not share devices with the GUI or CLI: a serial port or a TCP listen port can be opened by one process only. If a job fails with "port busy", close the other session using it.
Development
pip install -e mcp # into the repo's dev venv
.venv/bin/python -m pytest mcp/tests -q
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modbus_connector_mcp-0.1.1.tar.gz.
File metadata
- Download URL: modbus_connector_mcp-0.1.1.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7a63ba72c8751cfaed457f9258fccbea5e13f632f37107c8ad557bb918c9e72
|
|
| MD5 |
e43504da91592ac91372f8efc91b8eae
|
|
| BLAKE2b-256 |
2f90cf7b5710f00b0dd7ad7432a7d1ab7b137268f5e363df392b6ce50b4ff4c8
|
Provenance
The following attestation bundles were made for modbus_connector_mcp-0.1.1.tar.gz:
Publisher:
build.yml on cramen/modbus_connector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modbus_connector_mcp-0.1.1.tar.gz -
Subject digest:
f7a63ba72c8751cfaed457f9258fccbea5e13f632f37107c8ad557bb918c9e72 - Sigstore transparency entry: 2669255901
- Sigstore integration time:
-
Permalink:
cramen/modbus_connector@aa1680bb41d5f68a295018a3d78f7e98c20d6224 -
Branch / Tag:
refs/tags/v0.14.2 - Owner: https://github.com/cramen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@aa1680bb41d5f68a295018a3d78f7e98c20d6224 -
Trigger Event:
push
-
Statement type:
File details
Details for the file modbus_connector_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: modbus_connector_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a7a0c37a96d00c49d5adb171e3ebf9081dd3b40d876beda0737e721ab8094ad
|
|
| MD5 |
b75439abcfeab3a996c3f1e22acca24b
|
|
| BLAKE2b-256 |
82e7b3f3a1b64f63073e9c548af338e57cb510844a33589121ddba10f8f57aae
|
Provenance
The following attestation bundles were made for modbus_connector_mcp-0.1.1-py3-none-any.whl:
Publisher:
build.yml on cramen/modbus_connector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modbus_connector_mcp-0.1.1-py3-none-any.whl -
Subject digest:
0a7a0c37a96d00c49d5adb171e3ebf9081dd3b40d876beda0737e721ab8094ad - Sigstore transparency entry: 2669255937
- Sigstore integration time:
-
Permalink:
cramen/modbus_connector@aa1680bb41d5f68a295018a3d78f7e98c20d6224 -
Branch / Tag:
refs/tags/v0.14.2 - Owner: https://github.com/cramen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@aa1680bb41d5f68a295018a3d78f7e98c20d6224 -
Trigger Event:
push
-
Statement type: