# OPC UA MCP Server

This MCP server for Claude Code connects an AI agent to an OPC UA server. It exposes equipment nodes, live values and historical readings to the agent.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 36 repo stars
- Author: IndustriAgents
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/IndustriAgents/OPCUA-MCP
- Updated: 2026-11-15
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/industriagents-opc-ua-mcp-server

## What it does

The server relays agent requests to an OPC UA system and returns its data. Its tools cover node browsing, value and history reads, change subscriptions, events and alarms; writing values and calling methods are also supported.

The `observe` profile is read-only by default. Control actions require a separate profile and an authenticated OPC UA server, and each such call is audited. A process handles one OPC UA endpoint, so separate endpoints need separate processes.

The Node route requires Node.js 22.13+ with npm/npx. The Python route needs Python 3.10+ and `uv`. An accessible OPC UA server and its address in `OPCUA_SERVER_URL` are also required.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `OPCUA_SERVER_URL`, `OPCUA_PYTHON_BACKEND`, `OPCUA_SECURITY_POLICY`, `OPCUA_SECURITY_MODE`, `OPCUA_CLIENT_CERT`, `OPCUA_CLIENT_KEY`, `OPCUA_APPLICATION_URI`, `OPCUA_SERVER_CERT`, `OPCUA_SERVER_TRUST_STORE`, `OPCUA_SERVER_APPLICATION_URI` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add opcua -e OPCUA_SERVER_URL=<OPCUA_SERVER_URL> -e OPCUA_CLIENT_KEY=<OPCUA_CLIENT_KEY> -e OPCUA_PASSWORD=<OPCUA_PASSWORD> -e OPCUA_USER_KEY=<OPCUA_USER_KEY> -e OPCUA_PROFILE=<OPCUA_PROFILE> -e OPCUA_AUDIT_CHAIN_KEY_FILE=<OPCUA_AUDIT_CHAIN_KEY_FILE> -- npx -y opcua-mcp-server
```
Replace <…> with your own values. 27 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add industriagents-opc-ua-mcp-server --env OPCUA_SERVER_URL=<OPCUA_SERVER_URL> --env OPCUA_PYTHON_BACKEND=<OPCUA_PYTHON_BACKEND> --env OPCUA_SECURITY_POLICY=<OPCUA_SECURITY_POLICY> --env OPCUA_SECURITY_MODE=<OPCUA_SECURITY_MODE> --env OPCUA_CLIENT_CERT=<OPCUA_CLIENT_CERT> -- npx -y opcua-mcp-server
```
Replace <…> with your own values. 27 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "industriagents-opc-ua-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "opcua-mcp-server"
            ],
            "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>"
            }
        }
    }
}
```
Replace <…> with your own values. 27 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "industriagents-opc-ua-mcp-server": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "opcua-mcp-server"
            ],
            "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>"
            }
        }
    }
}
```
Replace <…> with your own values. 27 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -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> industriagents-opc-ua-mcp-server npx -y opcua-mcp-server
```
Replace <…> with your own values. 27 more environment variables are in the server README

## When to use it
- browse an OPC UA node tree
- read current sensor values
- retrieve value history and aggregates
- track value changes through subscriptions
- send writes or method calls under a control profile

## Example prompts
- Browse the OPC UA server and read the sensor values.
- Get the history for the specified node.
- Subscribe to changes and list the available events and alarms.

## Similar
- [OPC-UA MCP Server](https://affpapa.org/en/nevibecode/mcp/opc-ua-mcp-server.md) — MCP server · ★ 7 repo stars
- [opc-architecture](https://affpapa.org/en/nevibecode/skills/opc-architecture.md) — skill · ★ 3951 repo stars
- [Context7](https://affpapa.org/en/nevibecode/mcp/context7.md) — MCP server · 5563 installs
- [Search Google Flights](https://affpapa.org/en/nevibecode/mcp/search-google-flights.md) — MCP server · 2595 installs
- [Math-MCP](https://affpapa.org/en/nevibecode/mcp/math-mcp.md) — MCP server · 5958 installs
- [pipeworx gateway](https://affpapa.org/en/nevibecode/mcp/pipeworx-gateway.md) — MCP server · 419019 installs
- [SparkForge](https://affpapa.org/en/nevibecode/mcp/sparkforge.md) — MCP server · 219896 installs
- [OpenWebSearch](https://affpapa.org/en/nevibecode/mcp/openwebsearch.md) — MCP server · 494 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
