NestDaddy

OPC UA MCP Server

io.github.midhunxavier/opcua · v0.6.0

Connect AI assistants to industrial OPC UA: browse, read, history, subscriptions, events and alarms.

Connect Runs on your machine

Terminal
claude mcp add opcua -e OPCUA_SERVER_URL=<OPCUA_SERVER_URL> -e OPCUA_PYTHON_BACKEND=<OPCUA_PYTHON_BACKEND> -e OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> -e OPCUA_SECURITY_MODE=<OPCUA_SECURITY_MODE> -e OPCUA_CLIENT_CERT=<OPCUA_CLIENT_CERT> -e OPCUA_CLIENT_KEY=<OPCUA_CLIENT_KEY> -e OPCUA_APPLICATION_URI=<OPCUA_APPLICATION_URI> -e OPCUA_SERVER_CERT=<OPCUA_SERVER_CERT> -e OPCUA_SERVER_TRUST_STORE=<OPCUA_SERVER_TRUST_STORE> -e OPCUA_SERVER_APPLICATION_URI=<OPCUA_SERVER_APPLICATION_URI> -e OPCUA_USERNAME=<OPCUA_USERNAME> -e OPCUA_PASSWORD=<OPCUA_PASSWORD> -e OPCUA_USER_CERT=<OPCUA_USER_CERT> -e OPCUA_USER_KEY=<OPCUA_USER_KEY> -e OPCUA_PROFILE=<OPCUA_PROFILE> -e OPCUA_POLICY_FILE=<OPCUA_POLICY_FILE> -e OPCUA_ALLOWED_TOOLS=<OPCUA_ALLOWED_TOOLS> -e OPCUA_ALLOWED_WRITE_NODES=<OPCUA_ALLOWED_WRITE_NODES> -e OPCUA_ALLOWED_METHODS=<OPCUA_ALLOWED_METHODS> -e OPCUA_ALLOW_ACKNOWLEDGE_ALARMS=<OPCUA_ALLOW_ACKNOWLEDGE_ALARMS> -e OPCUA_ALLOW_INSECURE_CONTROL=<OPCUA_ALLOW_INSECURE_CONTROL> -e OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL=<OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL> -e OPCUA_ALLOW_OUT_OF_RANGE_WRITES=<OPCUA_ALLOW_OUT_OF_RANGE_WRITES> -e OPCUA_AUDIT_FILE=<OPCUA_AUDIT_FILE> -e OPCUA_AUDIT_FSYNC=<OPCUA_AUDIT_FSYNC> -e OPCUA_AUDIT_CHAIN=<OPCUA_AUDIT_CHAIN> -e OPCUA_AUDIT_CHAIN_KEY_FILE=<OPCUA_AUDIT_CHAIN_KEY_FILE> -e OPCUA_OPERATOR_ID=<OPCUA_OPERATOR_ID> -e OPCUA_RECONNECT_INITIAL_DELAY_MS=<OPCUA_RECONNECT_INITIAL_DELAY_MS> -e OPCUA_RECONNECT_MAX_DELAY_MS=<OPCUA_RECONNECT_MAX_DELAY_MS> -e OPCUA_RECONNECT_MAX_RETRY=<OPCUA_RECONNECT_MAX_RETRY> -e OPCUA_SESSION_TIMEOUT_MS=<OPCUA_SESSION_TIMEOUT_MS> -- npx -y [email protected]
claude_desktop_config.json
{
  "mcpServers": {
    "opcua": {
      "command": "npx",
      "args": [
        "-y",
        "[email protected]"
      ],
      "env": {
        "OPCUA_SERVER_URL": "<OPCUA_SERVER_URL>",
        "OPCUA_PYTHON_BACKEND": "<OPCUA_PYTHON_BACKEND>",
        "OPCUA_SECURITY_POLICY": "<OPCUA_SECURITY_POLICY>",
        "OPCUA_SECURITY_MODE": "<OPCUA_SECURITY_MODE>",
        "OPCUA_CLIENT_CERT": "<OPCUA_CLIENT_CERT>",
        "OPCUA_CLIENT_KEY": "<OPCUA_CLIENT_KEY>",
        "OPCUA_APPLICATION_URI": "<OPCUA_APPLICATION_URI>",
        "OPCUA_SERVER_CERT": "<OPCUA_SERVER_CERT>",
        "OPCUA_SERVER_TRUST_STORE": "<OPCUA_SERVER_TRUST_STORE>",
        "OPCUA_SERVER_APPLICATION_URI": "<OPCUA_SERVER_APPLICATION_URI>",
        "OPCUA_USERNAME": "<OPCUA_USERNAME>",
        "OPCUA_PASSWORD": "<OPCUA_PASSWORD>",
        "OPCUA_USER_CERT": "<OPCUA_USER_CERT>",
        "OPCUA_USER_KEY": "<OPCUA_USER_KEY>",
        "OPCUA_PROFILE": "<OPCUA_PROFILE>",
        "OPCUA_POLICY_FILE": "<OPCUA_POLICY_FILE>",
        "OPCUA_ALLOWED_TOOLS": "<OPCUA_ALLOWED_TOOLS>",
        "OPCUA_ALLOWED_WRITE_NODES": "<OPCUA_ALLOWED_WRITE_NODES>",
        "OPCUA_ALLOWED_METHODS": "<OPCUA_ALLOWED_METHODS>",
        "OPCUA_ALLOW_ACKNOWLEDGE_ALARMS": "<OPCUA_ALLOW_ACKNOWLEDGE_ALARMS>",
        "OPCUA_ALLOW_INSECURE_CONTROL": "<OPCUA_ALLOW_INSECURE_CONTROL>",
        "OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL": "<OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL>",
        "OPCUA_ALLOW_OUT_OF_RANGE_WRITES": "<OPCUA_ALLOW_OUT_OF_RANGE_WRITES>",
        "OPCUA_AUDIT_FILE": "<OPCUA_AUDIT_FILE>",
        "OPCUA_AUDIT_FSYNC": "<OPCUA_AUDIT_FSYNC>",
        "OPCUA_AUDIT_CHAIN": "<OPCUA_AUDIT_CHAIN>",
        "OPCUA_AUDIT_CHAIN_KEY_FILE": "<OPCUA_AUDIT_CHAIN_KEY_FILE>",
        "OPCUA_OPERATOR_ID": "<OPCUA_OPERATOR_ID>",
        "OPCUA_RECONNECT_INITIAL_DELAY_MS": "<OPCUA_RECONNECT_INITIAL_DELAY_MS>",
        "OPCUA_RECONNECT_MAX_DELAY_MS": "<OPCUA_RECONNECT_MAX_DELAY_MS>",
        "OPCUA_RECONNECT_MAX_RETRY": "<OPCUA_RECONNECT_MAX_RETRY>",
        "OPCUA_SESSION_TIMEOUT_MS": "<OPCUA_SESSION_TIMEOUT_MS>"
      }
    }
  }
}
~/.cursor/mcp.json
{
  "mcpServers": {
    "opcua": {
      "command": "npx",
      "args": [
        "-y",
        "[email protected]"
      ],
      "env": {
        "OPCUA_SERVER_URL": "<OPCUA_SERVER_URL>",
        "OPCUA_PYTHON_BACKEND": "<OPCUA_PYTHON_BACKEND>",
        "OPCUA_SECURITY_POLICY": "<OPCUA_SECURITY_POLICY>",
        "OPCUA_SECURITY_MODE": "<OPCUA_SECURITY_MODE>",
        "OPCUA_CLIENT_CERT": "<OPCUA_CLIENT_CERT>",
        "OPCUA_CLIENT_KEY": "<OPCUA_CLIENT_KEY>",
        "OPCUA_APPLICATION_URI": "<OPCUA_APPLICATION_URI>",
        "OPCUA_SERVER_CERT": "<OPCUA_SERVER_CERT>",
        "OPCUA_SERVER_TRUST_STORE": "<OPCUA_SERVER_TRUST_STORE>",
        "OPCUA_SERVER_APPLICATION_URI": "<OPCUA_SERVER_APPLICATION_URI>",
        "OPCUA_USERNAME": "<OPCUA_USERNAME>",
        "OPCUA_PASSWORD": "<OPCUA_PASSWORD>",
        "OPCUA_USER_CERT": "<OPCUA_USER_CERT>",
        "OPCUA_USER_KEY": "<OPCUA_USER_KEY>",
        "OPCUA_PROFILE": "<OPCUA_PROFILE>",
        "OPCUA_POLICY_FILE": "<OPCUA_POLICY_FILE>",
        "OPCUA_ALLOWED_TOOLS": "<OPCUA_ALLOWED_TOOLS>",
        "OPCUA_ALLOWED_WRITE_NODES": "<OPCUA_ALLOWED_WRITE_NODES>",
        "OPCUA_ALLOWED_METHODS": "<OPCUA_ALLOWED_METHODS>",
        "OPCUA_ALLOW_ACKNOWLEDGE_ALARMS": "<OPCUA_ALLOW_ACKNOWLEDGE_ALARMS>",
        "OPCUA_ALLOW_INSECURE_CONTROL": "<OPCUA_ALLOW_INSECURE_CONTROL>",
        "OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL": "<OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL>",
        "OPCUA_ALLOW_OUT_OF_RANGE_WRITES": "<OPCUA_ALLOW_OUT_OF_RANGE_WRITES>",
        "OPCUA_AUDIT_FILE": "<OPCUA_AUDIT_FILE>",
        "OPCUA_AUDIT_FSYNC": "<OPCUA_AUDIT_FSYNC>",
        "OPCUA_AUDIT_CHAIN": "<OPCUA_AUDIT_CHAIN>",
        "OPCUA_AUDIT_CHAIN_KEY_FILE": "<OPCUA_AUDIT_CHAIN_KEY_FILE>",
        "OPCUA_OPERATOR_ID": "<OPCUA_OPERATOR_ID>",
        "OPCUA_RECONNECT_INITIAL_DELAY_MS": "<OPCUA_RECONNECT_INITIAL_DELAY_MS>",
        "OPCUA_RECONNECT_MAX_DELAY_MS": "<OPCUA_RECONNECT_MAX_DELAY_MS>",
        "OPCUA_RECONNECT_MAX_RETRY": "<OPCUA_RECONNECT_MAX_RETRY>",
        "OPCUA_SESSION_TIMEOUT_MS": "<OPCUA_SESSION_TIMEOUT_MS>"
      }
    }
  }
}
.vscode/mcp.json
{
  "servers": {
    "opcua": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "[email protected]"
      ],
      "env": {
        "OPCUA_SERVER_URL": "<OPCUA_SERVER_URL>",
        "OPCUA_PYTHON_BACKEND": "<OPCUA_PYTHON_BACKEND>",
        "OPCUA_SECURITY_POLICY": "<OPCUA_SECURITY_POLICY>",
        "OPCUA_SECURITY_MODE": "<OPCUA_SECURITY_MODE>",
        "OPCUA_CLIENT_CERT": "<OPCUA_CLIENT_CERT>",
        "OPCUA_CLIENT_KEY": "<OPCUA_CLIENT_KEY>",
        "OPCUA_APPLICATION_URI": "<OPCUA_APPLICATION_URI>",
        "OPCUA_SERVER_CERT": "<OPCUA_SERVER_CERT>",
        "OPCUA_SERVER_TRUST_STORE": "<OPCUA_SERVER_TRUST_STORE>",
        "OPCUA_SERVER_APPLICATION_URI": "<OPCUA_SERVER_APPLICATION_URI>",
        "OPCUA_USERNAME": "<OPCUA_USERNAME>",
        "OPCUA_PASSWORD": "<OPCUA_PASSWORD>",
        "OPCUA_USER_CERT": "<OPCUA_USER_CERT>",
        "OPCUA_USER_KEY": "<OPCUA_USER_KEY>",
        "OPCUA_PROFILE": "<OPCUA_PROFILE>",
        "OPCUA_POLICY_FILE": "<OPCUA_POLICY_FILE>",
        "OPCUA_ALLOWED_TOOLS": "<OPCUA_ALLOWED_TOOLS>",
        "OPCUA_ALLOWED_WRITE_NODES": "<OPCUA_ALLOWED_WRITE_NODES>",
        "OPCUA_ALLOWED_METHODS": "<OPCUA_ALLOWED_METHODS>",
        "OPCUA_ALLOW_ACKNOWLEDGE_ALARMS": "<OPCUA_ALLOW_ACKNOWLEDGE_ALARMS>",
        "OPCUA_ALLOW_INSECURE_CONTROL": "<OPCUA_ALLOW_INSECURE_CONTROL>",
        "OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL": "<OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL>",
        "OPCUA_ALLOW_OUT_OF_RANGE_WRITES": "<OPCUA_ALLOW_OUT_OF_RANGE_WRITES>",
        "OPCUA_AUDIT_FILE": "<OPCUA_AUDIT_FILE>",
        "OPCUA_AUDIT_FSYNC": "<OPCUA_AUDIT_FSYNC>",
        "OPCUA_AUDIT_CHAIN": "<OPCUA_AUDIT_CHAIN>",
        "OPCUA_AUDIT_CHAIN_KEY_FILE": "<OPCUA_AUDIT_CHAIN_KEY_FILE>",
        "OPCUA_OPERATOR_ID": "<OPCUA_OPERATOR_ID>",
        "OPCUA_RECONNECT_INITIAL_DELAY_MS": "<OPCUA_RECONNECT_INITIAL_DELAY_MS>",
        "OPCUA_RECONNECT_MAX_DELAY_MS": "<OPCUA_RECONNECT_MAX_DELAY_MS>",
        "OPCUA_RECONNECT_MAX_RETRY": "<OPCUA_RECONNECT_MAX_RETRY>",
        "OPCUA_SESSION_TIMEOUT_MS": "<OPCUA_SESSION_TIMEOUT_MS>"
      }
    }
  }
}

