SuperAPIAI Directory

modbus-mcp

github.com · AI developer platforms

📟 - Standardize and contextualize industrial Modbus data.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Purpose

modbus-mcp is an MCP (Model Context Protocol) server designed to standardize and contextualize industrial Modbus data, enabling AI agents to integrate seamlessly with Industrial IoT systems.

Main Capabilities

The project provides the following 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)

It also provides a prompt feature: analyze Modbus register values via a customizable prompt (analyze_register).

Usage

Environment Setup

This project uses uv for dependency and virtual environment management.

  1. Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Clone the repository:
git clone https://github.com/kukapay/modbus-mcp.git
cd modbus-mcp
  1. Install dependencies:
uv sync

Connection Configuration

The server connects to Modbus devices using parameters specified via environment variables. These variables can be set in a .env file or in the shell environment (the documentation includes environment variable examples and a .env file example).

Modbus over TCP, UDP, or serial connections are supported, configured via environment variables.

Integration with Claude Desktop

The documentation provides configuration file instructions for Claude Desktop. Note: natural language support depends on the client's ability to parse prompts and map them to tools. MCP Inspector requires structured JSON, but the examples in the documentation show how conversational input is translated.

Usage Examples

The following examples show natural language prompts with the corresponding MCP Inspector JSON and expected output:

  • Read 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>

  • Write 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

  • 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]

  • Write 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

  • 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>]

  • 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>]

Applicable Scenarios

Suitable for scenarios that require connecting AI agents to Industrial IoT systems and performing data read/write and analysis on Modbus devices.

Limitations

Natural language support depends on the client's ability to parse prompts and map them to tools; MCP Inspector requires structured JSON input. Other platform support, charging models, or performance metrics not mentioned in the materials are not yet provided.

License

This project uses the MIT License, see the LICENSE file for details.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools