ha-mcp
homeassistant-ai · homeassistant-ai/ha-mcp
MCP server này cho phép các AI assistant tương tác với Home Assistant, cho phép điều khiển các thiết bị nhà thông minh và tự động hóa bằng ngôn ngữ tự nhiên.
MCP Server Home Assistant Không chính thức và Tuyệt vời.
Xem trước
Bạn có thể làm gì với nó
- Yêu cầu AI agent của bạn tắt tất cả đèn trong phòng khách thông qua Home Assistant.
- Truy vấn trạng thái hiện tại của bộ điều nhiệt thông minh hoặc khóa cửa của bạn bằng các lệnh ngôn ngữ tự nhiên.
- Tạo hoặc sửa đổi các tự động hóa Home Assistant bằng cách mô tả hành vi mong muốn cho AI agent của bạn.
Kiểm tra an toàn
Dùng được, nhưng nên đọc ghi chú trước.
- ●Trình cài đặt tải script từ xa và chạy thẳng bằng shell.
scripts/install-linux.sh
Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.
Trích từ README
Breaking change (v7.3.0):
ha_config_set_yamlhas been moved to beta.
The Unofficial and Awesome Home Assistant MCP Server
<em>A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with Home Assistant.
Using natural language, control smart home devices, query states, execute services and manage your automations.</em>
🚀 Get Started
The recommended way to run ha-mcp is the HA-MCP Custom Component. It installs into Home Assistant through HACS, runs the full server in-process, and works on every Home Assistant installation type — Home Assistant OS, Supervised, Container, and Core — with full feature parity. It is the easiest setup in every case, with no access token to manage.
Add it to Home Assistant via HACS (the preferred install):
Quick start:
- Install the HA-MCP Custom Component from HACS — click the badge above, or in HACS open Integrations → ⋮ → Custom repositories, add
https://github.com/homeassistant-ai/ha-mcp-integration(category: Integration), then Download. - Restart Home Assistant.
- Go to Settings → Devices & Services → Add Integration, search for HA-MCP Custom Component, choose HA-MCP Server, and click Submit. Creating the entry starts the server.
- Copy the connect URL from the entry's Configure screen (Settings → Devices & Services → HA-MCP Custom Component → HA-MCP Server → Configure) — it is also printed in the Home Assistant log. A notification confirms the server started and points you there.
- Paste that URL into your AI client — done.
Connect URL. The Configure screen gives you a Home Assistant webhook URL for remote clients — https://<your-ha-domain>/api/webhook/<webhook-id> through Nabu Casa or any reverse proxy already pointed at Home Assistant (locally, http://<ha-host>:8123/api/webhook/<webhook-id>). For clients on the same network, the server is also reachable directly at http://<ha-ip>:9584/private_<random>.
- Replaces other install methods: the in-process server is a complete, standalone ha-mcp install — it takes the place of the app (add-on), Docker, and uvx/PyPI (stdio) methods. Run only one; do not run the in-process server alongside another install.
- Local only? Turn off Remote access via webhook in the entry options — no webhook is registered at all, while the direct port and sidebar panel keep working.
- Settings panel: while the server runs, an admin-only HA-MCP panel appears in the Home Assistant sidebar for managing tools, feature flags, backups, and themes.
- Optional authentication: set Webhook authentication to
ha_authto require a Home Assistant account sign-in instead of using the secret URL as the credential. - Manual install (no HACS): copy
custom_components/ha_mcp_tools/from this repository into your Home Assistantconfig/custom_components/directory, then restart and add the integration as above.
The component's second entry type, the File & YAML services entry (HA-MCP File & YAML Tools), is only needed if you enable ha-mcp's opt-in file and YAML editing tools (feature flags, off by default) — skip it otherwise; you can add it later at any time. It works with any server type (in-process, app, Docker, or stdio).
Full in-process server documentation → · Setup Wizard for client-specific config →
🏠 Home Assistant app (add-on)
Prefer to run ha-mcp as a Home Assistant app (add-on)? On Home Assistant OS and Supervised installs it is a close second — no access token to manage, and it works with Claude Desktop, Claude.ai, ChatGPT, and any other MCP client on your local network or configured for remote access.
-
Add the repository to your Home Assistant instance:
If that opens the App store without an add-repository dialog (a known Home Assistant issue), add it manually: Settings → Apps → Install app → ⋮ → Repositories, then paste
https://github.com/homeassistant-ai/ha-mcp. -
Install "Home Assistant MCP Server" from Settings → Apps → Install app and click Start. (Home Assistant 2026.2 renamed "Add-ons" to "Apps"; on older versions this is the Add-on store.)
-
Open the Logs tab to find your unique MCP URL.
-
Connect your AI client to that URL — no token or credential setup needed.
⚠️ Configure exactly one install method per client. The custom component, the app, Docker/PyPI, and local stdio are independent ways to run the same server — pick one and point your AI client at that single URL. Keeping two entries for the same server in one client (for example a local
uvx ha-mcp@latestentry withHOMEASSISTANT_URL/HOMEASSISTANT_TOKENalongside an app or component URL) is a known cause of connection hangs.
Other install methods
These run the server outside Home Assistant — useful for Container / Core installs (which can't run apps) or a separate host. The Setup Wizard generates the exact client-specific config for each.
- Docker (HTTP server): run
ghcr.io/homeassistant-ai/ha-mcpin HTTP mode, pointed at your Home Assistant URL and a long-lived token (an administrator's is recommended; non-admin tokens work with limitations), and connect your client to its secret URL. See the Setup Wizard for the full command and per-client config. - PyPI / uvx (HTTP server): run the published
ha-mcppackage withuvx ha-mcp@latest(or pip) as a streamable-HTTP server the same way. Details in the Setup Wizard. - **Local stdio