Replace the values in angle brackets with your own. Keys stay on your machine; we never see them.

Tools

This server runs locally, so its tools are listed by your MCP client once it starts.

Environment variables

NameDescription
OPCUA_SERVER_URL
Required
URL of the OPC UA server to connect to, including any path the server expects. Read once at startup: one process serves one endpoint. Verify who answers with an exact server certificate pin or a configured CA trust store.
OPCUA_PYTHON_BACKEND
Optional
Select the Python client implementation. The maintained asyncua client is the default; legacy provides the one-release rollback path for uncovered vendor incompatibilities. This setting affects the Python server only.
OPCUA_SECURITY_POLICY
Optional
Encryption suite to negotiate for the secure channel. Anything other than None needs a client certificate and key. The two AES suites are Node-only: the Python runtime refuses them at startup rather than downgrading. None is unencrypted and unauthenticated, and keeps control tools blocked unless in…
OPCUA_SECURITY_MODE
Optional
Message security mode for the secure channel. Sign authenticates messages without encrypting them. A policy with mode None, or a mode without a policy, stops the server at startup; leaving it blank never downgrades a policy to signing only. Leave blank for SignAndEncrypt once a security policy is s…
OPCUA_CLIENT_CERT
Optional
Path to the certificate (PEM or DER) this client presents as its application identity. Required by any security policy other than None. A path that does not exist stops the server at startup.
OPCUA_CLIENT_KEY
Optional, secret
Path to the private key matching the client certificate. A path, never key material. Whoever can read the file can impersonate this client: keep it readable only by the account running the server. A path that does not exist stops the server at startup.
OPCUA_APPLICATION_URI
Optional
Application URI announced to the server. Set it only for a certificate that carries no URI of its own. A configured URI that conflicts with the certificate is refused before connecting. Leave blank for the subjectAltName URI of the client certificate.
OPCUA_SERVER_CERT
Optional
Path to the OPC UA server's own certificate (PEM or DER), pinned: a server presenting any other certificate cannot complete the handshake. Control tools (writes, method calls, alarm actions) require it, or OPCUA_SERVER_TRUST_STORE instead. Requires a security policy other than None. Unset, encrypti…
OPCUA_SERVER_TRUST_STORE
Optional
Directory with trusted/certs root CAs, issuers/certs intermediate CAs, and trusted/crl plus issuers/crl signed current revocation lists. Authenticate the OPC UA peer by its validated chain and expected server URI. Requires secured channel and OPCUA_SERVER_APPLICATION_URI; Python requires the mainta…
OPCUA_SERVER_APPLICATION_URI
Optional
ApplicationUri of the intended OPC UA server. Must match the peer certificate URI SAN and advertised application identity. Required with OPCUA_SERVER_TRUST_STORE.
OPCUA_USERNAME
Optional
OPC UA username. The session is anonymous when unset. Cannot be combined with a user certificate. Requires a password; either one alone stops the server at startup.
OPCUA_PASSWORD
Optional, secret
Password for the username. Without a security policy it crosses the network in clear text. Supply it through the client's secret storage, never on a command line.
OPCUA_USER_CERT
Optional
Path to the certificate identifying the user, for X.509 user authentication: a different key pair from the client certificate, which secures the channel. Requires the user key and a security policy other than None; cannot be combined with a username. Any of those combinations broken stops the serve…
OPCUA_USER_KEY
Optional, secret
Path to the private key for the user certificate. It signs the server's challenge and is never sent. Whoever can read the file can log in as this user: keep it readable only by the account running the server.
OPCUA_PROFILE
Required
Which tools are offered. observe reads, browses, reads history and monitors; operator adds explicitly allowlisted writes, method calls and alarm actions; full exposes every tool and is meant only for a tightly scoped OPC UA account. Unset fails closed to observe; an unknown profile stops the server…
OPCUA_POLICY_FILE
Optional
Path to a version-1 JSON policy file, the only place per-node value bounds, writable_subtrees, preconditions, the alarm scope and deny_read can be set. Every policy variable that is set overrides what the file says. An unreadable or invalid file stops the server at startup.
OPCUA_ALLOWED_TOOLS
Optional
Comma-separated tool allowlist. It can only narrow the selected profile, never widen it. An unknown tool name stops the server at startup.
OPCUA_ALLOWED_WRITE_NODES
Optional
Comma-separated exact node IDs the operator profile may write, as ns=2;i=5 or, stable across a server restart, nsu=<namespace-uri>;i=5 or a browse path from the Root folder such as /Objects/Line1/Setpoint. Setting it replaces the policy file's list, bounds included. Empty fails closed: operator can…
OPCUA_ALLOWED_METHODS
Optional
Comma-separated object_node_id|method_node_id pairs the operator profile may call. Either half may be a browse path from the Root folder. Empty fails closed: operator can call nothing. An entry without | stops the server at startup.
OPCUA_ALLOW_ACKNOWLEDGE_ALARMS
Optional
Let the operator profile act on alarms: acknowledge_alarm and every act_on_alarm action.
OPCUA_ALLOW_INSECURE_CONTROL
Optional
Permit control tools on an OPC UA channel with no security policy (None). Does not cover a secured channel to an unverified server; that is OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL. Fail-open override: writes, method calls and alarm actions then travel unauthenticated and unencrypted. Reported as cont…
OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL
Optional
Permit control tools on a secured OPC UA channel whose server is not authenticated: neither pinned with OPCUA_SERVER_CERT nor validated by OPCUA_SERVER_TRUST_STORE. Does not cover a channel with no security policy; that is OPCUA_ALLOW_INSECURE_CONTROL. Fail-open override: writes, method calls and a…
OPCUA_ALLOW_OUT_OF_RANGE_WRITES
Optional
Allow a write outside the EURange the OPC UA server itself published for the node. A published InstrumentRange still applies. Fail-open override: it discards the only value bound a deployment with no policy file has.
OPCUA_AUDIT_FILE
Optional
Path to an append-only file for the control audit trail, one JSON object per line, written beside stderr. Created owner-only (0600) if it does not exist; reopened when rotated away. A file that cannot be opened, or that is a symlink, not a regular file, another account's, or group/world-writable, s…
OPCUA_AUDIT_FSYNC
Optional
When an audit-file record counts as written. always fsyncs each record before the control call proceeds, so it survives a power loss; none leaves it to the operating system, so it survives only a crash of this process. none can lose the records of control calls that already reached the plant if the…
OPCUA_AUDIT_CHAIN
Optional
Adds seq, prev_hash and hash to every audit record so edits, deletions and reordering can be detected with --verify-audit. sha256 catches accidental or naive edits; hmac-sha256 also resists anyone without the key. Requires the audit file. Set without an audit file, or hmac-sha256 without a key file…
OPCUA_AUDIT_CHAIN_KEY_FILE
Optional, secret
Path to the HMAC key for the hmac-sha256 audit chain: at least 32 bytes, for example from openssl rand -hex 32. Surrounding whitespace is ignored. Whoever can read the key can forge the chain: a key readable or writable by group or others stops the server. Refused unless the chain is hmac-sha256.
OPCUA_OPERATOR_ID
Optional
Label stamped on every audit record as operator_label, so a shipped log says which deployment a control call came from. Configured, never verified: it is not an identity, and mcp_principal stays null.
OPCUA_RECONNECT_INITIAL_DELAY_MS
Optional
Wait before the first attempt to repair a dropped or refused connection, in milliseconds. It doubles with each further attempt.
OPCUA_RECONNECT_MAX_DELAY_MS
Optional
Ceiling for the doubling retry delay, in milliseconds.
OPCUA_RECONNECT_MAX_RETRY
Optional
Retries after the first attempt, per connection round, before a tool call gives up: a whole number from -1 to 1000. 0 never retries; -1 never stops trying, in bounded rounds of four retries so no single call waits forever.
OPCUA_SESSION_TIMEOUT_MS
Optional
Session lifetime asked of the OPC UA server, in milliseconds. It also sets the keep-alive period, so it decides how quickly an idle connection notices the server has gone.

Details

Package[email protected] (NPM, stdio)
First published5 Nov 2026
Last updated5 Nov 2026
Registry nameio.github.midhunxavier/opcua

More other servers See all

Listing data from the official MCP registry. Status and tools from NestDaddy's daily check. Browse all MCP servers.