OPC UA MCP Server
OPC UA MCP Server connects MCP agents to OPC UA machines so they can inspect live data, monitor changes and alarms, read history/events, and β only when explicitly permitted β control equipment.
Read current values for one or many OPC UA nodes, including data type, status/quality, timestamps, engineering units, ranges, and write-access metadata.
Browse or search the OPC UA address space by node ID or browse path, walk subtrees, filter by node class/name, and optionally read values while browsing.
Read node value history, either raw readings or server-side aggregates such as Average, Minimum, Maximum, and Count, with completeness and continuation information.
Read stored event history and list active/retained alarms and conditions.
Subscribe to node value changes and events, collect buffered changes/events, and unsubscribe from value subscriptions.
Check connection and server status, including endpoint/security, namespaces, server state, diagnostics, supported capabilities, and policy checks.
When allowed by profile and security settings: write allowlisted nodes, call allowlisted methods, and perform alarm actions such as acknowledging alarms.
Defaults to read-only
observe; control requires explicitoperator/fullprofiles, allowlists, limits, a secured/verified connection, and optional audit logging.
π OPC UA MCP Server
Connect Claude, Codex, Gemini and any other MCP agent to machines over OPC UA. Read live data, watch for alarms and, only when you allow it, control equipment.
Watch the demo Β· Quick start Β· Try it without hardware Β· Connect your agent Β· Tools Β· Safety Β· Docs
Official MCP Registry Β· Glama Β· HardwareMCP
See it in action
https://github.com/user-attachments/assets/2e1e9898-d942-41f6-bcc2-88e1a7ef1936
In this 3-minute demo, Claude watches a conveyor running in the free Prosys OPC UA Simulation Server. It reads the live values, checks the conveyor every minute on its own, reports an overheat alarm with a suggested fix, and lowers the speed only after you approve it. When asked for more than the allowed limit, it refuses. Codex connects to the same server with one command.
Related MCP server: Industrial-AIops
What it does
π Read | Browse the plant and read live values, history and events. Every value comes with its data type, quality, timestamps and unit (example). |
π Monitor | Subscribe to values and events. The agent collects every change since it last looked. |
π¨ Alarms | List active alarms and, when you allow it, acknowledge them. |
ποΈ Control | Write setpoints and call methods, but only on targets you allowlist, within the limits you set, with every call written to an audit log. |
Any OPC UA server: PLC, SCADA gateway, historian or simulator. Nothing to install on the plant side.
Any MCP agent: Claude Code, Claude Desktop, Codex, Gemini CLI, Antigravity, Cursor, VS Code, Windsurf and more.
Node or Python: two runtimes with the same tools. Use whichever you have.
Read-only by default: control needs an explicit profile and a secured, verified connection.
flowchart LR
A["AI agent<br/>(Claude, Codex, Gemini, Cursorβ¦)"] -->|MCP| B["OPC UA MCP Server<br/>(Node or Python)"]
B -->|OPC UA| C["Machine<br/>(PLC / SCADA / historian / simulator)"]Your agent starts the server as a local process (MCP over stdio). One process talks to one OPC UA endpoint, so add one entry per server (why). Remote and shared multi-client use is planned in the identity and isolation RFC.
Quick start
1. Check that it runs. You need Node.js 22.13+ or Python 3.10+ with uv. Pick one:
npx -y opcua-mcp-server --version # Node
uvx opcua-mcp-server --version # PythonIt prints a version and exits. You don't start the server yourself after that: your agent launches it. No Node or Python? Use the Claude Desktop bundle or a single-file executable.
2. Add it to your agent, with your OPC UA server's endpoint. For Claude Code:
claude mcp add opcua -e OPCUA_SERVER_URL=opc.tcp://localhost:4840/freeopcua/server/ -- npx -y opcua-mcp-serverFor Codex:
codex mcp add opcua --env OPCUA_SERVER_URL=opc.tcp://localhost:4840/freeopcua/server/ -- npx -y opcua-mcp-serverReplace the URL with your server's endpoint, and npx -y opcua-mcp-server with
uvx opcua-mcp-server for Python. Other agents: Connect your agent.
No OPC UA server yet? Try it without hardware.
3. Ask. Restart your agent or start a new session (approve the opcua server if it asks), then try:
"Check the OPC UA connection."
"Browse the server and read the current values."
"Watch the temperature for a minute and tell me what it does."
A working connection reports connected: true. If it fails, check that the OPC
UA server is running and that OPCUA_SERVER_URL matches its endpoint, then see
troubleshooting.
What you can ask
"What's the status of the line?"
"What was the temperature over the last hour? Give me the hourly average."
"What alarms are active right now?"
"When did the motor temperature start rising? Check its history."
"Set the valve position to 80%." (needs the
operatorprofile)
Let the agent watch on its own. The server keeps every change it sees, and the agent reads them when it checks. To have it check on a schedule, use your agent's scheduler. In Claude Code, for example:
/loop 1m Watch Conveyor 1. If the overheat alarm turns on, tell me what happened and suggest a fix.What works depends on the server: history needs historical access, server-side
averages need aggregates, and active alarms need Alarms & Conditions. Writes and
method calls need the operator profile, allowlisted targets and a secured
connection (Safety).
Try it without hardware
Prosys OPC UA Simulation Server. A free desktop app for Windows, macOS and
Linux from Prosys OPC,
used in the demo above. Start it and copy the connection address from its
Status tab, for example opc.tcp://localhost:53530/OPCUA/SimulationServer.
Every scenario in our compatibility tests passed
against it on both runtimes.
The simulated plant in this repository. Needs Git, Python 3.10+ and uv, even if you use the Node server:
git clone https://github.com/IndustriAgents/OPCUA-MCP.git
cd OPCUA-MCP
uv sync --all-packages
uv run --no-sync opcua-mock-serverWait for Server is running and ready for connections, keep the terminal open,
and use opc.tcp://localhost:4840/freeopcua/server/ as the endpoint.

