modbus-mcp
Modbus MCP 服务器
MCP 服务器可标准化和情境化 Modbus 数据,从而实现 AI 代理与工业物联网系统的无缝集成。
特征
Modbus工具:
读/写保持寄存器(
read_register,write_register)。读/写线圈(
read_coils,write_coil)。读取输入寄存器(
read_input_registers)。读取多个保持寄存器(
read_multiple_holding_registers)。
提示:使用可自定义的提示(
analyze_register)分析 Modbus 寄存器值。灵活的连接:支持通过 TCP、UDP 或串行的 Modbus,通过环境变量进行配置。
Related MCP server: Industrial MCP
要求
Python :3.10
uv用于依赖项和虚拟环境管理。
安装
安装
uv:curl -LsSf https://astral.sh/uv/install.sh | sh克隆存储库:
git clone https://github.com/kukapay/modbus-mcp.git cd modbus-mcp安装依赖项:
uv sync
配置
服务器使用通过环境变量指定的参数连接到 Modbus 设备。请在.env文件或 Shell 环境中设置这些变量。
环境变量
多变的 | 描述 | 默认 | 必需的 |
| 连接类型: |
| 是的 |
| TCP/UDP 的主机地址 |
| 对于 TCP/UDP |
| TCP/UDP 端口 |
| 对于 TCP/UDP |
| 串行端口(例如 |
| 对于串行 |
| 串口波特率 |
| 对于串行 |
| 串行奇偶校验: |
| 对于串行 |
| 串行停止位 |
| 对于串行 |
| 串行字节大小 |
| 对于串行 |
| 串行超时(秒) |
| 对于串行 |
示例.env文件
对于 TCP:
MODBUS_TYPE=tcp
MODBUS_HOST=192.168.1.100
MODBUS_PORT=502对于串行:
MODBUS_TYPE=serial
MODBUS_SERIAL_PORT=/dev/ttyUSB0
MODBUS_BAUDRATE=9600
MODBUS_PARITY=N
MODBUS_STOPBITS=1
MODBUS_BYTESIZE=8
MODBUS_TIMEOUT=1用法
安装 Claude Desktop
配置文件:
{
"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 },
}
}
}使用工具
注意:自然语言支持取决于客户端解析提示并将其映射到工具的能力。MCP 检查器需要结构化 JSON,但以下示例展示了对话输入的翻译方式。
读取保持寄存器:
迅速的:
Please read the value of Modbus holding register 0.MCP 检查器 JSON :
{ "tool": "read_register", "parameters": {"address": 0} }预期输出:
Value: <register_value>
写入保持寄存器:
迅速的:
Set Modbus holding register 10 to the value 100.MCP 检查器 JSON :
{ "tool": "write_register", "parameters": {"address": 10, "value": 100} }预期输出:
Successfully wrote 100 to register 10
读取线圈:
迅速的:
Check the status of the first 5 Modbus coils starting at address 0.MCP 检查器 JSON :
{ "tool": "read_coils", "parameters": {"address": 0, "count": 5} }预期输出:
Coils 0 to 4: [False, False, False, False, False]
写入线圈:
迅速的:
Turn on Modbus coil 5.MCP 检查器 JSON :
{ "tool": "write_coil", "parameters": {"address": 5, "value": true} }预期输出:
Successfully wrote True to coil 5
读取输入寄存器:
迅速的:
Read the values of 3 Modbus input registers starting from address 2.MCP 检查器 JSON :
{ "tool": "read_input_registers", "parameters": {"address": 2, "count": 3} }预期输出:
Input Registers 2 to 4: [<value1>, <value2>, <value3>]
读取多个保持寄存器:
迅速的:
Get the values of Modbus holding registers 0 through 2.MCP 检查器 JSON :
{ "tool": "read_multiple_holding_registers", "parameters": {"address": 0, "count": 3} }预期输出:
Holding Registers 0 to 2: [<value1>, <value2>, <value3>]
执照
本项目遵循 MIT 许可证。详情请参阅许可证。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server giving access to Grafana dashboards, data and more.
Cloud-hosted MCP server for secure AI access to enterprise data sources via CData Connect AI.
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Hosted MCP server for AI-driven data ops. Create apps, manage schemas, and CRUD structured data.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for Modbus TCP devices that enables AI agents to read/write PLC registers by name using YAML device profiles, with a built-in simulator.2MIT
- AlicenseNot gradedqualityDmaintenanceAn open-source MCP server that bridges AI models with industrial equipment, supporting multiple protocols like Modbus, OPC UA, and MQTT for reading data and controlling machines.2Apache 2.0
- AlicenseAqualityBmaintenanceMCP server that unifies real-time telemetry from industrial systems into a single queryable interface, enabling production visibility, anomaly detection, and operational insights.521MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for Modbus RTU/TCP instrument control, enabling query and write operations on Modbus registers through a standardized interface, supporting both standalone use and integration with lab-executor.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kukapay/modbus-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server