Logo vun Xiaozhi MCP Ha

Xiaozhi MCP Ha

Communautéit
mac8005

A Home Assistant Custom Integration (HACS) that connects Xiaozhi ESP32 AI chatbot to Home Assistant via MCP

Editeurmac8005
Repositoryxiaozhi-mcp-ha
SproochPython
Forks
23
Stären
112
Disponibel Tools
0
Transporttypstdio
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    Xiaozhi MCP Ha stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    112 Stären an 23 Forks aus dem verlinkte Repository.

Xiaozhi MCP Integration for Home Assistant

GitHub Release GitHub Activity License HACS BuyMeCoffee

A Home Assistant Custom Integration (HACS) that connects Xiaozhi ESP32 AI chatbot to Home Assistant via MCP (Model Context Protocol).

Features

  • 🤖 Connect Xiaozhi ESP32 devices to Home Assistant
  • 🔌 Legacy HTTP/SSE MCP (Model Context Protocol) support for AI-powered home automation
  • 🏠 Control Home Assistant entities through natural language
  • 🔒 Secure authentication with long-lived access tokens
  • 🔄 Automatic reconnection with exponential backoff
  • 📊 Real-time status monitoring and logging
  • 🛠️ Easy configuration through Home Assistant UI
  • 🌐 TLS-verified WebSocket and HTTP/SSE endpoints

What is Xiaozhi?

Xiaozhi is an open-source ESP32-based AI chatbot that uses voice interaction and MCP protocol to control various smart home devices and services. It supports multiple ESP32 platforms and can integrate with various AI models like Qwen and DeepSeek.

  • All-in-one hardware: ESP32-S3 (16 MB flash / 8 MB PSRAM), digital mic, speaker with class-D amp and 1.28–1.85″ colour LCD.
  • Local wake word + cloud intelligence: an offline wake-word engine runs on the device; after activation audio is sent to Xiaozhi’s servers where ASR, LLM reasoning (Qwen, DeepSeek, Doubao …), and TTS are performed.
  • Voice-only Home-Assistant control: this HACS integration connects the device to Home Assistant MCP, letting you toggle lights, scenes and more entirely by voice.
  • Many shapes, same guts: boards are sold as square dev-kits, cubes, pucks and the cute “Astronaut Ball” shown above – all share the same firmware stack.
  • Ultra-low cost: the Astronaut Ball costs ≈ USD 19 – cheaper than most bare ESP32 kits. AliExpress product page

Security and upgrading

Read SECURITY.md and the changelog before upgrading. The trusted Xiaozhi service can call exposed Home Assistant tools and receive their results. Version 0.0.26 requires TLS outside loopback and no longer logs message payloads or endpoint URLs. Existing LAN plaintext URLs need migration.

Requirements

  • Home Assistant 2025.3.0 or later
  • HACS (Home Assistant Community Store)
  • Home Assistant MCP Server Integration (must be installed first)
  • Xiaozhi ESP32 device or compatible hardware
  • Active internet connection for MCP communication

Installation

Prerequisites: Install Home Assistant MCP Server

Before installing this integration, you must install the official Home Assistant MCP Server integration:

Open your Home Assistant instance and start setting up a new integration.

  1. Go to Settings > Devices & Services > Add Integration
  2. Search for "Model Context Protocol Server" (or "MCP Server")
  3. Install and configure the MCP Server integration
  4. The MCP server will run locally within your Home Assistant instance at http://localhost:8123/mcp_server/sse
  5. Make sure to configure entity exposure in the MCP Server settings

HACS Installation (Recommended)

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  1. Open HACS in Home Assistant
  2. Click on "Integrations"
  3. Click the three dots in the top right corner
  4. Select "Custom repositories"
  5. Add this repository URL: https://github.com/mac8005/xiaozhi-mcp-ha
  6. Set category to "Integration"
  7. Click "Add"
  8. Search for "Xiaozhi MCP" and install
  9. Restart Home Assistant

Manual Installation

  1. Download the xiaozhi_mcp folder from this repository
  2. Copy it to config/custom_components/xiaozhi_mcp/ in your Home Assistant installation
  3. Restart Home Assistant

Configuration