Every tool call and value above is a real response from the bundled simulator,
recorded through the Python bridge under the read-only observe profile; the
question and answer text are scripted. Rebuild it with
scripts/readme_demo.py.
The plant supports browsing, sensor reads, data-change subscriptions, raw value history, plain events and event history. It also has writable actuators and methods, subject to the server's control policy. It does not implement processed aggregates or Alarms & Conditions. Use the separate mocks for those:
Mock | Endpoint | Coverage |
| Sensors, actuators, methods, raw history, subscriptions and plain events | |
| Processed history, such as average buckets | |
| Active conditions and acknowledgement |
The separate mocks need Node and npm; their READMEs give the commands. If port
4840 is busy, start the plant with
uv run --no-sync opcua-mock-server --endpoint opc.tcp://127.0.0.1:14840/freeopcua/server/
and use that URL instead. The MCP Inspector walkthrough has
more examples.
Connect your agent
Pick your agent below. The examples use the simulated plant's endpoint; replace
opc.tcp://localhost:4840/freeopcua/server/ with yours. For Python, use
"command": "uvx" and "args": ["opcua-mcp-server"] in JSON, or
command = "uvx" and args = ["opcua-mcp-server"] in TOML. For a secure
connection, add the settings from Safety to the same
env block.
Easiest β the bundle. Download opcua-mcp-server-<version>.mcpb from the
latest release,
drag it into Settings β Extensions, and fill in OPC UA endpoint. No
Node, no Python, no JSON.

