OPC-UA MCP Server — Claude Code MCP server for OPC-UA data
Lets an agent read, write and subscribe to live values on an OPC-UA industrial automation server. Handy when you want tag data without leaving the chat.
claude mcp add --env OPCUA_ENDPOINT=<OPCUA_ENDPOINT> --env OPCUA_AUTH_MODE=<OPCUA_AUTH_MODE> --env OPCUA_USERNAME=<OPCUA_USERNAME> --env OPCUA_PASSWORD=<OPCUA_PASSWORD> --env OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> --transport stdio opc-ua-mcp-server -- docker run -i --rm -e OPCUA_ENDPOINT -e OPCUA_AUTH_MODE -e OPCUA_USERNAME -e OPCUA_PASSWORD -e OPCUA_SECURITY_POLICY ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4What OPC-UA MCP Server does
The server runs over stdio or HTTP and talks to an OPC-UA endpoint. Reads, browse results and type info land in an on-disk bbolt cache, so looking up the same node twice does not hit the device again; a write clears the matching cache entry. A background pass indexes the address space with Bleve, which is how you look nodes up by browse name or match a partial one instead of hunting for a node ID.
The tool list is long. opcua_read and opcua_write handle values, and a write checks the type against the node before anything reaches the device. opcua_browse lists immediate children, opcua_browse_nodes walks deeper with a depth limit. opcua_subscribe turns on push updates for chosen nodes; subscriptions survive a restart and come back after a reconnect. There is also opcua_get_value_by_name, opcua_node_info, opcua_list_subscriptions and diagnostics such as opcua_debug_search. Resources are opcua://node/{node_id} and opcua://server.
Auth can be anonymous, username/password or certificate, with the security policy and mode set to match your server. Config comes from built-in defaults, an optional file (TOML, YAML, JSON) and environment variables, and the env vars always win. Username auth needs OPCUA_USERNAME and OPCUA_PASSWORD; certificate auth needs OPCUA_CERT_FILE and OPCUA_KEY_FILE. Building from source takes Go 1.26+.
What it helps with
- read a tag value by name when the node ID is unknown
- write a setpoint and reject a value of the wrong type
- subscribe to a node and get changes without polling
- walk the address space tree to a set depth
- find a node by a partial browse name
Example prompts for the agent
- Connect to the OPC-UA server and show me what is under the root
- Read node
ns=2;i=1and tell me its data type - Subscribe to that node and push updates every 500 ms
How to install OPC-UA MCP Server
Platform CLI
claude mcp add --env OPCUA_ENDPOINT=<OPCUA_ENDPOINT> --env OPCUA_AUTH_MODE=<OPCUA_AUTH_MODE> --env OPCUA_USERNAME=<OPCUA_USERNAME> --env OPCUA_PASSWORD=<OPCUA_PASSWORD> --env OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> --transport stdio opc-ua-mcp-server -- docker run -i --rm -e OPCUA_ENDPOINT -e OPCUA_AUTH_MODE -e OPCUA_USERNAME -e OPCUA_PASSWORD -e OPCUA_SECURITY_POLICY ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4Replace <…> with your own values. 2 more environment variables are in the server README
Platform CLI
codex mcp add opc-ua-mcp-server --env OPCUA_ENDPOINT=<OPCUA_ENDPOINT> --env OPCUA_AUTH_MODE=<OPCUA_AUTH_MODE> --env OPCUA_USERNAME=<OPCUA_USERNAME> --env OPCUA_PASSWORD=<OPCUA_PASSWORD> --env OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> -- docker run -i --rm -e OPCUA_ENDPOINT -e OPCUA_AUTH_MODE -e OPCUA_USERNAME -e OPCUA_PASSWORD -e OPCUA_SECURITY_POLICY ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4Replace <…> with your own values. 2 more environment variables are in the server README
Config file
{
"mcpServers": {
"opc-ua-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"OPCUA_ENDPOINT",
"-e",
"OPCUA_AUTH_MODE",
"-e",
"OPCUA_USERNAME",
"-e",
"OPCUA_PASSWORD",
"-e",
"OPCUA_SECURITY_POLICY",
"ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4"
],
"env": {
"OPCUA_ENDPOINT": "<OPCUA_ENDPOINT>",
"OPCUA_AUTH_MODE": "<OPCUA_AUTH_MODE>",
"OPCUA_USERNAME": "<OPCUA_USERNAME>",
"OPCUA_PASSWORD": "<OPCUA_PASSWORD>",
"OPCUA_SECURITY_POLICY": "<OPCUA_SECURITY_POLICY>"
}
}
}
}Replace <…> with your own values. 2 more environment variables are in the server README
Config file
{
"servers": {
"opc-ua-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"OPCUA_ENDPOINT",
"-e",
"OPCUA_AUTH_MODE",
"-e",
"OPCUA_USERNAME",
"-e",
"OPCUA_PASSWORD",
"-e",
"OPCUA_SECURITY_POLICY",
"ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4"
],
"env": {
"OPCUA_ENDPOINT": "<OPCUA_ENDPOINT>",
"OPCUA_AUTH_MODE": "<OPCUA_AUTH_MODE>",
"OPCUA_USERNAME": "<OPCUA_USERNAME>",
"OPCUA_PASSWORD": "<OPCUA_PASSWORD>",
"OPCUA_SECURITY_POLICY": "<OPCUA_SECURITY_POLICY>"
}
}
}
}Replace <…> with your own values. 2 more environment variables are in the server README
Platform CLI
gemini mcp add -e OPCUA_ENDPOINT=<OPCUA_ENDPOINT> -e OPCUA_AUTH_MODE=<OPCUA_AUTH_MODE> -e OPCUA_USERNAME=<OPCUA_USERNAME> -e OPCUA_PASSWORD=<OPCUA_PASSWORD> -e OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> opc-ua-mcp-server docker run -i --rm -e OPCUA_ENDPOINT -e OPCUA_AUTH_MODE -e OPCUA_USERNAME -e OPCUA_PASSWORD -e OPCUA_SECURITY_POLICY ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4Replace <…> with your own values. 2 more environment variables are in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about OPC-UA MCP Server
How do I install OPC-UA MCP Server in Claude Code?
Run `claude mcp add --env OPCUA_ENDPOINT=<OPCUA_ENDPOINT> --env OPCUA_AUTH_MODE=<OPCUA_AUTH_MODE> --env OPCUA_USERNAME=<OPCUA_USERNAME> --env OPCUA_PASSWORD=<OPCUA_PASSWORD> --env OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> --transport stdio opc-ua-mcp-server -- docker run -i --rm -e OPCUA_ENDPOINT -e OPCUA_AUTH_MODE -e OPCUA_USERNAME -e OPCUA_PASSWORD -e OPCUA_SECURITY_POLICY ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4`. Fill in your own endpoint and credentials.
What does OPC-UA MCP Server do?
It gives an agent access to an OPC-UA server: reading and writing node values, browsing the address space, searching by name and subscribing to live updates. Reads and browse results are cached on disk.
What does the server need to run?
An endpoint in OPCUA_ENDPOINT and an auth mode in OPCUA_AUTH_MODE. Username auth also needs OPCUA_USERNAME and OPCUA_PASSWORD; certificate auth needs OPCUA_CERT_FILE and OPCUA_KEY_FILE. Building from source requires Go 1.26+.