Skip to content

Latest commit

 

History

History
123 lines (94 loc) · 4.59 KB

File metadata and controls

123 lines (94 loc) · 4.59 KB

OPC UA MCP Server

An MCP (Model Context Protocol) server that exposes OPC UA Part 4 service calls as MCP tools, enabling LLMs (Claude, Copilot, VS Code, etc.) to interact with OPC UA servers.

Features

  • Profile-based tool catalog covering all OPC UA Part 4 service sets (except session management), plus PKI, configuration, NodeSet export, PubSub, and OPC UA-aware packet capture. The default full profile exposes every tool below; smaller profiles (core, services, administration, pubsub, diagnostics) expose a bounded subset — see Tool Profiles
  • Both stdio and Streamable HTTP transports (HTTP is exposed only at /mcp; --transport sse is a deprecated alias for --transport http)
  • JSON representation of all OPC UA types for LLM-friendly interactions; scalar Variant values preserve typed false and 0 values rather than treating default values as null
  • Session management via Connect/Disconnect tools

Tool Inventory (full profile)

The tables below list every tool available in the default full profile. Running with --profile core|services|administration|pubsub|diagnostics exposes only the tool classes relevant to that profile — see Tool Profiles for the mapping.

Service Set Tools Description
Connection GetEndpoints, Connect, Disconnect, GetConnectionStatus Endpoint discovery and session lifecycle
Attribute Read, Write, HistoryRead, HistoryUpdate Read/write node attributes and historical data
View Browse, BrowseNext, TranslateBrowsePaths, RegisterNodes, UnregisterNodes, QueryFirst, QueryNext Navigate and query the address space
Node Management AddNodes, AddReferences, DeleteNodes, DeleteReferences Modify address space
Method Call Invoke methods
Subscription CreateSubscription, ModifySubscription, SetPublishingMode, Publish, Republish, DeleteSubscriptions, TransferSubscriptions Notification subscriptions
MonitoredItem CreateMonitoredItems, ModifyMonitoredItems, SetMonitoringMode, SetTriggering, DeleteMonitoredItems Data change monitoring
Discovery FindServers, FindServersOnNetwork, RegisterServer, RegisterServer2 Server discovery and registration
PKI Management ListCertificates, TrustCertificate, RemoveCertificate, GetPkiStorePaths Manage certificate trust lists
Configuration GetConfiguration, SetTransportConfiguration, SetClientConfiguration, SetSecurityConfiguration, SetConfiguration View/modify in-memory client settings; SetConfiguration is the full-profile compatibility tool
NodeSet Export ExportNodeSet, ExportNodeSetPerNamespace Export address space to NodeSet2 XML
Convenience ReadValue, ReadValues, WriteValue, BrowseAll, CallMethod, ReadNode, Cancel Simplified operations
Packet Capture list_interfaces, start_capture, stop_capture, list_captures, get_capture, capture_now, list_active_channels, dump_keys, decode_pcap_with_keys, summarize_service_calls, replay_pcap, stop_replay, list_replays OPC UA-aware packet capture, offline decode, service-call summaries, replay

Documentation

See the full documentation and NuGet readme.

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "opcua": {
      "command": "dotnet",
      "args": ["run", "--project", "/path/to/tools/Opc.Ua.Mcp/Opc.Ua.Mcp.csproj"]
    }
  }
}

VS Code Configuration

Add to .vscode/mcp.json:

{
  "servers": {
    "opcua": {
      "command": "dotnet",
      "args": ["run", "--project", "/path/to/tools/Opc.Ua.Mcp/Opc.Ua.Mcp.csproj"]
    }
  }
}

Example Tool Calls

Connect to a server

Tool: Connect
Arguments:
  endpointUrl: "opc.tcp://localhost:62541/Quickstarts/ReferenceServer"
  useSecurity: true
  autoAcceptCerts: true

Browse the Objects folder

Tool: Browse
Arguments:
  nodeId: "i=85"

Read a variable value

Tool: ReadValue
Arguments:
  nodeId: "i=2258"

Write a value

Tool: WriteValue
Arguments:
  nodeId: "ns=2;s=MyVariable"
  value: "42"
  dataType: "Int32"

Call a method

Tool: CallMethod
Arguments:
  objectId: "ns=2;s=MyObject"
  methodId: "ns=2;s=MyMethod"
  inputArguments: ["arg1", "arg2"]

OPC UA Client Configuration

The server uses McpServer.Config.xml for OPC UA client configuration, including:

  • Application certificate settings
  • Trust list management
  • Transport quotas
  • Operation limits

Certificates are stored under %LocalApplicationData%/OPC Foundation/pki/.