MCP over MQTT: Connect IoT Devices and AI, Empowering Agentic IoT
- Last Updated: June 2, 2025
EMQ Technologies
- Last Updated: June 2, 2025
With the widespread adoption of large language models (LLMs), a key challenge is identifying suitable use cases and building intelligent agents that serve various industries. The community has seen a surge in infrastructure and tools supporting AI agent development, among which Anthropic’s MCP stands out for its ability to connect LLMs with diverse data sources.
This article explores the potential and applications of MCP in driving IoT intelligence through the following questions:
MCP (Model Context Protocol) is an open standard protocol introduced by Anthropic in November 2024. It is designed to establish a standardized communication framework between LLMs and external data sources, tools, and services, addressing data silos and enhancing AI applications' interaction efficiency with multi-source information. Its core architecture and key components include:
Key Advantages and Features of MCP
Flexible Expansion: New features can be added by deploying additional MCP Servers, enabling a modular expansion mechanism similar to plugins.
AI Application Scenarios of MCP
Since its launch, MCP-related server services have grown rapidly. As of now, MCP Server Directory lists 4,245 services, covering categories such as databases, cloud platforms, and browser automation. These services enable various MCP Client applications to easily connect with external data sources and tools, leveraging AI’s reasoning capabilities to orchestrate workflows and accelerate the development of intelligent applications.
IoT devices enable the digital world to perceive the physical environment by reporting data, while also allowing control and operation of physical-world devices through exposed interfaces to meet specific user needs. Currently, most IoT systems rely on the MQTT protocol for communication. The architectural design of MCP aligns closely with the "device model" concept in IoT, making it a promising solution for this domain. MCP not only integrates seamlessly with existing MQTT-based systems but also enhances the connection between devices and AI applications.
A device model represents the digital twin of physical entities (such as sensors, in-vehicle devices, buildings, and factories) in the cloud. It defines an entity’s characteristics, functions, and externally available information through three key dimensions: attributes, functions, and events.
Capabilities Offered by MCP
MCP and IoT: A Seamless Integration for AI-driven IoT Systems
By comparing the device model’s three dimensions with MCP’s capabilities, we can see a clear alignment:
This strong similarity between the device model and MCP presents a viable approach for building AI-powered IoT systems:
With MCP enabling AI-driven device interaction, end users can seamlessly communicate with IoT devices using natural language. For example, in a smart home scenario, a user could simply say to their smartphone app:
“I’ll be home in an hour. Set the living room temperature to 25°C and keep the humidity at 40%.”
Before MCP, implementing such functionality required developers to manually adapt interfaces for different device models and versions.
With MCP, LLMs like DeepSeek can intelligently understand a device’s capabilities based on natural language descriptions, autonomously coordinate relevant MCP services, and manage device control—without the need for manually written rules or code. This significantly enhances device interoperability and AI-driven automation in IoT ecosystems.
The MCP protocol currently supports two primary communication methods: standard input/output (stdio) and HTTP + Server-Sent Events (SSE). The former is well-suited for local communication between MCP Clients and Servers, while the latter is more appropriate for remote network communication.
In an ideal IoT deployment, an MCP Server would run on the device, while a mobile application or other client acts as the MCP Host, interacting with the server via an MCP Client for intelligent orchestration and execution. However, several challenges arise in real-world implementations:
To address the challenges outlined above, EMQ proposes the MCP over MQTT solution, aiming to enhance IoT device intelligence at the protocol level.
This approach offers differentiated support for devices with varying computational capabilities:
By replacing HTTP + SSE with MQTT at the transport layer, MCP over MQTT significantly improves communication reliability in low-bandwidth and unstable network environments. Additionally, EMQX, as a message broker, enhances scalability by providing:
Devices upload data to EMQX using the MQTT protocol. The MCP Server subscribes to relevant topics to obtain device information, then exposes the uploaded data using MCP resources or tools.
Device control messages are similarly transmitted through MQTT via EMQX, with tools exposed to external systems via the MCP over MQTT protocol.
The app communicates with the remote MCP Server via MCP over MQTT through EMQX to retrieve device status and send control commands. It can also interact with other systems by using standard MCP protocols to communicate with additional MCP Servers.
The main advantage of this solution is that existing IoT devices require no modification to gain AI interaction capabilities. It fully retains the inherent benefits of MQTT in low-power and low-network environments. Combined with EMQX’s high concurrency and high availability, this solution enables rapid deployment of scalable, intelligent IoT applications, solving compatibility and implementation cost challenges for legacy device upgrades.
The Internal Proxy solution improves upon the external proxy approach by directly integrating the MCP Server into EMQX. This integration provides several built-in tools and capabilities that enhance system performance, rather than simply reducing the number of nodes between EMQX and the MCP Server.
Additionally, since the MCP Server operates as an internal component of EMQX, it significantly reduces operational complexity, making the development and management of MCP Server applications more convenient and efficient.
The Native Solution is designed for high-performance, high-value devices (such as smart cars, 3D printers, etc.) with strong computing and storage capabilities. This approach integrates MCP services natively into the device, allowing direct communication with EMQX using the MCP over MQTT protocol. In this solution, the MCP Client interacts directly with the MCP Server on the device through the standardized MCP over MQTT protocol, enabling end-to-end intelligent control.
For example, consider two 3D printers with the following service names:
3D-Printer/ACH301/EECF7892AB1
3D-Printer/ACH301/CAED99C2EE2
Here, 3D-Printer/ACH301/
is the device type, and EECF7892AB1
and CAED99C2EE2
are the device IDs.
The client (mobile app) first checks the current user's permissions, such as determining access only to the ACH301
model printer. It then subscribes to relevant topics to retrieve the tools (capabilities) available for the ACH301
printer, allowing the app to intelligently interact with the device.
This new intelligent IoT platform architecture is ideal for M2M (machine-to-machine) scenarios. Device manufacturers can embed a fully-featured MCP Server (including suggested prompt templates) in the devices. Once a device is procured by the IoT platform, no custom commands need to be written for each device. Instead, unified intelligent access through a client app allows for specialized division of labor:
MCP over MQTT enhances the original MCP functionality by adding the following capabilities:
In the future, integrating an MCP Server plugin into the MQTT Broker can further simplify MCP Server deployment and optimize data transmission efficiency.
The MCP over MQTT protocol is primarily designed for scenarios where MCP Servers are deployed remotely. Its architecture relies on the support of a centralized MQTT Broker. While MCP Servers deployed locally can also use MCP over MQTT, this may add complexity to the deployment process.
Currently, EMQ has completed the initial validation of the MCP over MQTT solution and built a prototype system for testing. The R&D team is now focusing on standardizing the protocol architecture and engineering implementation, with the next phase dedicated to in-depth validation and performance optimization of key technical components.
Looking ahead, this solution is set to usher in a new Agentic era for IoT. The EMQX MQTT Platform provides protocol adaptation and centralized service management, addressing data silos and fragmentation, while LLMs enable natural language understanding and reasoning to dynamically translate user intents into executable device actions. With this powerful combination, enterprises can seamlessly integrate a vast array of heterogeneous devices into an MCP-based AI ecosystem, significantly reducing the cost of upgrading legacy systems while enabling the rapid development of intelligent applications across different scenarios and systems. Powered by MCP over MQTT, IoT is evolving from simple interconnectivity to intelligent synergy, redefining the path to enterprise digital transformation.
The Most Comprehensive IoT Newsletter for Enterprises
Showcasing the highest-quality content, resources, news, and insights from the world of the Internet of Things. Subscribe to remain informed and up-to-date.
New Podcast Episode
Related Articles