- OPC UA MCP Server
OPC UA MCP Server
Content
OPC UA MCP Server

Overview
Python and TypeScript implementations provide the same core functionality for OPC UA operations through MCP tools, but differ in their implementation approach and deployment model.
Example Usage in Conversation
Once configured, you can ask Claude to perform real-world OPC UA operations:
Reading Sensor Values
- "What is the current temperature reading from the reactor vessel?"
- "Check the pressure level in Tank A"
- "Read all temperature sensors in the cooling system"
- "Get the current flow rate on production line B"
Controlling Equipment
- "Turn on the conveyor motor"
- "Set the mixer speed to 80 RPM"
- "Open valve V-101 to 75% position"
- "Start the circulation pump"
- "Set the heating element to 150°C"
Production Operations
- "Start production on line 1 with rate 100 units/hour"
- "Stop all motors in emergency mode"
- "Initialize the batch reactor with recipe A"
- "Begin the cleaning cycle for Tank B"
System Monitoring
- "Show me all alarm states in the system"
- "Read all sensor values from the water treatment plant"
- "Check the status of all pumps and motors"
- "Get the energy consumption readings"
- "Discover all available variables in the OPC UA server"
- "Show me a complete inventory of all sensors and actuators"
Real Example Scenarios
User: "What's the temperature in reactor R-101?"
Assistant: I'll read the temperature sensor for reactor R-101.
Tool call: read_opcua_node with node_id "ns=2;i=11"
Result: "Reactor R-101 temperature: 87.3°C"
User: "Turn on the main conveyor motor"
Assistant: I'll start the main conveyor motor for you.
Tool call: write_opcua_node with node_id "ns=2;i=12" and value "true"
Result: "Main conveyor motor started successfully"
User: "Set the pump speed to 65%"
Assistant: I'll adjust the pump speed to 65%.
Tool call: write_opcua_node with node_id "ns=2;i=13" and value "65"
Result: "Pump speed set to 65%"
User: "Show me all available variables in the system"
Assistant: I'll get a complete list of all variables in the OPC UA server.
Tool call: get_all_variables
Result: "Found 15 variables:
- Name: Temperature_Sensor_01, NodeID: ns=2;i=101, Value: 87.3°C
- Name: Pressure_Sensor_01, NodeID: ns=2;i=102, Value: 2.5 bar
- Name: Flow_Rate_01, NodeID: ns=2;i=103, Value: 125.8 L/min
..."
Implementation Languages
Python Version (opcua-mcp-server)
- Language: Python 3.13+
- Framework: FastMCP
- OPC UA Library:
opcua(FreeOpcUa) - Transport: STDIO
- Entry Point:
opcua-mcp-server.py
NPX Version (opcua-mcp-npx-server)
- Language: TypeScript/Node.js
- Framework: @modelcontextprotocol/sdk
- OPC UA Library:
node-opcua - Transport: STDIO
- Entry Point:
src/index.ts(compiled tobuild/index.js)
Features Comparison
| Feature | Python Version | NPX Version | Notes |
|---|---|---|---|
| Read Single Node | ✅ | ✅ | Both support automatic type detection |
| Write Single Node | ✅ | ✅ | Both support automatic type conversion |
| Browse Node Children | ✅ | ✅ | Both return JSON formatted results |
| Call OPC UA Methods | ✅ | ✅ | Both support parameter conversion |
| Read Multiple Nodes | ✅ | ✅ | Batch read operations |
| Write Multiple Nodes | ✅ | ✅ | Batch write operations |
| Get All Variables | ✅ | ✅ | Discover all variables in server address space |
| Connection Management | ✅ | ✅ | Both handle lifecycle automatically |
| Error Handling | ✅ | ✅ | Comprehensive error reporting |
| Type Conversion | ✅ | ✅ | Automatic data type conversion |
Tool Implementations
Available Tools (Both Versions)
-
read_opcua_node- Read value from a single OPC UA node
- Parameters:
node_id(string) - Returns: Node value with ID prefix
-
write_opcua_node- Write value to a single OPC UA node
- Parameters:
node_id(string),value(string) - Returns: Success/failure message
-
browse_opcua_node_children- Browse children of an OPC UA node
- Parameters:
node_id(string) - Returns: Array of child nodes with IDs and browse names
-
read_multiple_opcua_nodes- Read values from multiple nodes in one request
- Parameters:
node_ids(array of strings) - Returns: Dictionary mapping node IDs to values
-
write_multiple_opcua_nodes- Write values to multiple nodes in one request
- Parameters:
nodes_to_write(array of {node_id, value} objects) - Returns: Status results for each write operation
-
call_opcua_method- Call a method on an OPC UA object
- Parameters:
object_node_id,method_node_id,arguments(optional) - Returns: Method execution result
-
get_all_variables- Get all available variables from the OPC UA server
- Parameters: None
- Returns: Comprehensive list of all variables with their properties (name, node ID, value, data type, description)
Deployment & Installation
Python Version
# Installation
cd opcua-mcp-server
uv install # or pip install
# Usage
uv run opcua-mcp-server.py
# or
python opcua-mcp-server.py
NPX Version
# Direct usage (recommended)
npx opcua-mcp-npx-server
# Global installation
npm install -g opcua-mcp-npx-server
opcua-mcp-npx-server
# Development
npm install
npm run build
npm start
NPM Package: https://www.npmjs.com/package/opcua-mcp-npx-server
Configuration
Both versions use the same environment variable:
OPCUA_SERVER_URL: OPC UA server endpoint (default:opc.tcp://localhost:4840)
Python Configuration Example
{
"mcpServers": {
"opcua-python": {
"command": "/Users/mx/.local/bin/uv",
"args": [
"--directory",
"/path/to/opcua-mcp-server",
"run",
"opcua-mcp-server.py"
],
"env": {
"OPCUA_SERVER_URL": "opc.tcp://localhost:4840"
}
}
}
}
NPX Configuration Example
{
"mcpServers": {
"opcua-npx": {
"command": "npx",
"args": ["opcua-mcp-npx-server"],
"env": {
"OPCUA_SERVER_URL": "opc.tcp://localhost:4840"
}
}
}
}
Dependencies
Python Version
mcp[cli]>=1.9.1: MCP frameworkopcua>=0.98.13: OPC UA client librarycryptography>=45.0.2: Security supporthttpx>=0.28.1: HTTP client
NPX Version
@modelcontextprotocol/sdk: MCP SDK for Node.jsnode-opcua: Comprehensive OPC UA librarytypescript: TypeScript compiler@types/node: Node.js type definitions
Security
Both versions currently connect with:
SecurityPolicy.NoneMessageSecurityMode.None
For production use, both should implement:
- Certificate-based authentication
- Encrypted communication
- User authentication
- Input validation
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
ChatWiseThe second fastest AI chatbot™
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
DeepChatYour AI Partner on Desktop
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors