kukapay/modbus-mcp
FreeNot checkedAn MCP server that standardizes and contextualizes industrial Modbus data.
About
An MCP server that standardizes and contextualizes industrial Modbus data.
README
An MCP server that standardizes and contextualizes Modbus data, enabling seamless integration of AI agents with industrial IoT systems.
Features
- Modbus Tools:
- Read/write holding registers (
read_register,write_register). - Read/write coils (
read_coils,write_coil). - Read input registers (
read_input_registers). - Read multiple holding registers (
read_multiple_holding_registers).
- Read/write holding registers (
- Prompt: Analyze Modbus register values with a customizable prompt (
analyze_register). - Flexible Connections: Supports Modbus over TCP, UDP, or serial, configured via environment variables.
Requirements
- Python: 3.10
- uv for dependency and virtual environment management.
Installation
Install
uv:curl -LsSf https://astral.sh/uv/install.sh | shClone the Repository:
git clone https://github.com/kukapay/modbus-mcp.git cd modbus-mcpInstall Dependencies:
uv sync
Configuration
The server connects to a Modbus device using parameters specified via environment variables. Set these variables in a .env file or your shell environment.
Environment Variables
| 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 |
Example .env File
For TCP:
MODBUS_TYPE=tcp
MODBUS_HOST=192.168.1.100
MODBUS_PORT=502
MODBUS_SLAVE_ID=1
For Serial:
MODBUS_TYPE=serial
MODBUS_SERIAL_PORT=/dev/ttyUSB0
MODBUS_BAUDRATE=9600
MODBUS_PARITY=N
MODBUS_STOPBITS=1
MODBUS_BYTESIZE=8
MODBUS_TIMEOUT=1
Usage
Installing for Claude Desktop
The configuration file:
{
"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 },
}
}
}
Using Tools
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:
- Prompt:
Please read the value of Modbus holding register 0. - MCP Inspector JSON:
{ "tool": "read_register", "parameters": {"address": 0, "slave_id": 1} } - Expected Output:
Value: <register_value>
- Prompt:
Write to a Holding Register:
- Prompt:
Set Modbus holding register 10 to the value 100. - MCP Inspector JSON:
{ "tool": "write_register", "parameters": {"address": 10, "value": 100, "slave_id": 1} } - Expected Output:
Successfully wrote 100 to register 10
- Prompt:
Read Coils:
- Prompt:
Check the status of the first 5 Modbus coils starting at address 0. - MCP Inspector JSON:
{ "tool": "read_coils", "parameters": {"address": 0, "count": 5, "slave_id": 1} } - Expected Output:
Coils 0 to 4: [False, False, False, False, False]
- Prompt:
Write to a Coil:
- Prompt:
Turn on Modbus coil 5. - MCP Inspector JSON:
{ "tool": "write_coil", "parameters": {"address": 5, "value": true, "slave_id": 1} } - Expected Output:
Successfully wrote True to coil 5
- Prompt:
Read Input Registers:
- Prompt:
Read the values of 3 Modbus input registers starting from address 2. - MCP Inspector JSON:
{ "tool": "read_input_registers", "parameters": {"address": 2, "count": 3, "slave_id": 1} } - Expected Output:
Input Registers 2 to 4: [<value1>, <value2>, <value3>]
- Prompt:
Read Multiple Holding Registers:
- Prompt:
Get the values of Modbus holding registers 0 through 2. - MCP Inspector JSON:
{ "tool": "read_multiple_holding_registers", "parameters": {"address": 0, "count": 3, "slave_id": 1} } - Expected Output:
Holding Registers 0 to 2: [<value1>, <value2>, <value3>]
- Prompt:
License
This project is licensed under the MIT License. See LICENSE for details.
Installing kukapay/modbus-mcp
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/kukapay/modbus-mcpFAQ
Is kukapay/modbus-mcp MCP free?
Yes, kukapay/modbus-mcp MCP is free — one-click install via Unyly at no cost.
Does kukapay/modbus-mcp need an API key?
No, kukapay/modbus-mcp runs without API keys or environment variables.
Is kukapay/modbus-mcp hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install kukapay/modbus-mcp in Claude Desktop, Claude Code or Cursor?
Open kukapay/modbus-mcp on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectAmap Maps Mcp Server
MCP server for using the AMap Maps API
by duxiaohuiSupabase
Database, auth and storage
by SupabaseEverything
Reference / test server with prompts, resources, and tools.
Git
Tools to read, search, and manipulate Git repositories.
Sequential Thinking
Dynamic and reflective problem-solving through thought sequences.
Time
Time and timezone conversion capabilities.
Compare kukapay/modbus-mcp with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
