AIoT MCP Server
A Model Context Protocol server for AI agents to discover and control IoT devices through MQTT, using the AIoT Agent Network Protocol for device registration and communication.
README
AIoT MCP Server
Artificial intelligence Internet of Things (AIoT) is a new paradigm of IoT. It is a combination of artificial intelligence and IoT.
MQTT is particularly well-suited for AIoT networks for several key reasons:
- Its publish/subscribe pattern allows for flexible, decoupled communication between AI agents and IoT devices
- The lightweight protocol minimizes network overhead, perfect for resource-constrained IoT devices
- Topic-based hierarchical structure enables natural organization of device groups and capabilities
- Retained messages maintain device state, allowing AI agents to quickly understand system context
- Last Will and Testament (LWT) feature helps detect offline devices automatically
This repo demonstrates a MCP server which fetches device context from MQTT broker for MCP client to use.
AIoT Agent Network Protocol
Agents MUST use the following MQTT topic convention:
$ai/{DOMAIN}/{GROUP}/d/{DEVICE_ID}: Topic pattern for device registration and discovery$ai/{DOMAIN}/{GROUP}/r/{RULE_ID}: Topic pattern for rule registration and discovery
Agents MUST register clients or rules as retained messages on the corresponding topics. Agents MUST use readable text to describe the device or rule. Agents MAY use natural language to describe the device or rule.
This is ALL.
<img width="736" alt="image" src="https://github.com/user-attachments/assets/8f42b23a-d1ae-4aa0-9486-a79c00efda73" />
Prompt
The assistant's prompt is defined in assistant-prompt.md. This file contains the instructions and capabilities given to the AI assistant for interacting with IoT devices through MQTT.
Tools
Discover
Discovers devices and rules in a group using MQTT topic filter. When querying the status of a group, provide the device GROUP as the argument.
Example request:
{
"group": "room1"
}
Example response:
[
{
"topic": "$ai/room1/123",
"message": "I am a temperature sensor..., I publish ... to topic room1/123/status"
},
{
"topic": "$ai/room1/456",
"message": "I am an air conditioner..., I subscribe to topic room1/456/command, expect payload to be on/off"
}
]
Publish
Publishes a message to a device using MQTT topic and payload.
Example request:
{
"topic": "room1/456/command",
"payload": "on",
"qos": 0,
"retain": false
}
Query
Queries a specific topic for its current state.
Example request:
{
"topic": "room1/123/status"
}
Configuration
The server can be configured using environment variables:
MQTT_BROKER_URL: MQTT broker URL (default: mqtt://127.0.0.1:1883)MQTT_USERNAME: MQTT username (optional)MQTT_PASSWORD: MQTT password (optional)
Running The Server
Claude Desktop configuration:
{
"mcpServers": {
"aiot": {
"command": "npx",
"args": [ "tsx", "/path/to/this/repo/src/index.ts" ]
}
}
}
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.