The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Modbus MCP listing page.
An MCP server that standardizes and contextualizes Modbus data, enabling seamless integration of AI agents with industrial IoT systems.
read_register, write_register).read_coils, write_coil).read_input_registers).read_multiple_holding_registers).analyze_register).Install uv:
Clone the Repository:
Install Dependencies:
The server connects to a Modbus device using parameters specified via environment variables. Set these variables in a .env file or your shell environment.
| Variable | Description | Default | Required |
|---|---|---|---|
MODBUS_TYPE | Connection type: tcp, udp, or serial | tcp | Yes |
MODBUS_HOST | Host address for TCP/UDP | 127.0.0.1 | For TCP/UDP |
MODBUS_PORT | Port for TCP/UDP | 502 | For TCP/UDP |
MODBUS_DEFAULT_SLAVE_ID | Slave ID | 1 | For TCP/UDP |
MODBUS_SERIAL_PORT | Serial port (e.g., /dev/ttyUSB0, COM1) | /dev/ttyUSB0 | For serial |
MODBUS_BAUDRATE | Serial baud rate | 9600 | For serial |
MODBUS_PARITY | Serial parity: N (none), E (even), O (odd) | N | For serial |
MODBUS_STOPBITS | Serial stop bits | 1 | For serial |
MODBUS_BYTESIZE | Serial byte size | 8 | For serial |
MODBUS_TIMEOUT | Serial timeout (seconds) | 1 | For serial |
.env FileFor TCP:
For Serial:
The configuration file:
Note: Natural language support depends on the client’s ability to parse and map prompts to tools. The MCP Inspector requires structured JSON, but the examples below show how conversational inputs translate.
Read a Holding Register:
Value: <register_value>Write to a Holding Register:
Successfully wrote 100 to register 10Read Coils:
Coils 0 to 4: [False, False, False, False, False]Write to a Coil:
Successfully wrote True to coil 5Read Input Registers:
Input Registers 2 to 4: [<value1>, <value2>, <value3>]Read Multiple Holding Registers:
Holding Registers 0 to 2: [<value1>, <value2>, <value3>]This project is licensed under the MIT License. See LICENSE for details.