IM

ichbinder/mcp2zigbee2mqtt

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

12 stars 9 forks 质量 65 趋势 19MIT

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

  1. Clone repository

    git clone 
    cd zigbeeMCP
    
  2. Create environment file

    cp .env.example .env
    
  3. 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
    
  4. Start container

    docker compose up -d
    
  5. View logs

    docker compose logs -f
    

Option 2: Local Installation

  1. Install dependencies

    npm install
    
  2. Compile TypeScript

    npm run build
    
  3. Start

    npm start
    

MCP Configuration

Claude Desktop

在 GitHub 查看完整 README

安装

docker exec -i zigbee2mqtt-mcp node dist/index.js
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "zigbee2mqtt": { "command": "docker", "args": [ "exec", "-i", "zigbee2mqtt-mcp", "node", "dist/index.js" ] } } }