# opcfoundation/ua-.netstandard architecture

> Architecture diagram of the GitHub repository opcfoundation/ua-.netstandard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/opcfoundation/ua-.netstandard
- Repository: https://github.com/opcfoundation/ua-.netstandard

## Overview

#### Purpose and entry points
This is the OPC Foundation’s cross-platform .NET 2.0 reference implementation of OPC UA. It ships composable NuGet libraries rather than one application: applications host servers or clients through DI/fluent builders, or run supplied samples/tools. The solution root is `UA.slnx`; representative runnable entry points are `samples/Reference/ConsoleReferenceServer/Program.cs`, `samples/Reference/ConsoleReferenceClient/Program.cs`, and the MCP executable `tools/Opc.Ua.Mcp/Program.cs`.

#### Type system, encoding, and information models
`Opc.Ua.Types` is the foundational protocol model: built-in UA values, NodeIds, node tables/state objects, and binary/JSON/XML encoders. `Opc.Ua.Core.Types` adds common service contracts and canonical UA node states; `Opc.Ua.Core` supplies stack-level implementation and security. Model NodeSets are first-class inputs/assets and can be consumed at runtime or used for generated code.
- `src/Opc.Ua.Types/Encoders/BinaryEncoder.cs`
- `src/Opc.Ua.Types/State/NodeState.cs`
- `src/Opc.Ua.Core.Types/State/BaseEventState.cs`

#### Transport and secure service pipeline
The core stack maps UA service requests through transport bindings, secure channels, endpoint dispatch, and server request queues. UA-TCP is implemented directly; HTTPS/WebSocket and Web API hosting integrate with ASP.NET Core/Kestrel. Transport abstractions isolate wire protocol implementations from client/session and server logic.
- `src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs`
- `src/Opc.Ua.Core/Stack/Server/EndpointBase.cs`
- `src/Opc.Ua.Bindings.Https/Https/HttpsTransportListener.cs`

#### Server runtime and address space
`Opc.Ua.Server` hosts `StandardServer`, sessions, subscriptions, diagnostics, security/role services, and pluggable NodeManagers. `MasterNodeManager` is the central boundary between OPC UA service dispatch and application address spaces; custom, fluent, generated, or runtime-NodeSet managers supply nodes, read/write behavior, methods, events, and monitoring. Historian providers and file-system services are optional server capabilities.
- `src/Opc.Ua.Server/Hosting/OpcUaServerHostedService.cs`
- `src/Opc.Ua.Server/NodeManager/MasterNodeManager.ServiceDispatch.cs`
- `src/Opc.Ua.Server/Server/StandardServer.cs`

#### Client runtime
`Opc.Ua.Client` provides discovery, sessions, browse/read/write/call operations, node caching, subscriptions, alarms, history, and managed reconnect/failover. Managed sessions sit above channel management and session service clients; subscription engines convert Publish responses into monitored-item notifications and recovery state.
- `src/Opc.Ua.Client/Session/ManagedSession.cs`
- `src/Opc.Ua.Client/Session/Subscription/DefaultSubscriptionEngine.cs`
- `src/Opc.Ua.Core/Stack/Client/Channels/ClientChannelManager.cs`

#### Security, identity, discovery, and resilience
Security spans X.509 certificate lifecycle/trust lists, cryptographic policy/provider selection, username/X.509/JWT-issued-token identities, and authorization. GDS/LDS packages provide certificate/application registration and local/global discovery. Redundancy packages add shared-state, Raft/lease leadership, peer discovery, replicated sessions/address space, and Kubernetes integration.
- `src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs`
- `src/Opc.Ua.Gds.Server/ApplicationsNodeManager.cs`
- `src/Opc.Ua.Redundancy/Raft/DefaultRaftConsensus.cs`

#### PubSub and external integrations
`Opc.Ua.PubSub` builds scheduled publisher/subscriber runtimes from validated configuration: data-set sources → writer groups → JSON/UADP encoding/security → transport; inbound frames reverse into reader groups and sinks. Transport packages support UDP/DTLS, Ethernet, MQTT, and Kafka. Companion-model libraries layer DI/client/server façades for Device Integration, ISA-95, robotics, vision, AI, OpenUSD, positioning, WoT Connectivity, and registries.
- `src/Opc.Ua.PubSub/Application/PubSubApplication.cs`
- `src/Opc.Ua.PubSub/Connections/PubSubConnection.cs`
- `src/Opc.Ua.PubSub/Transcoding/PubSubTranscodingBridge.cs`

