
Modbus MCP Server
Connect AI agents to industrial IoT: read and write Modbus registers and coils over TCP, UDP, or serial.
Add to your client
Copy the config for your MCP client and paste it into its config file.
git clone https://github.com/kukapay/modbus-mcp.git && cd modbus-mcp && uv syncPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"modbus-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/path/to/modbus-mcp",
"run",
"modbus-mcp"
],
"env": {
"MODBUS_TYPE": "tcp",
"MODBUS_HOST": "127.0.0.1",
"MODBUS_PORT": "502"
}
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- Python 3.10+
- uv for dependency and virtual environment management
- Network or serial access to a Modbus device (TCP/UDP host and port, or a serial port)
About Modbus MCP Server
An MCP server that standardizes and contextualizes Modbus data, enabling seamless integration of AI agents with industrial IoT systems. It provides tools for reading and writing Modbus holding registers, input registers, and coils, with flexible connectivity over TCP, UDP, or serial. Connection parameters (type, host, port, slave ID, serial settings) are supplied through environment variables, and a customizable prompt assists with analyzing register values.
Tools & capabilities (7)
read_registerRead the value of a Modbus holding register at a given address (with slave_id).
write_registerWrite a value to a Modbus holding register at a given address (with slave_id).
read_coilsRead the status of one or more Modbus coils starting at an address (address, count, slave_id).
write_coilWrite a boolean value to a single Modbus coil at a given address (with slave_id).
read_input_registersRead the values of multiple Modbus input registers starting from an address (address, count, slave_id).
read_multiple_holding_registersRead the values of a range of Modbus holding registers (address, count, slave_id).
analyze_registerPrompt that analyzes Modbus register values using a customizable prompt.
When to use it
- Letting an AI agent monitor and adjust PLC or industrial controller values via Modbus
- Reading sensor data from input registers in an industrial IoT setup
- Toggling coils to control relays, valves, or actuators through natural-language commands
- Diagnosing and analyzing Modbus register values with AI assistance
Security notes
The server can write to Modbus coils and holding registers on connected industrial devices, which may control physical equipment. Restrict it to trusted networks/devices and review write operations carefully. Modbus itself has no built-in authentication or encryption.
Modbus MCP Server FAQ
Which Modbus transports are supported?
Modbus over TCP, UDP, or serial, selected via the MODBUS_TYPE environment variable (tcp, udp, or serial).
How is the connection configured?
Through environment variables such as MODBUS_HOST, MODBUS_PORT, MODBUS_DEFAULT_SLAVE_ID for TCP/UDP, and MODBUS_SERIAL_PORT, MODBUS_BAUDRATE, MODBUS_PARITY, MODBUS_STOPBITS, MODBUS_BYTESIZE, and MODBUS_TIMEOUT for serial. These can be set in a .env file or the shell.
How do I run it with Claude Desktop?
Add an entry to mcpServers using command 'uv' with args ['--directory', '/path/to/modbus-mcp', 'run', 'modbus-mcp'] and your MODBUS_* environment variables.
Alternatives to Modbus MCP Server
Compare all alternatives →GitHub's official server for repos, issues, PRs, and Actions — local Docker or hosted remote.
Official AWS Labs server that lets agents call any AWS API via the AWS CLI surface.
Bulk Kubernetes port forwarding with an MCP server that lets AI assistants forward services, inspect pods, and monitor traffic.
Compare Modbus MCP Server with: