OPCUA4MCP
OPC UA tools for MCP Server. Python based implementation based on asyncua and FastMCP.
Ask AI about OPCUA4MCP
Powered by Claude · Grounded in docs
I know everything about OPCUA4MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
OPCUA protocol tools for MCP Server
Python based implementation based on asyncua and FastMCP.
Features
Prerequisites
- Python 3.10 or higher
- UV (for UV method - optional but recommended)
- Git (clone Repository)
Installation & Usage
Virtual environment:
uv venv
Activate it:
.venv\Scripts\activate
Install Python packages:
uv pip install fastmcp uv pip install asyncua
Run server first in test mode
uv run server.py test
NOTE: You need to download Prosys OPC UA Simulation server to run tests! Download it from https://prosysopc.com/products/opc-ua-simulation-server/ Run Simulation server before you start test.
Run basic tests
uv run test.py
Integration with Claude Desktop
Look menu: File -> Settings Developer
Add following JSON snippet into your local MCP servers. OPCUA4MCP server.py into claude_desktop_config.json file, example:
"opcua4mcp": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"--with",
"asyncua",
"fastmcp",
"run",
"D:\\YourFilePathToClonedRepo\\server.py:app" ],
"env": {
"USERNAME": "test",
"PASSWORD": "test"
},
"transport": "stdio",
"type": null,
"cwd": null,
"timeout": null,
"description": null,
"icon": null,
"authentication": null
},
Available Tools
The MCP server provides the following comprehensive tools for using OPC UA Server:
🔧 Implemented tools:
connect_opcua_server- Connect to OPC UA Server (Anonymous)connect_opcua_server_username_and_password- NOT WORKINGconnect_opcua_server_secure- NOT WORKINGdisconnect_opcua_serverdiscover_opcua_servers- NOT TESTEDbrowse_opcua_nodesread_node_valueget_node_inforead_multiple_opcua_nodeswrite_opcua_valuecopy_opcua_value_from_node_to_noderead_history_rawread_history_at_times
Example prompts
connect to opc.tcp://localhost:53530/OPCUA/SimulationServer
read node ns=5;s=Double
write value 2.2 to node ns=5;s=Double data type is Double
Connect to opc.tcp://localhost:53530/OPCUA/SimulationServer
Read history from node ns=3;i=1002 for the last 2 hours
read 1 minute average
visualize data
📬 Contact
Name: Mika Karaila
Email: mika.karaila@valmet.com
License
This project is licensed under the MIT License - see the LICENSE file for details.
