Skip to content
VS Code

OPC UA MCP Server for VS Code

io.github.midhunxavier/opcua

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

client:VS Code transport:stdio runtime:npm

Install OPC UA MCP Server in VS Code

.vscode/mcp.json

{
  "inputs": [
    {
      "type": "promptString",
      "id": "opcua-server-url",
      "description": "OPCUA_SERVER_URL",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-python-backend",
      "description": "OPCUA_PYTHON_BACKEND",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-security-policy",
      "description": "OPCUA_SECURITY_POLICY",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-security-mode",
      "description": "OPCUA_SECURITY_MODE",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-client-cert",
      "description": "OPCUA_CLIENT_CERT",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-client-key",
      "description": "OPCUA_CLIENT_KEY",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-application-uri",
      "description": "OPCUA_APPLICATION_URI",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-server-cert",
      "description": "OPCUA_SERVER_CERT",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-server-trust-store",
      "description": "OPCUA_SERVER_TRUST_STORE",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-server-application-uri",
      "description": "OPCUA_SERVER_APPLICATION_URI",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-username",
      "description": "OPCUA_USERNAME",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-password",
      "description": "OPCUA_PASSWORD",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-user-cert",
      "description": "OPCUA_USER_CERT",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-user-key",
      "description": "OPCUA_USER_KEY",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-profile",
      "description": "OPCUA_PROFILE",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-policy-file",
      "description": "OPCUA_POLICY_FILE",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allowed-tools",
      "description": "OPCUA_ALLOWED_TOOLS",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allowed-write-nodes",
      "description": "OPCUA_ALLOWED_WRITE_NODES",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allowed-methods",
      "description": "OPCUA_ALLOWED_METHODS",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allow-acknowledge-alarms",
      "description": "OPCUA_ALLOW_ACKNOWLEDGE_ALARMS",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allow-insecure-control",
      "description": "OPCUA_ALLOW_INSECURE_CONTROL",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allow-unverified-server-control",
      "description": "OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-allow-out-of-range-writes",
      "description": "OPCUA_ALLOW_OUT_OF_RANGE_WRITES",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-audit-file",
      "description": "OPCUA_AUDIT_FILE",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-audit-fsync",
      "description": "OPCUA_AUDIT_FSYNC",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-audit-chain",
      "description": "OPCUA_AUDIT_CHAIN",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-audit-chain-key-file",
      "description": "OPCUA_AUDIT_CHAIN_KEY_FILE",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-operator-id",
      "description": "OPCUA_OPERATOR_ID",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-reconnect-initial-delay-ms",
      "description": "OPCUA_RECONNECT_INITIAL_DELAY_MS",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-reconnect-max-delay-ms",
      "description": "OPCUA_RECONNECT_MAX_DELAY_MS",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-reconnect-max-retry",
      "description": "OPCUA_RECONNECT_MAX_RETRY",
      "password": true
    },
    {
      "type": "promptString",
      "id": "opcua-session-timeout-ms",
      "description": "OPCUA_SESSION_TIMEOUT_MS",
      "password": true
    }
  ],
  "servers": {
    "opcua": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "opcua-mcp-server"
      ],
      "env": {
        "OPCUA_SERVER_URL": "${input:opcua-server-url}",
        "OPCUA_PYTHON_BACKEND": "${input:opcua-python-backend}",
        "OPCUA_SECURITY_POLICY": "${input:opcua-security-policy}",
        "OPCUA_SECURITY_MODE": "${input:opcua-security-mode}",
        "OPCUA_CLIENT_CERT": "${input:opcua-client-cert}",
        "OPCUA_CLIENT_KEY": "${input:opcua-client-key}",
        "OPCUA_APPLICATION_URI": "${input:opcua-application-uri}",
        "OPCUA_SERVER_CERT": "${input:opcua-server-cert}",
        "OPCUA_SERVER_TRUST_STORE": "${input:opcua-server-trust-store}",
        "OPCUA_SERVER_APPLICATION_URI": "${input:opcua-server-application-uri}",
        "OPCUA_USERNAME": "${input:opcua-username}",
        "OPCUA_PASSWORD": "${input:opcua-password}",
        "OPCUA_USER_CERT": "${input:opcua-user-cert}",
        "OPCUA_USER_KEY": "${input:opcua-user-key}",
        "OPCUA_PROFILE": "${input:opcua-profile}",
        "OPCUA_POLICY_FILE": "${input:opcua-policy-file}",
        "OPCUA_ALLOWED_TOOLS": "${input:opcua-allowed-tools}",
        "OPCUA_ALLOWED_WRITE_NODES": "${input:opcua-allowed-write-nodes}",
        "OPCUA_ALLOWED_METHODS": "${input:opcua-allowed-methods}",
        "OPCUA_ALLOW_ACKNOWLEDGE_ALARMS": "${input:opcua-allow-acknowledge-alarms}",
        "OPCUA_ALLOW_INSECURE_CONTROL": "${input:opcua-allow-insecure-control}",
        "OPCUA_ALLOW_UNVERIFIED_SERVER_CONTROL": "${input:opcua-allow-unverified-server-control}",
        "OPCUA_ALLOW_OUT_OF_RANGE_WRITES": "${input:opcua-allow-out-of-range-writes}",
        "OPCUA_AUDIT_FILE": "${input:opcua-audit-file}",
        "OPCUA_AUDIT_FSYNC": "${input:opcua-audit-fsync}",
        "OPCUA_AUDIT_CHAIN": "${input:opcua-audit-chain}",
        "OPCUA_AUDIT_CHAIN_KEY_FILE": "${input:opcua-audit-chain-key-file}",
        "OPCUA_OPERATOR_ID": "${input:opcua-operator-id}",
        "OPCUA_RECONNECT_INITIAL_DELAY_MS": "${input:opcua-reconnect-initial-delay-ms}",
        "OPCUA_RECONNECT_MAX_DELAY_MS": "${input:opcua-reconnect-max-delay-ms}",
        "OPCUA_RECONNECT_MAX_RETRY": "${input:opcua-reconnect-max-retry}",
        "OPCUA_SESSION_TIMEOUT_MS": "${input:opcua-session-timeout-ms}"
      }
    }
  }
}

VS Code prompts for each input the first time the server starts, so no secret is written to the file. VS Code docs

OPC UA MCP Server in other clients