
How to add Modbus MCP Server to Cursor
Connect AI agents to industrial IoT: read and write Modbus registers and coils over TCP, UDP, or serial. Paste the config into ~/.cursor/mcp.json and restart Cursor.
Last updated June 14, 2026 · 25★ · stdio · no auth
Cursor config for Modbus MCP Server
git clone https://github.com/kukapay/modbus-mcp.git && cd modbus-mcp && uv sync{
"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"
}
}
}
}Setup steps
- 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
- 2Paste the Modbus MCP Server config below into the "mcpServers" object.
- 3Fill in placeholder secrets, then save.
- 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
- 5Ask Cursor to use one of Modbus MCP Server's tools to confirm it's connected.
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)
What Modbus MCP Server can do in Cursor
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.
Security
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 + Cursor FAQ
Where is the Cursor config file?
Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the Modbus MCP Server config there under the "mcpServers" key and restart the client.
Is Modbus MCP Server safe to use with Cursor?
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.
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.