OPC-UA MCP Server

v1.0.0
io.github.mwieczorkiewicz/opcua-mcp Checked 13 hours ago Published 3 months ago

Read, write, browse, search, and subscribe to live data on an OPC-UA industrial automation server.

Values you need

VariableWhat it is
OPCUA_ENDPOINTrequired OPC-UA server endpoint to connect to, e.g. opc.tcp://your-plc-host:4840 Default: opc.tcp://localhost:4840
OPCUA_AUTH_MODEoptional Authentication mode against the OPC-UA server Default: anonymous
OPCUA_USERNAMEoptional Username, required if OPCUA_AUTH_MODE=username
OPCUA_PASSWORDoptional secret Password, required if OPCUA_AUTH_MODE=username
OPCUA_SECURITY_POLICYoptional OPC-UA transport security policy, e.g. Basic256Sha256 Default: None
OPCUA_SECURITY_MODEoptional OPC-UA transport security mode, e.g. SignAndEncrypt Default: None
SERVER_TRANSPORToptional MCP transport: stdio (for local MCP clients) or http (for remote/hosted deployments) Default: stdio

Docker discovery passed

Requires Docker

Run in a terminal
claude mcp add opcua-mcp -e OPCUA_ENDPOINT=opc.tcp://localhost:4840 -- docker run -i --rm -e OPCUA_ENDPOINT ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4
Add to claude_desktop_config.json
{
  "mcpServers": {
    "opcua-mcp": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "OPCUA_ENDPOINT",
        "ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4"
      ],
      "command": "docker",
      "env": {
        "OPCUA_ENDPOINT": "opc.tcp://localhost:4840"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "opcua-mcp": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "OPCUA_ENDPOINT",
        "ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4"
      ],
      "command": "docker",
      "env": {
        "OPCUA_ENDPOINT": "opc.tcp://localhost:4840"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "OPCUA_ENDPOINT",
      "id": "opcua-endpoint",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "opcua-mcp": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "OPCUA_ENDPOINT",
        "ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4"
      ],
      "command": "docker",
      "env": {
        "OPCUA_ENDPOINT": "${input:opcua-endpoint}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.opcua-mcp]
command = "docker"
args = ["run", "-i", "--rm", "-e", "OPCUA_ENDPOINT", "ghcr.io/mwieczorkiewicz/opcua-mcp:main-29734c4"]
env = { "OPCUA_ENDPOINT" = "opc.tcp://localhost:4840" }

For AI agents

  1. Ask the user for: OPCUA_ENDPOINT. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: opcua_browse, opcua_browse_nodes, opcua_connect, opcua_debug_search, opcua_disconnect, opcua_discovery_stats, opcua_ensure_server_nodes, opcua_find_similar_nodes, ….
  5. If it fails, check that the required runtime is installed (Docker) and that the values above are set.

Machine-readable: install.md · manifest.json