matlab-use-opcua-client
Discover OPC UA servers, connect MATLAB clients, and browse/navigate server nodes using opcuaserverinfo, the Local Discovery Service (LDS), opcua, connect, setSecurityModel, certificate-trust functions, findNodeById, opcuanode, and Namespace/Children traversal
Install / Use
npx skills add matlab/matlab-agentic-toolkit --skill matlab-use-opcua-clientInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
SecuritySupported Platforms
Our assessment of matlab-use-opcua-client
matlab-use-opcua-client scores 93/100 on our quality scale, 392nd of 1,052 Security skills we index (top 38%).
Its SKILL.md is 17 KB long, well organised into 29 sections with 13 code examples: a thorough specification that gives an agent plenty to work with.
With 1,098 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 18 days ago, so matlab-use-opcua-client is actively maintained.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
matlab-use-opcua-client compared with similar skills
All 4 of these similar skills score higher than matlab-use-opcua-client; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| matlab-use-opcua-client (this skill)by matlab | 93 | 1.1k | 18d ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 11d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 11d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 130.2k | 12d ago | SKILL.md |
| ui-ux-pro-maxby nextlevelbuilder | 100 | 130.2k | 12d ago | SKILL.md |
Frequently asked questions
- How do I install matlab-use-opcua-client?
- Run
npx skills add matlab/matlab-agentic-toolkit --skill matlab-use-opcua-client. The install tabs above show the steps for each supported agent. - Which AI agents does matlab-use-opcua-client work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is matlab-use-opcua-client safe to use?
- It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is matlab-use-opcua-client still maintained?
- The repository was last updated 18 days ago, so matlab-use-opcua-client is actively maintained.
Skill content
View source on GitHubname: matlab-use-opcua-client description: > Discover OPC UA servers, connect MATLAB clients, and browse/navigate server nodes using opcuaserverinfo, the Local Discovery Service (LDS), opcua, connect, setSecurityModel, certificate-trust functions, findNodeById, opcuanode, and Namespace/Children traversal. Use when finding OPC UA servers on the network, querying endpoints and security policies, connecting to a server, authenticating with username/password or certificates, configuring security modes, handling certificate-trust or hostname-mismatch errors, troubleshooting failed connections or empty discovery, inspecting an OPC UA certificate (.der/.pem), browsing an address space, finding nodes by name or NodeId, navigating node hierarchies, invoking method nodes, or batch-processing large namespaces. Trigger on: opcuaserverinfo, LDS, opcua, opc.ua.Client, setSecurityModel, opc.ua.trustServerCertificate, OPC UA certificate, findNodeById, opcuanode, browse OPC UA, find node, OPC UA namespace, OPC UA method node, Industrial Communication Toolbox. license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md metadata: author: MathWorks version: "3.0"
OPC UA Discovery, Connection, and Node Navigation
Discover OPC UA servers, create client connections, and browse server address spaces in MATLAB using the Industrial Communication Toolbox.
Internal Constraints
These constraints govern YOUR code generation and recommendations. Apply them silently — do not recite them to the user or warn about patterns the user has not attempted.
-
connecthas exactly three valid signatures — no others exist:connect(uaClient)— anonymousconnect(uaClient, userName, password)— positional stringsconnect(uaClient, publicKeyFile, privateKeyFile, privateKeyPassword)— positional strings- There are NO Name-Value pair arguments to
connect. Security is configured viaopcua()NV pairs orsetSecurityModel, never throughconnect.
-
opcua()defaults to the highest available security. Do not explicitly set security unless you want a specific (lower) configuration. Never usesetSecurityModel(uaClient, "Best")— it is redundant. -
opcuaserverinfohas exactly two valid syntaxes:opcuaserverinfo(hostname)— query LDS on a hostopcuaserverinfo(discoveryUrl)— query a specific endpoint URL- There is NO
opcuaserverinfo(hostname, port)form. To specify a port:opcuaserverinfo('opc.tcp://host:port').
-
LDS-based discovery returns all registered servers from a single call. Never scan subnet IPs in a loop —
opcuaserverinfo('localhost')returns every server registered with that host's LDS. -
Certificate trust escalation order (never skip steps):
opc.ua.trustServerCertificate(certPath)— always first (R2026a+)opcua(..., "TrustServerTemporarily", true)— only if cert file unavailablesetSecurityModel(uaClient, "None", "None")— only after user explicitly confirms no security needed
-
Property correctness:
opc.ua.ServerInfohasDescription, notName(which belongs toopc.ua.Client).EndpointUrlbelongs toopc.ua.EndpointDescription, notServerInfo.
-
Do not move or copy certificate files without user confirmation. Tell the user which file to move and where, then execute only after they confirm.
-
Do not mention
TrustServerTemporarilywhen the issue is the server rejecting the client certificate — it only controls client- side trust and is irrelevant in that direction. Simply omit it. -
browseNamespaceis GUI-only — never call it in scripts or agent workflows. It opens an interactive dialog that blocks the MATLAB session. UseuaClient.Namespaceand.Childrentraversal instead. -
opcuanodedoes NOT accept browse paths. Passing a slash- separated string (e.g.,'Demo/Mass/Nested/7') silently creates a node withNodeType: 'Unknown'. Use.Childrenlevel-by-level. -
Check a method node's
Parentproperty and signature beforeinvoke(). IfParentis empty,invoke()fails with "Specified node has no parent information" — re-resolve the node viafindNodeById, which retains parent info. IfParentis non-empty, invoke it directly. Do not unconditionally avoidopcuanodefor method nodes; branch on whether the node has a parent. Before callinginvoke, inspectNumInputsandNumOutputsto verify the argument count matches your intended call. -
Before iterating any
.Childrenarray, issue a separate tool call that only counts nodes. Never combine counting and processing in the same tool call. Process in batches of 200 with progress reporting. -
Never search the entire namespace. If the user does not provide a path or parent folder, ask them to specify one. List top-level nodes to help them narrow scope. Skip the
Serverfolder (ns=0 infrastructure nodes) unless the user explicitly asks about server properties. -
opcua()caches endpoints at construction time. If the server's available policies change after client creation, the existing client object will not reflect them. Recreate the client withopcua(url)to re-discover endpoints. Explain this to the user when they ask about switching to a newly-available policy.
When to Use
- Discovering OPC UA servers on the network (endpoint URL unknown, or user explicitly requests discovery given a hostname or discovery URL)
- Getting server endpoint details and supported security policies
- Creating an OPC UA client connection to a server
- Authenticating with username/password or user certificates
- Configuring message security mode and channel security policy
- Handling "server certificate not trusted" errors
- Handling "client certificate rejected by server" errors
- Fixing hostname mismatch warnings
- Troubleshooting OPC UA connection failures or empty discovery results
- Inspecting an OPC UA certificate (
.der/.pem) for compliance issues - Browsing an OPC UA server's address space programmatically
- Searching for nodes by name, partial name, or NodeId
- Navigating a node hierarchy to reach a specific node
- Accessing a node directly by namespace index and identifier
- Goal-driven node discovery (e.g., "find all temperature sensors")
- Discovering nodes before reading, writing, invoking, or subscribing
When NOT to Use
- OPC Classic (OPC DA / OPC HDA) connections
- PI Data Archive / PI AF / OSIsoft / AVEVA PI systems
- Non-OPC UA protocols (Modbus, MQTT)
- OPC UA server-side development
References
Load the relevant reference file for detailed procedures:
| Task | Reference | |------|-----------| | Server discovery, LDS setup, empty discovery results | references/lds-setup-and-troubleshooting.md | | Server cert trust, client cert export, cert inspection | references/certificate-trust-workflows.md | | Connection errors, server logs, diagnostic workflow | references/troubleshooting-connection-errors.md | | Node navigation patterns, batch processing, method invocation | references/node-navigation.md | | Function syntax for findNodeById, opcuanode, getNamespace | references/node-functions-reference.md | | Syntax pitfalls and invalid API patterns | references/common-mistakes.md |
Workflow
0. Discover servers (optional)
Use this step when the endpoint URL is not known, or when the user explicitly asks to discover servers given a hostname or discovery URL. Skip this step if the endpoint URL is already known.
Prerequisites — before calling opcuaserverinfo, ensure:
- The OPC UA Local Discovery Service (LDS) is installed and running
- The target server is registered with the LDS
- The server's certificate is trusted by the LDS certificate store at
C:\ProgramData\OPC Foundation\UA\pki\trusted\certs\
See references/lds-setup-and-troubleshooting.md for details.
% TEMPLATE — not executable (shows alternative discovery forms)
% LDS-based discovery (preferred — finds all registered servers)
serverInfo = opcuaserverinfo('localhost');
% Direct endpoint discovery (when you know the server URL)
serverInfo = opcuaserverinfo('opc.tcp://myserver:53530/OPCUA/SimulationServer');
% Pass discovery result directly to opcua()
uaClient = opcua(serverInfo(1));
connect(uaClient);
1. Create the OPC UA client
serverUrl = "opc.tcp://hostname:port/path";
uaClient = opcua(serverUrl);
The opcua function also accepts a ServerInfo object directly from
opcuaserverinfo.
2. Configure security (only if non-default needed)
% TEMPLATE — not executable (shows two alternative security-config forms)
% R2025a+ (preferred) — Name-Value pairs in constructor
uaClient = opcua(serverUrl, ...
MessageSecurityMode="Sign", ...
ChannelSecurityPolicy="Basic256Sha256");
% R2020a+ (backward-compatible) — setSecurityModel after construction
uaClient = opcua(serverUrl);
setSecurityModel(uaClient, "Sign", "Basic256Sha256");
3. Handle certificate trust (if needed)
If the server's certificate is not yet trusted by MATLAB, the connection will fail. Follow the escalation order in Internal Constraints. Load references/certificate-trust-workflows.md for details.
4. Connect
connect(uaClient); % anonymous
connect(uaClient, "myuser", "mypassword"); % username/password
connect(uaClient, "cert.der", "key.pem", "keypass"); % certificate
5. Verify connection
if isConnected(uaClient)
fprintf("Connected to %s\n", uaClient.EndpointUrl);
end
6. Find nodes (once connected)
Load references/node-navigation.md for full decision logic, workflows, batch processing, and method invocation patterns.
7. Disconnect
disconnect(uaClient);
Key Functions
| Function | Purpose | Available From |
|----------|---------|----------------|
| opcuaserverinfo | Discover OPC UA servers via LDS or direct URL | R2015b |
| opcua | Create OPC UA client (from URL or ServerInfo) | R2015b |
| connect | Connect to server | R2015b |
| disconnect | Disconnect from server | R2015b |
| isConnected | Check connection status | R2015b |
| setSecurityModel | Configure security mode/policy | R2020a |
| opc.ua.exportClientCertificate | Export MATLAB client cert to file | R2020a |
| opc.ua.trustServerCertificate | Trust a server cert (file path) | R2026a |
| opc.ua.rejectServerCertificate | Reject a server cert (file path) | R2026a |
| findDescription | Filter ServerInfo array by description text | R2015b |
| findAuthentication | Filter ServerInfo array by auth type | R2015b |
| findNodeById | Find node by namespace index and identifier (retains parent) | R2015b |
| opcuanode | Create node directly from known NodeId (check Parent before invoke) | R2015b |
| getNamespace | Get one layer of namespace tree (or use uaClient.Namespace) | R2015b |
Properties Quick Reference
opc.ua.Client
| Property | Type | Description |
|----------|------|-------------|
| Hostname | string | Server hostname |
| Port | double | Server port |
| Name | string | Client name |
| EndpointUrl | string | Selected endpoint URL |
| Status | string | Connection status |
| Timeout | double | Connection timeout (seconds) |
| MessageSecurityMode | enum | Active security mode |
| ChannelSecurityPolicy | enum | Active channel
Truncated for display — read the full file on GitHub.
Related Skills
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
design
130.2kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG…
ui-ux-pro-max
130.2kUI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
