How to Connect AI Agents to OPC-UA, MQTT, and Industrial IoT Protocols
AI agents are only as powerful as the data they can access and the actions they can take. In manufacturing, this means connecting to industrial protocols that were designed decades before AI existed. This guide shows how to bridge that gap.
The Industrial Protocol Landscape
OPC-UA (Open Platform Communications Unified Architecture)
What it is: The modern standard for secure, structured industrial data exchange. Provides a rich information model with semantic meaning, not just raw values.
Agent use cases: - Read machine parameters in real time - Write setpoints for process control - Browse the information model to discover available data - Subscribe to data changes for event-driven agent triggering
Key features for agents: - Information model provides context (not just a value of 87.3, but "Spindle Temperature in Celsius for Machine CNC-07") - Historical access for trend analysis - Alarm and event services for real-time alerting - Security built-in (authentication, encryption, access control)
MQTT (Message Queuing Telemetry Transport)
What it is: A lightweight publish/subscribe messaging protocol designed for IoT. Excels at high-frequency, high-volume sensor data streaming.
Agent use cases: - Subscribe to sensor data streams from hundreds of devices - Publish commands to edge devices and actuators - Implement Unified Namespace (UNS) architectures - Aggregate data from diverse sensor networks
Key features for agents: - Extremely lightweight (works on constrained devices) - Quality of Service levels (QoS 0, 1, 2) for delivery guarantees - Retained messages for latest-value access - Topic-based routing matches manufacturing hierarchies (plant/area/line/machine/sensor)
Modbus
What it is: The oldest and simplest industrial protocol. Still ubiquitous on legacy equipment, PLCs, and simple sensors.
Agent use cases: - Read registers from legacy equipment that only supports Modbus - Bridge legacy equipment into modern agent architectures - Simple actuator control via register writes
Key features for agents: - Simple but limited -- no semantic information model - Requires external documentation to interpret register values - Modbus TCP (Ethernet) and Modbus RTU (serial) variants
PROFINET
What it is: The real-time industrial Ethernet standard from Siemens. Dominant in European manufacturing and Siemens-equipped facilities.
Agent use cases: - Access Siemens PLC data - Read diagnostic information from PROFINET devices - Integration with Siemens MindSphere and Industrial Edge platforms
Building Protocol Bridges: MCP Servers
The recommended pattern is to wrap each protocol in an MCP server:
OPC-UA MCP Server
The OPC-UA MCP server is typically the most important server in a manufacturing agent deployment.
Resources exposed: - Equipment status (running, stopped, faulted) - Process parameters (real-time values with engineering units) - Historical trends (time-series data with aggregation) - Active alarms and alarm history
Tools exposed: - browse_nodes: Discover available OPC-UA nodes - read_values: Read current values of specified nodes - read_history: Query historical data with time range and interval - write_value: Write a new setpoint (with safety validation) - subscribe: Register for data change notifications
Safety implementation: - Node whitelist: Only expose nodes that agents should access - Write validation: Check value against configured min/max bounds - Rate limiting: Prevent excessive write operations - Audit logging: Record every read and write with agent identity
MQTT MCP Server
Resources exposed: - Sensor data streams organized by topic hierarchy - Device metadata and status - Latest retained values for all subscribed topics
Tools exposed: - subscribe_topic: Subscribe to one or more MQTT topics - read_latest: Get the most recent value for a topic - read_history: Query stored MQTT messages within a time range - publish: Send a message to an MQTT topic (for commands)
Unified Namespace (UNS) Integration
The Unified Namespace pattern organizes all factory data into a single, hierarchical MQTT topic structure:
enterprise/site/area/line/cell/device/measurement
Agents subscribed to the UNS have access to the entire factory data model through a single MQTT connection. The MCP server maps UNS topics to semantically meaningful resources.
Real-Time Data Handling
Challenge: Data Volume
A modern production line can generate 10,000+ data points per second. Agents cannot process every data point individually.
Solutions: - Edge aggregation: Reduce data to features (averages, peaks, FFTs) at the edge - Change-based transmission: Only send data when values change significantly - Hierarchical processing: Edge handles high-frequency, agent handles trends and patterns
Challenge: Latency
Some agent decisions need to happen in milliseconds (safety), others in seconds (optimization).
Solutions: - Two-tier architecture: Edge rules for millisecond responses, agent reasoning for second-level decisions - Pre-computed responses: Agent pre-calculates responses for likely scenarios - Async processing: Non-urgent analysis runs asynchronously without blocking real-time operations
Challenge: Reliability
Industrial protocols must work 24/7/365.
Solutions: - Connection monitoring and automatic reconnection - Store-and-forward buffering during outages - Fallback to cached values when live data is unavailable - Health check endpoints for monitoring MCP server status
Security Best Practices
- Network segmentation -- MCP servers in the DMZ between OT and IT networks
- Authentication -- Mutual TLS between agents and MCP servers
- Authorization -- Role-based access control at the MCP server level
- Encryption -- TLS for all data in transit
- Audit trail -- Complete logging of all data access and control actions
- Monitoring -- Intrusion detection on all agent-to-OT communications
Frequently Asked Questions
Related Solutions
Connect PLCs, sensors, and enterprise systems into a unified data architecture.
Digitize SOPs, approvals, and action closure with role-based workflows.
Use cameras + AI to strengthen quality, safety, and process discipline.