
How to add Modbus MCP Server to Windsurf
Connect AI agents to industrial IoT: read and write Modbus registers and coils over TCP, UDP, or serial. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 25★ · stdio · no auth
Windsurf 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 Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the Modbus MCP Server config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5Modbus MCP Server's tools become available to Cascade.
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 Windsurf
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 + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the Modbus MCP Server config there under the "mcpServers" key and restart the client.
Is Modbus MCP Server safe to use with Windsurf?
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.