KO

kukapay/opcua-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

31 stars 13 forks 质量 65 趋势 0MIT

一台连接OPC通用工业系统的MCP服务器。

概览

一台连接OPC UA支持工业系统的MCP服务器,使AI代理能够实时监控、分析和控制运营数据。 该项目非常适合希望将人工智能驱动的工作流程与工业自动化系统连接的开发者和工程师。 - : 从工业设备中获取实时值。- : 通过向指定节点写入值来控制设备。- : 请求列出 allopcua 节点- : 从设备中检索多个实时值。- : 通过写入多个节点的值来控制设备。- : 与 MCP 客户端如 Claude Desktop 配合自然语言交互。 服务器会暴露五个工具:- : - 读取特定 OPC UA 节点的值。- : - node_id (str):OPC UA 节点 ID(例如 ns=2;i=2)。- : 一个包含节点 ID 及其值的字符串(例如,“节点 ns=2;i=2 值: 42”)。 - : - : 写入一个值给特定的 OPC UA 节点。- : - node_id (str):OPC UA 节点 ID(例如 ns=2;i=3)。- value (str):要写入的值(根据节点类型转换)。

概述(AI 翻译)

一台连接OPC UA支持工业系统的MCP服务器,使AI代理能够实时监控、分析和控制运营数据。

该项目非常适合希望将人工智能驱动的工作流程与工业自动化系统连接的开发者和工程师。

特色

  • 读取OPC UA节点:从工业设备中获取实时值。
  • 写入OPC UA节点:通过向指定节点写入数值来控制设备。
  • 浏览节点:请求列出异物节点
  • 读取多个OPC UA节点:从设备中获取多个实时值。
  • 写入多个OPC UA节点:通过写入多个节点来控制设备。
  • 无缝集成:可与 Claude Desktop 等 MCP 客户端配合自然语言交互。

工具

服务器提供了五个工具:

  • read_opcua_node:

  • 描述:读取特定OPC UA节点的值。

  • 参数:

  • node_id (str):OPC UA 节点 ID(例如 ns=2;i=2)。

  • 返回:包含节点ID及其值的字符串(例如,“节点ns=2;i=2值:42”)。

  • write_opcua_node:

  • 描述:将值写入特定的OPC UA节点。

  • 参数:

本页由 AI 翻译,技术细节请以原文为准。

README

OPC UA MCP Server

An MCP server that connects to OPC UA-enabled industrial systems, allowing AI agents to monitor, analyze, and control operational data in real time.

This project is ideal for developers and engineers looking to bridge AI-driven workflows with industrial automation systems.

Features

  • Read OPC UA Nodes: Retrieve real-time values from industrial devices.
  • Write to OPC UA Nodes: Control devices by writing values to specified nodes.
  • Browse nodes: Request to list allopcua nodes
  • Read multiple OPC UA Nodes: Retrieve multiple real-time values from devices.
  • Write to multiple OPC UA Nodes: Control devices by writing values to multiple nodes.
  • Seamless Integration: Works with MCP clients like Claude Desktop for natural language interaction.

Tools

The server exposes five tools:

  • read_opcua_node:

    • Description: Read the value of a specific OPC UA node.
    • Parameters:
      • node_id (str): OPC UA node ID (e.g., ns=2;i=2).
    • Returns: A string with the node ID and its value (e.g., “Node ns=2;i=2 value: 42”).
  • write_opcua_node:

    • Description: Write a value to a specific OPC UA node.
    • Parameters:
      • node_id (str): OPC UA node ID (e.g., ns=2;i=3).
      • value (str): Value to write (converted based on node type).
    • Returns: A success or error message (e.g., “Successfully wrote 100 to node ns=2;i=3”).
  • Browse nodes:

    • Description: Read the value of a specific OPC UA node.
  • Read multiple OPC UA Nodes:

    • Description: Read the value of a specific OPC UA node.
  • Write to multiple OPC UA Nodes:

    • Description: Read the value of a specific OPC UA node.

Example Prompts

  • “What’s the value of node ns=2;i=2?” → Returns the current value.
  • “Set node ns=2;i=3 to 100.” → Writes 100 to the node.

Installation

Prerequisites

  • Python 3.13 or higher
  • An OPC UA server (e.g., a simulator or real industrial device)

Install Dependencies

Clone the repository and install the required Python packages:

git clone https://github.com/kukapay/opcua-mcp.git
cd opcua-mcp
pip install mcp[cli] opcua cryptography

MCP Client Configuration

{
 "mcpServers": {
   "opcua-mcp": {
     "command": "python",
     "args": ["path/to/opcua_mcp/main.py"],
     "env": {
        "OPCUA_SERVER_URL": "your-opc-ua-server-url"
     }
   }
 }
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "opcua-mcp": { "command": "python", "args": ["path/to/opcua_mcp/main.py"], "env": { "OPCUA_SERVER_URL": "your-opc-ua-server-url" } } } }