OPC UA MCP Server
Connects to any OPC UA server and exposes its node tree and data via MCP, with tools to read values and search nodes.
README
OPC UA MCP Server
A Python application that connects to an OPC UA server and exposes it via MCP (Model Context Protocol) using FastMCP.
Features
- Connect to any OPC UA server with optional authentication
- Browse the complete node tree from a configurable starting node
- Expose the OPC UA node tree as MCP resources
- Read values from OPC UA nodes
- Search nodes by display name or browse name with wildcard support
- Support for both stdio and SSE (Server-Sent Events) transport methods
Installation
pip install -r requirements.txt
Usage
Basic usage with HTTP transport (default):
python opcua_mcp_server.py opc.tcp://localhost:4840
With authentication:
python opcua_mcp_server.py opc.tcp://localhost:4840 --username myuser --password mypass
Using stdio transport:
python opcua_mcp_server.py opc.tcp://localhost:4840 --transport stdio
With custom starting node and HTTP port:
python opcua_mcp_server.py opc.tcp://localhost:4840 --start-node "i=84" --http-port 8080
Command Line Arguments
opcua_url(required): OPC UA server URL (e.g., opc.tcp://localhost:4840)--start-node: Starting node ID for browsing (default: i=85)--username: Username for OPC UA authentication--password: Password for OPC UA authentication--transport: MCP transport method - 'stdio' or 'http' (default: http)--http-port: Port for HTTP transport (default: 3000)
MCP Tools
The server provides the following tools:
read-value
Read the current value of one or more OPC UA nodes.
Parameters:
node_ids: List of node IDs to read
Example:
{
"node_ids": ["ns=2;s=MyVariable", "ns=2;s=Temperature"]
}
find-by-display-name
Find nodes by display name pattern (supports wildcards).
Parameters:
pattern: Display name pattern with wildcards (e.g., Temperature)
Example:
{
"pattern": "*Temperature*"
}
find-by-browse-name
Find nodes by browse name pattern (supports wildcards).
Parameters:
pattern: Browse name pattern with wildcards (e.g., Sensor)
Example:
{
"pattern": "*Sensor*"
}
Node Information
Each node in the tree contains:
node_id: The OPC UA node identifierbrowse_name: The browse name of the nodedisplay_name: The human-readable display namenode_class: The type of node (e.g., Object, Variable, Method, etc.)children: List of child nodes (only for non-leaf nodes)
Example
- Start an OPC UA server (e.g., using
opcua-asyncioexample server) - Run the MCP server:
python opcua_mcp_server.py opc.tcp://localhost:4840 - The MCP server will connect to the OPC UA server, browse the node tree, and expose it via MCP
- You can now use any MCP client to interact with the OPC UA data
Error Handling
- The server will exit if it cannot connect to the OPC UA server
- Individual node read errors are returned in the response
- The server properly disconnects from the OPC UA server on shutdown
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.