Home / MCP / OPC UA MCP Server
Provides real time OPC UA read/write capabilities and node browsing through an MCP server for AI agents.
Configuration
View docs{
"mcpServers": {
"opcua_mcp": {
"command": "python",
"args": [
"path/to/opcua_mcp/main.py"
],
"env": {
"OPCUA_SERVER_URL": "YOUR_OPCUA_SERVER_URL"
}
}
}
}You can connect to OPC UA enabled industrial systems and expose real time data and control through an MCP server. This setup lets AI agents monitor, analyze, and influence equipment safely and efficiently by reading and writing OPC UA nodes in real time.
You run the MCP server locally and connect an MCP client to it. Use the client to read values from OPC UA nodes, write values to control devices, and browse the node tree. You can read single nodes, read multiple nodes, write to single nodes, and write to multiple nodes. The server is designed to work with common MCP clients for natural language interaction, enabling you to issue commands like querying a node value or setting a node to a specific value.
Prerequisites you must have before starting: Python 3.13 or higher and access to an OPC UA server (either a simulator or a real device). Install and run the server on a machine that can reach the OPC UA server.
# 1) Clone the MCP OPC UA server repository
git clone https://github.com/kukapay/opcua-mcp.git
# 2) Change into the repository directory
cd opcua-mcp
# 3) Install required Python packages
pip install mcp[cli] opcua cryptographyConfigure your MCP client to start the OPC UA MCP server by launching the Python script and providing the OPC UA server URL via environment variables.
{
"mcpServers": {
"opcua_mcp": {
"command": "python",
"args": ["path/to/opcua_mcp/main.py"],
"env": {
"OPCUA_SERVER_URL": "your-opc-ua-server-url"
}
}
}
}Read the value of a specific OPC UA node using a dedicated MCP tool. You provide the node_id (e.g., ns=2;i=2) and receive a response with the node value.
Write a value to a specific OPC UA node. You provide the node_id and the value to write, and you receive a confirmation or error message.
List the OPC UA nodes available under a requested path to understand the node hierarchy.
Read values from multiple OPC UA nodes in a single operation, returning their current values.
Write values to multiple OPC UA nodes in a single operation to control several devices at once.