Or let the server write the config (needs Node or Python):
npm install -g opcua-mcp-server # or: uv tool install opcua-mcp-server
opcua-mcp-server --install claude-desktop --url opc.tcp://localhost:4840/freeopcua/server/ --dry-runIt checks the config with the server's own startup validation and writes absolute
paths, because Claude Desktop does not inherit your shell's PATH. The profile
defaults to read-only; encryption, a pinned server certificate, a control profile,
a policy file and an audit file are all flags, and passwords are never taken as
flags. Check the preview, then repeat the command without --dry-run to write
the configuration and restart Claude Desktop. Every flag and safety rule, editing
claude_desktop_config.json by hand, and fixing a server that fails to start:
docs/install.md.
claude mcp add opcua -e OPCUA_SERVER_URL=opc.tcp://localhost:4840/freeopcua/server/ -- npx -y opcua-mcp-serverAdd --scope project to share it with your team through .mcp.json.
codex mcp add opcua --env OPCUA_SERVER_URL=opc.tcp://localhost:4840/freeopcua/server/ -- npx -y opcua-mcp-serverOr add it to ~/.codex/config.toml:
[mcp_servers.opcua]
command = "npx"
args = ["-y", "opcua-mcp-server"]
env = { OPCUA_SERVER_URL = "opc.tcp://localhost:4840/freeopcua/server/" }Or let the server write that entry, with the same checks as for Claude Desktop:
opcua-mcp-server --install codex --url opc.tcp://localhost:4840/freeopcua/server/ --dry-run.
This installer command requires a permanent package installation first:
npm install -g opcua-mcp-server or uv tool install opcua-mcp-server.
Check the preview and repeat without --dry-run to write it.
Add to ~/.gemini/settings.json, or .gemini/settings.json in a project:
{
"mcpServers": {
"opcua": {
"command": "npx",
"args": ["-y", "opcua-mcp-server"],
"env": { "OPCUA_SERVER_URL": "opc.tcp://localhost:4840/freeopcua/server/" }
}
}
}In the agent panel, open β― β MCP Servers β Manage MCP Servers β View raw
config, add the entry below to mcp_config.json, and restart Antigravity:
{
"mcpServers": {
"opcua": {
"command": "npx",
"args": ["-y", "opcua-mcp-server"],
"env": { "OPCUA_SERVER_URL": "opc.tcp://localhost:4840/freeopcua/server/" }
}
}
}Add to ~/.cursor/mcp.json, or .cursor/mcp.json in a project:
{
"mcpServers": {
"opcua": {
"command": "npx",
"args": ["-y", "opcua-mcp-server"],
"env": { "OPCUA_SERVER_URL": "opc.tcp://localhost:4840/freeopcua/server/" }
}
}
}Add to .vscode/mcp.json β note the top-level key is servers:
{
"servers": {
"opcua": {
"type": "stdio",
"command": "npx",
"args": ["-y", "opcua-mcp-server"],
"env": { "OPCUA_SERVER_URL": "opc.tcp://localhost:4840/freeopcua/server/" }
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"opcua": {
"command": "npx",
"args": ["-y", "opcua-mcp-server"],
"env": { "OPCUA_SERVER_URL": "opc.tcp://localhost:4840/freeopcua/server/" }
}
}
}Most clients accept this mcpServers entry. The server speaks MCP over stdio.
{
"mcpServers": {
"opcua": {
"command": "npx",
"args": ["-y", "opcua-mcp-server"],
"env": { "OPCUA_SERVER_URL": "opc.tcp://localhost:4840/freeopcua/server/" }
}
}
}No Node or Python on the machine? Download a single-file executable from the
latest release
and use its path as the command β see docs/install.md.
Several PLCs? Each entry talks to one endpoint, so add one entry per PLC
(why).
Tools
15 tools, identical on both runtimes and defined once in contract/tools.json. Arguments, results and limits: docs/tools.md.
Access | Offered under | Tools |
read | every profile, including the default |
|
monitor | every profile, including the default |
|
alarm-action |
|
|
control |
|
|
Control and alarm tools also need a verified server (a secured channel and a pinned OPCUA_SERVER_CERT or an OPCUA_SERVER_TRUST_STORE) unless a lab override is set. β Works only on a server that advertises the feature it needs, such as historical access.
Safety and production
By default the agent can only read, but the OPC UA connection isunencrypted and anonymous. That's fine for a simulator or a lab, not for real equipment. Secure the connection before connecting to anything that matters.
1. Secure the connection and pin the server. Add these to your agent's
env block, with paths to your own certificate files
(certificate guide):
OPCUA_SECURITY_POLICY=Basic256Sha256 # implies SignAndEncrypt
OPCUA_CLIENT_CERT=/etc/opcua/client.pem # this client's identity
OPCUA_CLIENT_KEY=/etc/opcua/client_key.pem
OPCUA_SERVER_CERT=/etc/opcua/server.pem # pin the server you meant to reachFor a username and password, set both OPCUA_USERNAME and OPCUA_PASSWORD.
Supply the password through your client's secret storage or environment; the
installer never accepts it as a flag (password handling).
For an X.509 user identity, leave the username and password unset and set both
OPCUA_USER_CERT and OPCUA_USER_KEY. These identify the user and are separate
from OPCUA_CLIENT_CERT and OPCUA_CLIENT_KEY, which secure the channel; X.509
user authentication needs a security policy other than None.
To trust a CA instead of pinning one certificate, set OPCUA_SERVER_TRUST_STORE
with OPCUA_SERVER_APPLICATION_URI (certificate guide).
2. Choose what the agent may do with OPCUA_PROFILE:
Profile | What the agent can do |
| Read, browse, history, subscriptions, events. No writes, no method calls. |
| The above, plus only the nodes and methods you allowlist in |
| Every tool. Only for a tightly scoped OPC UA account. |
3. Keep a record. Set OPCUA_AUDIT_FILE for an append-only log of every
control call: what was asked, whether it was allowed, and what happened.
A wrong setting stops the server at startup with a message naming the variable, rather than failing later against live equipment. This policy adds to OPC UA's own permissions; it doesn't replace them, so scope the OPC UA account to the same nodes and methods. All settings, value limits and policy files: configuration. Threat model: SECURITY.md.
Documentation
Guide | What's inside |
The | |
Every setting, profiles, allowlists, value bounds, secure connections, reconnection | |
Full tool reference, result shapes, request limits, partial results | |
Every tool with real calls and responses against the mock plant | |
What is and is not verified, the audit trail, reporting a vulnerability | |
Generating a client certificate a server will accept | |
Servers tested, and where the Python and Node runtimes differ | |
How it fits together, and why | |
The test suite, MCP Inspector and agent walkthroughs | |
What is next, and what has landed |
Contributing
Contributions are welcome β see CONTRIBUTING.md for the project layout, local development and adding a tool to both runtimes.
New here? The good first issues are small and scoped to one pull request: a setup guide for another MCP client, or a sample application built on the simulated plant. None needs OPC UA hardware.
The most useful thing you can send is a result from a real OPC UA server: open a compatibility report saying which server, which version and which tools worked. Test only on equipment you are authorised to use, and keep writes and method calls to a simulator or lab.
License
MIT β see LICENSE.
Tool inputs and structured results use JSON Schema draft 2020-12 with generated TypeScript/Python types and CI drift checks. See contract generation for the authoring workflow.
Available Tools
11 toolsbrowse_opcua_nodesARead-onlyIdempotent
Explore the OPC UA address space: list a node's children, walk a subtree, resolve a human-readable browse path to a node ID, or search for nodes by name. With the defaults it lists the immediate children of node_id. Raise depth to walk further down, set node_class to 'Variable' to find only readable tags, and include_values to read each one as it is found. browse_path addresses a node by name instead of by ID ('/Objects/Reactor/Temperature'), which is how to start when you do not know the numeric IDs; with depth 0 it simply resolves that path and returns the node it names. name_filter keeps only nodes whose browse name contains the text. Every node also reports its type_definition β what it is, as against what class it belongs to: 'AnalogItemType' for a tag that publishes a unit and a range, a subtype of 'AlarmConditionType' for something act_on_alarm applies to, 'FolderType' for structure. Every traversal is bounded by max_nodes and says in truncated whether it stopped early, so a short list is never mistaken for a complete one.
Inputs: depth, node_id, max_nodes, node_class, +3 more. Returns: result, completeness
get_server_statusARead-onlyIdempotent
Report whether this MCP server is connected to the OPC UA server and what that server says about itself: its endpoint and connection security, its ServerStatus (state, current time, start time, build info) and its NamespaceArray as index -> URI. The one tool that answers while the connection is down β it reports 'connected': false and why, rather than failing β so it is both the health check and the first thing to call when another tool cannot reach the server. The namespace array is also how to tell which 'ns=' index belongs to which namespace URI on this server. 'diagnostics' is the server's own ServerDiagnosticsSummary when it publishes one β session and subscription counts, and how many sessions and requests it has rejected β which is what separates 'the server is slow' from 'the server is refusing us'. OPC UA leaves diagnostics optional, so null there means this server does not say, not zero. 'capabilities' says which optional features β value history, event history, aggregates and their names β the server was found to offer, on which session and when: the answer to why read_opcua_history or read_event_history was refused.
Inputs: no named parameters. Returns: result
list_active_alarmsARead-onlyIdempotent
List the alarm and condition instances the server is currently retaining β those that are active, unacknowledged, or both. Asks the server for them directly (the ConditionRefresh method), so the answer is the current state of the plant rather than whatever this MCP server happened to be listening for. Use this to answer 'what is wrong right now'; use read_events to see what has happened since you last looked.
Inputs: node_id, timeout_seconds. Returns: result
list_subscriptionsARead-onlyIdempotent
List the active OPC UA data-change subscriptions, each with the value changes buffered for it since it was created. This is how to collect what subscribe_opcua_nodes has been watching; the same document is also readable as the 'opcua://subscriptions' resource.
Inputs: no named parameters. Returns: result, completeness
read_event_historyARead-onlyIdempotent
Read events the OPC UA server stored, for a time range that has already passed. subscribe_events only sees what arrives after you subscribe, so it cannot answer 'what happened overnight' or 'what fired in the ten minutes before the line stopped' β the events are gone by the time anyone asks. This reads them back out of the server's own event archive instead. Same records as read_events and the same fields, so an alarm looks identical whether it was watched live or recovered afterwards. Needs a server that reports AccessHistoryEventsCapability β storing values and storing events are separate features and many servers do one without the other β and against one that does not, a call is refused with capability_not_supported and what to use instead. Point node_id at the notifier that emits the events β the Server object by default, which is where events are collected on most servers. The structured result's completeness says whether the range held more events than came back.
Inputs: node_id, end_time, num_values, start_time, +1 more. Returns: result, completeness
read_eventsA
Read the events buffered by subscribe_events, oldest first. The events returned are removed from the buffer, so a second call returns only what has arrived since. If the buffer overflowed in the meantime, the result says how many were dropped rather than quietly skipping them β in the structured result's completeness, which also says whether more are still buffered.
Inputs: limit, node_id. Returns: result, completeness
read_opcua_historyARead-onlyIdempotent
Read what a node's value has been over time. Without aggregate_function this returns the raw stored readings, with ReturnBounds=false: no preceding/following boundary values or BadBoundNotFound placeholders. With it, the server computes one summary value per processing_interval over the range instead β 'Average' for a trend, 'Maximum'/'Minimum' for excursions, 'Count' for how often something was recorded β which is how to ask about a week of data without transferring a week of data. Needs a server that keeps history (AccessHistoryDataCapability) or offers aggregates, and aggregate_function needs the aggregates; a call the connected server cannot serve is refused with capability_not_supported and a suggestion, before anything is sent. get_server_status reports which of the two the server offers, and its aggregate function names. Aggregate reads follow native continuation points within the same call, preserving the original interval anchor; they return the completed range or an explicit error within the 5000-value bound. The structured result's completeness says whether the range held more than came back and how to continue; never infer that from the number of records.
Inputs: node_id (required), end_time, num_values, start_time, +2 more. Returns: result, completeness
read_opcua_nodesARead-onlyIdempotent
Read the current value of one or more OPC UA nodes in a single request. Pass every node you need in one call: the OPC UA server answers them together, so reading fifty nodes costs one round trip rather than fifty. Each node comes back as its own record with the value, its data type, the OPC UA status code, and the source and server timestamps β the quality and the age are what decide whether a value can be acted on, and a bare number carries neither. A node the server rejects is one 'Badβ¦' status among the results, not a failure of the call.
Inputs: node_ids (required), include_write_access. Returns: result
subscribe_eventsA
Start buffering OPC UA events (alarms, condition changes, plain events) from a notifier node. Returns at once; the events themselves are collected in the background and read with read_events. Calling it again for the same node replaces the subscription and discards what it had buffered. Use this to watch for things happening; use list_active_alarms for what is wrong right now.
Inputs: node_id, buffer_size, severity_min. Returns: result
subscribe_opcua_nodesA
Watch one or more OPC UA nodes for value changes instead of polling them. The OPC UA server pushes each new value into a buffer this MCP server keeps; collect them with list_subscriptions or the 'opcua://subscriptions' resource. This is the right way to answer 'tell me when this changes' or 'what has this been doing' over a short window β repeatedly calling read_opcua_nodes both misses changes between calls and costs a round trip each time. Each node gets its own subscription record and its own ID; cancel them with unsubscribe_opcua_nodes. Subscriptions are re-established automatically if the connection drops.
Inputs: node_ids (required), buffer_size, deadband_type, deadband_value, +3 more. Returns: result, completeness
unsubscribe_opcua_nodesA
Cancel one or more active data-change subscriptions and discard what they had buffered. Returns the subscriptions as they were at the moment they were cancelled, so anything still buffered can be read one last time. An ID that is not active is an error naming it, and no subscription is cancelled.
Inputs: subscription_ids (required). Returns: result, completeness
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 11 tools
Most tools target clearly different operations: browsing vs current reads vs history vs live data-change subscriptions vs live events vs alarm listing. The closest pairs are read_events/read_event_history and subscribe_events/subscribe_opcua_nodes, whose names are similar but whose descriptions clearly separate live buffering from archived retrieval and event streams from data-change streams. Slight ambiguity remains from those parallel names, but the descriptions prevent likely misselection.
All names follow a snake_case verb_noun pattern, which is readable and predictable. The main inconsistency is the optional 'opcua' qualifier: read_opcua_nodes, browse_opcua_nodes, read_opcua_history, subscribe_opcua_nodes, and unsubscribe_opcua_nodes use it, while read_event_history, subscribe_events, read_events, list_subscriptions, and list_active_alarms do not. This is a minor deviation rather than a chaotic naming scheme.
At 11 tools, the set is well within a reasonable range for an OPC UA monitoring and browsing server. Each tool covers a distinct capability: status, browse, current read, historical read, data-change subscription lifecycle, event subscription/read, event history, active alarms, and subscription listing. No tool appears redundant or purely filler.
The read/monitoring surface is fairly complete: browse, current values, historical values, live data changes, event buffering, event history, alarms, and server capability discovery are all present. However, core OPC UA write operations such as writing node values or calling methods are absent, and alarm acknowledgement is not exposed even though alarm listing is. There is also a reference to an 'act_on_alarm' tool in the browse description that is not present in the tool set, indicating a notable surface gap.
Maintenance
Related MCP Connectors
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects AI agents to OPC UA-enabled industrial systems for real-time monitoring and control of operational data. It enables users to read, write, and browse industrial device nodes through natural language interactions.MIT
- AlicenseBqualityBmaintenanceProvides AI agents with safe, governed read access to industrial control systems (OPC-UA, Modbus, S7, Mitsubishi, MTConnect, MQTT/Sparkplug) plus cross-protocol diagnostics for troubleshooting data breaks, alarm floods, and unhealthy tags.15713MIT
- AlicenseNot gradedqualityBmaintenanceEnables LLMs to read, write, browse, search, and subscribe to live data on OPC-UA industrial automation servers, with caching, discovery index, and support for stdio or HTTP transports.7MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to discover, browse, read, search, and safely write OPC UA industrial device data within controlled edge networks, with guarded two-phase writes and evidence-based root-cause diagnostics.1Apache 2.0