Step 1: Create Long-Lived Access Token

  1. Go to your Home Assistant Profile: Settings > People > Users > Click on your user
  2. Scroll down to "Long-lived access tokens"
  3. Click "Create Token"
  4. Give it a name like "Xiaozhi MCP"
  5. Copy the token (you won't see it again!)

Step 2: Get Xiaozhi MCP Endpoint

  1. Visit xiaozhi.me and create an account
  2. Go to the MCP section in your dashboard
  3. Copy your MCP endpoint URL

Step 3: Configure Integration

Open your Home Assistant instance and start setting up a new integration.

  1. Go to Settings > Devices & Services > Add Integration
  2. Search for "Xiaozhi MCP"
  3. Enter your configuration:
    • Name: Friendly name for the integration
    • Xiaozhi MCP Endpoint: The complete URL copied from Xiaozhi, including ?token=... (for example wss://api.xiaozhi.me/mcp/?token=YOUR_XIAOZHI_TOKEN)
    • Home Assistant Long-Lived Access Token: The separate token created in your Home Assistant profile. Do not put the Xiaozhi token here.
    • Scan Interval: How often to check connection status (default: 30 seconds)
    • Enable Logging: Enable detailed logging for debugging

How It Works

This integration acts as a bridge/proxy between your Xiaozhi ESP32 device and the official Home Assistant MCP Server:

  1. Xiaozhi ESP32 connects to the Xiaozhi cloud service
  2. Xiaozhi cloud sends MCP requests to this integration via WebSocket
  3. This integration forwards the MCP requests to the local Home Assistant MCP Server via Server-Sent Events (SSE)
  4. Home Assistant MCP Server (at http://localhost:8123/mcp_server/sse) processes the requests and controls your Home Assistant entities
  5. Responses are sent back through the same chain
text
[Xiaozhi ESP32] ←→ [Xiaozhi Cloud] ←→ [This Integration] ←→ [HA MCP Server] ←→ [Home Assistant]
                                         (MCP Proxy)      (SSE: /mcp_server/sse)

Key Architecture Points:

  • ✅ No MCP Server Reimplementation: This integration does NOT implement its own MCP server
  • ✅ Uses Official MCP Server: All MCP functionality is provided by the official Home Assistant MCP Server integration
  • ✅ Acts as SSE Proxy: This integration forwards MCP messages to the official MCP server via Server-Sent Events
  • ✅ Authenticated MCP Communication: The configured MCP server receives the Home Assistant token; use loopback locally or valid TLS remotely
  • ✅ No External URLs Required: No need to expose your Home Assistant instance to the internet

Usage

Once configured, your Xiaozhi device can:

  • Control lights: "Turn on the living room lights"
  • Check sensors: "What's the temperature in the bedroom?"
  • Control climate: "Set the thermostat to 72 degrees"
  • Run automations: "Activate movie mode"
  • Get device status: "Is the front door locked?"

Configuration Options

OptionDescriptionRequiredDefault
nameFriendly name for the integrationYes-
xiaozhi_endpointXiaozhi MCP endpoint URLYes-
access_tokenLong-lived access tokenYes-
scan_intervalStatus check interval (seconds)No30
enable_loggingEnable detailed loggingNoFalse

Troubleshooting

Important Notes

  • Critical Dependency: This integration requires the official Home Assistant MCP Server integration to be installed and running
  • No MCP Server Reimplementation: This integration does NOT implement its own MCP server - it only acts as a proxy
  • SSE Communication: Uses Server-Sent Events to communicate with the MCP Server at http://localhost:8123/mcp_server/sse
  • Entity Exposure: Make sure to expose the entities you want to control via the MCP Server settings in Home Assistant
  • MCP Communication: Use loopback locally or valid TLS remotely
  • No External URLs: No need to configure external Home Assistant URLs or expose your instance to the internet

Setup connection errors

There are two authenticated connections. The Xiaozhi credential stays in the full WebSocket URL; the dedicated token field belongs to Home Assistant. Version 0.0.27 identifies which connection failed.

For MCP server failures, confirm that the official MCP Server integration is configured. http://localhost:8123/mcp_server/sse works only if HA actually listens there over HTTP. If HA serves HTTPS directly, use its matching trusted HTTPS hostname; verify that Home Assistant itself can resolve it. A reverse proxy and the internal HA listener can use different schemes/ports. Do not disable TLS verification or expose HA publicly to fix local connectivity.

Debug Logging

Enable debug logging by adding to configuration.yaml:

yaml
logger:
  default: info
  logs:
    custom_components.xiaozhi_mcp: debug

Support

☕ Support Development

If this project helps you, consider supporting its development! Your support helps maintain and improve this integration.

All donations are appreciated and help keep this project active! 🙏

Contributing

Contributions are welcome! Please read the Contributing Guide for details on how to contribute to this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Thanks to 78/xiaozhi-esp32 for the original Xiaozhi project
  • Thanks to the Home Assistant community for the excellent platform

Related Projects


Xiaozhi MCP Ha MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal Xiaozhi MCP Ha verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

Xiaozhi MCP Ha als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu Xiaozhi MCP Ha an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "xiaozhi-mcp-ha": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu Xiaozhi MCP Ha. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu Xiaozhi MCP Ha.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat Xiaozhi MCP Ha?
Xiaozhi MCP Ha
Jo. Ech hunn et gelies.
Dat hunn ech mat Xiaozhi MCP Ha fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server Xiaozhi MCP Ha benotzt?

Xiaozhi MCP Ha ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech Xiaozhi MCP Ha MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir Xiaozhi MCP Ha mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat Xiaozhi MCP Ha MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann Xiaozhi MCP Ha verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech Xiaozhi MCP Ha MCP mat TypingMind?

Xiaozhi MCP Ha leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt Xiaozhi MCP Ha MCP an TypingMind zur Verfügung?

Xiaozhi MCP Ha stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir Xiaozhi MCP Ha MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann Xiaozhi MCP Ha eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