
A Model Context Protocol (MCP) server for ZigBee2MQTT that provides intelligent device discovery and control for AI assistants
概览
A Model Context Protocol (MCP) server for ZigBee2MQTT that provides intelligent device discovery and control for AI assistants. 🌐 This MCP server can run on a (e.g., where your MQTT broker runs) and you can access it from your Mac via HTTP. See for details! - : Container runs on your Mac, accessed via stdio - : Container runs on server, accessed via HTTP → This MCP server connects to your MQTT broker and automatically analyzes all ZigBee devices connected via ZigBee2MQTT. It learns the structure and capabilities of each device and makes this information available to AI assistants through MCP tools.
README
以下为原文 README 节选,完整内容请查看原文。
ZigBee2MQTT MCP Server
A Model Context Protocol (MCP) server for ZigBee2MQTT that provides intelligent device discovery and control for AI assistants.
🌐 Remote-Capable! This MCP server can run on a remote server (e.g., where your MQTT broker runs) and you can access it from your Mac via HTTP. See REMOTE-SETUP.md for details!
Deployment Options
- Local (stdio): Container runs on your Mac, accessed via stdio
- Remote (HTTP/SSE): Container runs on server, accessed via HTTP → REMOTE-SETUP.md
Overview
This MCP server connects to your MQTT broker and automatically analyzes all ZigBee devices connected via ZigBee2MQTT. It learns the structure and capabilities of each device and makes this information available to AI assistants through MCP tools.
Core Features
- 🔍 Intelligent Schema Discovery: Automatically learns the structure and capabilities of your devices
- 💾 Compact Data Storage: Stores only metadata and schemas, not complete message history
- 📚 Zigbee2MQTT Documentation: Direct access to official device documentation
- 🐳 Docker-Ready: Easy deployment with Docker Compose
- 🌐 Remote-Capable: Runs on server, access via HTTP/SSE from anywhere
- 🔒 Security: Optional API key authentication
- 🔌 Retained Messages: Uses MQTT retained messages for instant access to device information
- 🏠 Home Automation: Perfect for n8n, Home Assistant and other automation tools
What is Stored?
✅ Device Metadata (Name, model, manufacturer) ✅ Field Schemas (Which fields does a device have? What data types?) ✅ Capabilities (Can dim, change color, measure temperature, etc.) ✅ Current State (Only last value, no history)
❌ Not Stored: Complete message history, time-based sensor data
Estimated Database Size: ~1-2 MB for 100 devices (instead of GB with full history!)
Prerequisites
- Node.js 20+ or Docker
- Running ZigBee2MQTT installation
- MQTT Broker (e.g., Mosquitto)
Installation
Option 1: Docker (Recommended)
-
Clone repository
git clone cd zigbeeMCP -
Create environment file
cp .env.example .env -
Configure .env
MQTT_BROKER_URL=mqtt://192.168.1.100:1883 MQTT_USERNAME=your_user MQTT_PASSWORD=your_password MQTT_BASE_TOPIC=zigbee2mqtt DB_PATH=/data/zigbee2mqtt.db # Log Level: debug, info, warn, error, silent # Recommended: error (minimal output) LOG_LEVEL=error -
Start container
docker compose up -d -
View logs
docker compose logs -f
Option 2: Local Installation
-
Install dependencies
npm install -
Compile TypeScript
npm run build -
Start
npm start
MCP Configuration
Claude Desktop
安装
docker exec -i zigbee2mqtt-mcp node dist/index.js配置
{
"mcpServers": {
"zigbee2mqtt": {
"command": "docker",
"args": [
"exec",
"-i",
"zigbee2mqtt-mcp",
"node",
"dist/index.js"
]
}
}
}