#### Build-time tooling and operations
Roslyn source generators turn model designs/NodeSets into types, NodeManagers, client/server APIs, and resource bindings; migration analyzers/code fixes support 1.x-to-2.0 adoption. The MCP host exposes controlled OPC UA client, PubSub, diagnostics, robotics, and vision operations to MCP-capable agents. CI runs Azure Pipelines and GitHub workflows; Docker/Kubernetes manifests are primarily for samples and integration deployment.
- `tools/Opc.Ua.SourceGeneration/ModelSourceGenerator.cs`
- `tools/Opc.Ua.MigrationAnalyzer/Analyzers/UA0001UtilsTraceToILoggerAnalyzer.cs`
- `tools/Opc.Ua.Mcp/McpHostBuilder.cs`

Main entry points: [`src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs`](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs) (Core stack & security), [`src/Opc.Ua.Server/Server/StandardServer.cs`](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Server/Server/StandardServer.cs) (Server runtime), [`src/Opc.Ua.Client/Session/ManagedSession.cs`](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Client/Session/ManagedSession.cs) (Client runtime), [`src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs`](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs) (Certificate & identity services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundation["Protocol Foundation"]
  node_types["UA types &amp; encoders<br/>Opc.Ua.Types<br/>[BinaryEncoder.cs]"]
  node_coretypes["Core service types<br/>Opc.Ua.Core.Types<br/>[BaseEventState.cs]"]
  node_nodesets["Model NodeSets<br/>model assets"]
end

subgraph group_stack["Service Stack"]
  node_core["Core stack &amp; security<br/>Opc.Ua.Core"]
  node_tcp["UA-TCP secure channel<br/>transport binding"]
  node_https["HTTPS / WebSocket binding<br/>transport binding"]
  node_endpoint["Endpoint dispatch<br/>server pipeline<br/>[EndpointBase.cs]"]
  node_channels["Client channel manager<br/>client pipeline"]
  node_certs["Certificate &amp; identity services<br/>security subsystem"]
end

subgraph group_runtimes["Runtime Libraries"]
  node_apps["Hosted applications<br/>application hosts<br/>[Program.cs]"]
  node_server["Server runtime<br/>Opc.Ua.Server<br/>[StandardServer.cs]"]
  node_master{{"Master NodeManager<br/>address-space boundary"}}
  node_nodemanagers["Application NodeManagers<br/>address-space providers"]
  node_client["Client runtime<br/>Opc.Ua.Client<br/>[ManagedSession.cs]"]
  node_subscriptions["Subscription engine<br/>notification runtime"]
end

subgraph group_integrations["Integration &amp; Operations"]
  node_pubsub["PubSub runtime<br/>Opc.Ua.PubSub"]
  node_pubsubtransport["PubSub transports<br/>UDP, MQTT, Kafka"]
  node_gds["GDS / LDS<br/>discovery services"]
  node_redundancy["Redundancy runtime<br/>replication &amp; leadership"]
  node_sourcegen["Model source generator<br/>Roslyn generator"]
  node_mcp["MCP host<br/>agent operations host<br/>[McpHostBuilder.cs]"]
end

node_types -->|"underpins"| node_coretypes
node_coretypes -->|"contracts for"| node_core
node_types -->|"encoding and node primitives"| node_core
node_core -->|"implements"| node_tcp
node_core -->|"supports"| node_https
node_tcp -->|"secured requests"| node_endpoint
node_https -->|"secured requests"| node_endpoint
node_endpoint -->|"dispatches services"| node_server
node_server -->|"routes address-space services"| node_master
node_master -->|"delegates nodes and behavior"| node_nodemanagers
node_nodesets -->|"runtime model input"| node_nodemanagers
node_core -->|"transport abstraction"| node_channels
node_channels -->|"connectivity and sessions"| node_client
node_client -->|"Publish processing"| node_subscriptions
node_certs -->|"secures channels and services"| node_core
node_certs -->|"identities and authorization"| node_server
node_certs -->|"application trust"| node_client
node_nodesets -->|"generation input"| node_sourcegen
node_sourcegen -->|"generates"| node_nodemanagers
node_pubsub -->|"publishes and consumes frames"| node_pubsubtransport
node_gds -->|"registration and certificates"| node_certs
node_redundancy -.->|"replicates runtime state"| node_server
node_apps -->|"hosts"| node_server
node_apps -->|"uses"| node_client
node_apps -->|"configures"| node_pubsub
node_mcp -->|"controlled client operations"| node_client
node_mcp -->|"controlled PubSub operations"| node_pubsub

click node_apps "https://github.com/opcfoundation/ua-.netstandard/blob/master/samples/Reference/ConsoleReferenceServer/Program.cs"
click node_types "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Types/Encoders/BinaryEncoder.cs"
click node_coretypes "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core.Types/State/BaseEventState.cs"
click node_core "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs"
click node_tcp "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs"
click node_https "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Bindings.Https/Https/HttpsTransportListener.cs"
click node_endpoint "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Server/EndpointBase.cs"
click node_channels "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Client/Channels/ClientChannelManager.cs"
click node_server "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Server/Server/StandardServer.cs"
click node_master "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Server/NodeManager/MasterNodeManager.ServiceDispatch.cs"
click node_client "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Client/Session/ManagedSession.cs"
click node_subscriptions "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Client/Session/Subscription/DefaultSubscriptionEngine.cs"
click node_certs "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs"
click node_pubsub "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.PubSub/Application/PubSubApplication.cs"
click node_pubsubtransport "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.PubSub/Connections/PubSubConnection.cs"
click node_gds "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Gds.Server/ApplicationsNodeManager.cs"
click node_redundancy "https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Redundancy/Raft/DefaultRaftConsensus.cs"
click node_sourcegen "https://github.com/opcfoundation/ua-.netstandard/blob/master/tools/Opc.Ua.SourceGeneration/ModelSourceGenerator.cs"
click node_mcp "https://github.com/opcfoundation/ua-.netstandard/blob/master/tools/Opc.Ua.Mcp/McpHostBuilder.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_types,node_coretypes,node_nodesets toneBlue
class node_core,node_tcp,node_https,node_endpoint,node_channels,node_certs toneAmber
class node_apps,node_server,node_master,node_nodemanagers,node_client,node_subscriptions toneMint
class node_pubsub,node_pubsubtransport,node_gds,node_redundancy,node_sourcegen,node_mcp toneRose
```

## Components

### Protocol Foundation

- [UA types & encoders](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Types/Encoders/BinaryEncoder.cs): Opc.Ua.Types · Protocol values, node state primitives, and binary/JSON/XML encoding. · `src/Opc.Ua.Types/Encoders/BinaryEncoder.cs`
- [Core service types](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core.Types/State/BaseEventState.cs): Opc.Ua.Core.Types · Service contracts and canonical UA node states. · `src/Opc.Ua.Core.Types/State/BaseEventState.cs`
- **Model NodeSets**: model assets · Runtime address-space inputs and source-generation inputs.

### Service Stack

- [Core stack & security](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs): Opc.Ua.Core · Stack implementation, transport abstractions, and security services. · `src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs`
- [UA-TCP secure channel](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs): transport binding · `src/Opc.Ua.Core/Stack/Tcp/UaSCBinaryChannel.cs`
- [HTTPS / WebSocket binding](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Bindings.Https/Https/HttpsTransportListener.cs): transport binding · ASP.NET Core/Kestrel transport hosting. · `src/Opc.Ua.Bindings.Https/Https/HttpsTransportListener.cs`
- [Endpoint dispatch](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Server/EndpointBase.cs): server pipeline · Maps secured requests to server service handling. · `src/Opc.Ua.Core/Stack/Server/EndpointBase.cs`
- [Client channel manager](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Stack/Client/Channels/ClientChannelManager.cs): client pipeline · `src/Opc.Ua.Core/Stack/Client/Channels/ClientChannelManager.cs`
- [Certificate & identity services](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs): security subsystem · Certificate lifecycle, trust, cryptographic policy, and token identities. · `src/Opc.Ua.Core/Security/Certificates/CertificateManager/CertificateManager.cs`

### Runtime Libraries

- [Hosted applications](https://github.com/opcfoundation/ua-.netstandard/blob/master/samples/Reference/ConsoleReferenceServer/Program.cs): application hosts · Applications compose the NuGet libraries through DI and fluent builders. · `samples/Reference/ConsoleReferenceServer/Program.cs`
- [Server runtime](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Server/Server/StandardServer.cs): Opc.Ua.Server · StandardServer hosts sessions, subscriptions, diagnostics, and role services. · `src/Opc.Ua.Server/Server/StandardServer.cs`
- [Master NodeManager](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Server/NodeManager/MasterNodeManager.ServiceDispatch.cs): address-space boundary · Bridges UA service dispatch to application address spaces. · `src/Opc.Ua.Server/NodeManager/MasterNodeManager.ServiceDispatch.cs`
- **Application NodeManagers**: address-space providers · Custom, fluent, generated, or NodeSet-backed nodes and behavior.
- [Client runtime](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Client/Session/ManagedSession.cs): Opc.Ua.Client · Discovery, service operations, caching, alarms, and history. · `src/Opc.Ua.Client/Session/ManagedSession.cs`
- [Subscription engine](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Client/Session/Subscription/DefaultSubscriptionEngine.cs): notification runtime · Converts Publish responses into monitored-item notifications and recovery state. · `src/Opc.Ua.Client/Session/Subscription/DefaultSubscriptionEngine.cs`

### Integration & Operations

- [PubSub runtime](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.PubSub/Application/PubSubApplication.cs): Opc.Ua.PubSub · Scheduled publisher/subscriber pipelines configured from validated PubSub configuration. · `src/Opc.Ua.PubSub/Application/PubSubApplication.cs`
- [PubSub transports](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.PubSub/Connections/PubSubConnection.cs): UDP, MQTT, Kafka · Frames flow through writer/reader groups, UADP or JSON encoding, and transport connections. · `src/Opc.Ua.PubSub/Connections/PubSubConnection.cs`
- [GDS / LDS](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Gds.Server/ApplicationsNodeManager.cs): discovery services · Application registration, certificate, and local/global discovery services. · `src/Opc.Ua.Gds.Server/ApplicationsNodeManager.cs`
- [Redundancy runtime](https://github.com/opcfoundation/ua-.netstandard/blob/master/src/Opc.Ua.Redundancy/Raft/DefaultRaftConsensus.cs): replication & leadership · Raft/lease leadership, peer discovery, and replicated state. · `src/Opc.Ua.Redundancy/Raft/DefaultRaftConsensus.cs`
- [Model source generator](https://github.com/opcfoundation/ua-.netstandard/blob/master/tools/Opc.Ua.SourceGeneration/ModelSourceGenerator.cs): Roslyn generator · Generates types, NodeManagers, APIs, and resource bindings from models. · `tools/Opc.Ua.SourceGeneration/ModelSourceGenerator.cs`
- [MCP host](https://github.com/opcfoundation/ua-.netstandard/blob/master/tools/Opc.Ua.Mcp/McpHostBuilder.cs): agent operations host · Controlled OPC UA client, PubSub, diagnostics, robotics, and vision operations. · `tools/Opc.Ua.Mcp/McpHostBuilder.cs`

## Connections

- UA types & encoders → Core service types: underpins
- Core service types → Core stack & security: contracts for
- UA types & encoders → Core stack & security: encoding and node primitives
- Core stack & security → UA-TCP secure channel: implements
- Core stack & security → HTTPS / WebSocket binding: supports
- UA-TCP secure channel → Endpoint dispatch: secured requests
- HTTPS / WebSocket binding → Endpoint dispatch: secured requests
- Endpoint dispatch → Server runtime: dispatches services
- Server runtime → Master NodeManager: routes address-space services
- Master NodeManager → Application NodeManagers: delegates nodes and behavior
- Model NodeSets → Application NodeManagers: runtime model input
- Core stack & security → Client channel manager: transport abstraction
- Client channel manager → Client runtime: connectivity and sessions
- Client runtime → Subscription engine: Publish processing
- Certificate & identity services → Core stack & security: secures channels and services
- Certificate & identity services → Server runtime: identities and authorization
- Certificate & identity services → Client runtime: application trust
- Model NodeSets → Model source generator: generation input
- Model source generator → Application NodeManagers: generates
- PubSub runtime → PubSub transports: publishes and consumes frames
- GDS / LDS → Certificate & identity services: registration and certificates
- Redundancy runtime → Server runtime: replicates runtime state
- Hosted applications → Server runtime: hosts
- Hosted applications → Client runtime: uses
- Hosted applications → PubSub runtime: configures
- MCP host → Client runtime: controlled client operations
- MCP host → PubSub runtime: controlled PubSub operations
