AgentStack
MCP verified MIT Self-run

OPC UA LinkAI

mcp-zhongriqian-opc-ua-linkai · by zhongriqian

Empowering OPC UA as the Model Context Protocol (MCP) for industrial intelligence. It enables AI Agents to seamlessly discover, connect, and intelligently control automation hardware.

No reviews yet
0 installs
1 views
0.0% view→install

Install

$ agentstack add mcp-zhongriqian-opc-ua-linkai

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of OPC UA LinkAI? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

OPC UA LinkAI 项目

项目简介

OPC UA LinkAI 是一个为 OPC UA 协议提供功能扩展的框架,使 OPC UA 成为工业自动化领域的 MCP(模型上下文协议),让 AI Agent 能够便捷使用 OPC UA 连接工业自动化设备并进行智能操控。

项目文件结构

opcua_linkai/
├── src/
│   └── opcua_linkai/         # 核心源代码
│       ├── __init__.py       # 包初始化文件
│       ├── caller.py         # 工具调用路由
│       ├── context.py        # 上下文管理
│       ├── linkai_client.py  # 异步 OPC UA 客户端(核心)
│       ├── linkai_syncclient.py  # 同步 OPC UA 客户端
│       ├── registry.py       # 工具注册表
│       ├── scanner.py        # 信息模型扫描器
│       ├── tools.py          # 核心工具实现
│       └── utils.py          # 工具函数
├── examples/
│   ├── client/               # 客户端示例
│   │   ├── .env              # 环境变量配置
│   │   ├── agent_test.py     # 智能代理测试
│   │   ├── client_function_test.py  # 客户端功能测试
│   │   ├── dynamic_information_model_127.0.0.1_4840.json  # 动态信息模型
│   │   └── information_model_127.0.0.1_4840.json  # 静态信息模型
│   ├── coppeliasim_scene/    # 测试仿真环境
│   │   ├── UR5_Grip_Scene.ttt  # UR5 机器人仿真场景文件
│   │   ├── connection_manager.py  # 连接管理器
│   │   ├── scene_manager.py     # 场景管理器
│   │   ├── ur5.py               # UR5 机器人控制类
│   │   ├── utils.py             # 工具函数
│   │   └── vision_system.py     # 视觉系统
│   └── server/               # 服务器示例
│       ├── test.py            # 测试服务器
│       └── ur5_vision_server.py  # UR5 视觉服务器
└── README.md                 # 项目说明文档

项目主要功能

1. LinkAI 客户端核心功能

  • 异步客户端实现LinkAI_Client 提供基于 asyncio 的异步操作,支持高并发场景
  • 同步客户端封装LinkAI_SyncClient 提供同步接口,便于在传统同步代码中使用
  • 信息模型扫描:自动扫描 OPC UA 服务器的信息模型,并以 JSON 格式保存,为 AI Agent 提供结构化的设备模型
  • 智能工具调用:将 OPC UA 操作封装为标准工具,支持 AI Agent 通过自然语言调用
  • 服务器摘要获取:快速获取服务器的基本信息,用于 AI Agent 快速了解设备状态
  • 线程安全操作:支持在多线程环境中安全操作 OPC UA 客户端

2. 核心工具集

  • read_value:读取指定路径节点的当前实时数值
  • write_value:向指定路径节点写入数值
  • call_method:调用指定路径节点的方法
  • processivescaninformation_model:渐进式扫描信息模型结构,获取设备的详细能力描述

3. 技术特点

  • MCP 协议实现:将 OPC UA 扩展为工业自动化领域的模型上下文协议
  • AI Agent 友好:提供标准工具接口,便于 AI Agent 理解和使用
  • 模块化设计:易于扩展和定制,支持添加新的工具和功能
  • 异步编程:使用 asyncio 实现高效的异步操作

快速开始

1. 安装依赖

# 安装项目依赖
pip install -r requirements.txt

2. 运行服务器示例

# 运行 UR5 视觉服务器(用于测试)
python examples/server/ur5_vision_server.py

3. 运行客户端示例

# 运行客户端功能测试
python examples/client/client_function_test.py

# 运行智能代理测试(需要配置 .env 文件中的 API 密钥)
python examples/client/agent_test.py

4. 基本使用示例

from opcua_linkai.linkai_syncclient import LinkAI_SyncClient

# 初始化客户端
client = LinkAI_SyncClient("opc.tcp://127.0.0.1:4840/opcua/linkai/")

# 获取服务器摘要
summary = client.get_summary()
print(f"Server summary: {summary}")

# 扫描信息模型
client.scan_information_model()

# 获取工具列表
tools = client.get_tools()
print(f"Available tools: {[tool['name'] for tool in tools]}")

# 读取变量值
result = client.handle_tool_request(
    "read_value", 
    {"path_list": ["Objects", "UR5RobotArm", "Status", "IsHomed"]}
)
print(f"Read value result: {result}")

# 调用方法
result = client.handle_tool_request(
    "call_method", 
    {"path_list": ["Objects", "VisionSystem", "Function", "DetectObjects"], "args": []}
)
print(f"Call method result: {result}")

# 断开连接
client.disconnect()

注意事项

  • CoppeliaSim 说明:CoppeliaSim 是用于测试的仿真环境
  • 智能代理测试:需要配置 .env 文件中的 API 密钥
  • 实际应用:在实际工业环境中,可直接连接真实的 OPC UA 服务器
  • 扩展性:可通过扩展 tools.py 添加新的工具,或通过修改 scanner.py 定制信息模型扫描行为

许可证

本项目采用 MIT 许可证,详见 LICENSE 文件。

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.