Логотип Xiaozhi MCP Ha

Xiaozhi MCP Ha

Сообщество
mac8005

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

Издательmac8005
Репозиторийxiaozhi-mcp-ha
ЯзыкPython
Форки
23
Звёзды
112
Доступные инструменты
0
Тип транспортаstdio
ЛицензияMIT
Ссылки
  • Подключайте инструменты к рабочим процессам с ИИ

    Xiaozhi MCP Ha предоставляет возможности MCP, доступные совместимым ИИ-клиентам и агентам.

  • Доступные инструменты: 0

    Ниже представлены доступные для вызова действия с названиями и описаниями, если сервер их предоставляет.

  • Готовая конфигурация для копирования

    Используйте примеры конфигурации, чтобы настроить этот сервер в MCP-клиенте на ваш выбор.

  • Показатели интереса к открытому проекту

    В указанном репозитории: звёзды — 112, форки — 23.

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 с разными моделями ИИ

TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому после подключения Xiaozhi MCP Ha вы можете использовать их с разными моделями ИИ в TypingMind, не настраивая подключение отдельно для каждой модели. Эта интеграция MCP работает локально на вашем устройстве через коннектор MCP TypingMind.

Руководство по настройке локального коннектора

Выберите этот способ, если серверу MCP нужен доступ к локальным файлам, приложениям или закрытым ресурсам на вашем компьютере.

1

Откройте настройки MCP

В TypingMind откройте «Настройки», затем «Расширенные настройки», перейдите в раздел «Протокол контекста модели» и выберите «Настроить коннектор».

  1. Откройте TypingMind в браузере.
  2. Нажмите значок настроек.
  3. Перейдите в «Расширенные настройки».
  4. Откройте раздел «Протокол контекста модели».
  5. Нажмите «Настроить коннектор» и выберите «Это устройство».
Экран настройки коннектора MCP в TypingMind с выбранным вариантом «Это устройство»
2

Выполните команду запуска коннектора

Выберите «Это устройство», скопируйте команду из TypingMind и выполните её в терминале. Не останавливайте процесс, пока используете MCP.

  1. Скопируйте команду настройки, показанную в TypingMind.
  2. Откройте «Терминал» в macOS или Windows Terminal в Windows.
  3. Вставьте и выполните команду.
  4. Если в терминале появится запрос на подтверждение, подтвердите установку пакета.
  5. Не закрывайте окно терминала и не останавливайте процесс, пока используете инструменты MCP.
3

Добавьте сервер Xiaozhi MCP Ha

Когда статус коннектора сменится на «Готов», нажмите «Изменить серверы» и вставьте конфигурацию сервера MCP.

  1. Дождитесь, пока статус коннектора сменится на «Готов».
  2. Нажмите «Изменить серверы».
  3. Вставьте конфигурацию сервера MCP Xiaozhi MCP Ha.
  4. Сохраните список серверов.
  5. Обновите статус, если хотите убедиться, что коннектор по-прежнему готов к работе.
Настройки MCP в TypingMind с активным сервером и кнопкой «Изменить серверы»
{
  "mcpServers": {
    "xiaozhi-mcp-ha": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Используйте подключение с разными моделями

Сохраните список серверов, откройте раздел «Плагины», включите инструменты MCP для Xiaozhi MCP Ha, затем выберите любую поддерживаемую модель ИИ в TypingMind и используйте инструменты в чате или назначьте их ИИ-агенту.

  1. Откройте страницу «Плагины» в TypingMind.
  2. Включите инструменты MCP для Xiaozhi MCP Ha.
  3. Начните чат и выберите модель ИИ, которую хотите использовать.
  4. Используйте инструменты MCP в чате или назначьте их ИИ-агенту.
  5. При необходимости переключайтесь на другую модель ИИ без повторного подключения MCP.
Чат TypingMind с включёнными инструментами MCP и выбранной ИИ-моделью
Можете использовать Xiaozhi MCP Ha, чтобы помочь мне с этой задачей?
Xiaozhi MCP Ha
Конечно. Я всё прочитал.
Вот что я нашёл с помощью Xiaozhi MCP Ha.

Часто задаваемые вопросы

Для чего используется сервер MCP Xiaozhi MCP Ha?

Xiaozhi MCP Ha — это сервер MCP, который позволяет совместимым ИИ-клиентам подключаться к внешним инструментам и получать контекст. В TypingMind достаточно один раз добавить этот сервер MCP, чтобы его инструменты стали доступны в вашем рабочем пространстве с ИИ.

Можно ли использовать сервер MCP Xiaozhi MCP Ha с несколькими ИИ-моделями в TypingMind?

Да. TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому вы можете использовать Xiaozhi MCP Ha с разными ИИ-моделями, например Claude, ChatGPT, Gemini или другими моделями, настроенными в TypingMind, без отдельной настройки сервера MCP для каждой модели.

Зачем использовать сервер MCP Xiaozhi MCP Ha с TypingMind?

TypingMind — один из лучших интерфейсов для чата с LLM: он объединяет разные ИИ-модели, промпты, плагины, ИИ-агентов, ключи API и инструменты MCP в одном рабочем пространстве. Подключив Xiaozhi MCP Ha, вы сможете использовать его инструменты MCP с моделями, которые предпочитаете, и поддерживать порядок в чатах TypingMind.

Как подключить сервер MCP Xiaozhi MCP Ha к TypingMind?

Xiaozhi MCP Ha работает через локальный коннектор MCP TypingMind. Этот вариант лучше всего подходит, когда серверу MCP нужен доступ к локальным файлам, настольным приложениям, инструментам командной строки или закрытым ресурсам на вашем компьютере.

Какие инструменты предоставляет сервер MCP Xiaozhi MCP Ha в TypingMind?

Xiaozhi MCP Ha предоставляет возможности MCP, которые можно включить на странице «Плагины» в TypingMind и использовать в чате или назначить ИИ-агентам.

Нужно ли передавать TypingMind свои ключи API для использования сервера MCP Xiaozhi MCP Ha?

Нет. TypingMind ориентирован прежде всего на локальную работу и позволяет вам контролировать выбор провайдеров моделей, ключи API, промпты и конфигурацию MCP. Если Xiaozhi MCP Ha требует аутентификации, при создании подключения добавьте необходимые заголовки, настройки OAuth или локальную конфигурацию для этого сервера MCP.

Похожие MCP-серверы

Все

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