homeassistant-ai / ha-mcp
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Breaking change (v7.3.0): ha_config_set_yaml has been moved to beta. HA-MCP — Manage Home Assistant with AI Configure and automate Home Assistant with Claude, ChatGPT, and other AI assistants. 🚀 Get Started The recommended way to run ha-mcp is the HA-MCP integration. It installs into Home Assistant through HACS (the built-in Marketplace on Home Assistant 2026.11+), 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: setup asks for an administrator access token and how clients may connect. Add it to Home Assistant via HACS or, on Home Assistant 2026.11+, the Marketplace (the preferred install):
重大变更 (v7.3.0):ha_config_set_yaml 已移至测试版。HA-MCP — 使用 AI 管理 Home Assistant,通过 Claude、ChatGPT 和其他 AI 助手配置并自动化 Home Assistant。🚀 开始使用:运行 ha-mcp 的推荐方式是使用 HA-MCP 集成。它通过 HACS(Home Assistant 2026.11+ 版本中的内置市场)安装到 Home Assistant 中,在进程内运行完整服务器,并适用于所有 Home Assistant 安装类型(Home Assistant OS、Supervised、Container 和 Core),且功能完全一致。这是最简单的设置方式:设置过程会要求提供管理员访问令牌以及客户端的连接方式。通过 HACS 或在 Home Assistant 2026.11+ 版本中通过市场(首选安装方式)将其添加到 Home Assistant。
Quick start: The setup below is for version 9.0.0 (October 28, 2026) and later; earlier versions show a shorter setup form without the administrator account step. Install the HA-MCP integration (requires Home Assistant 2026.8.0 or newer; see compatibility details). On Home Assistant 2026.8–2026.10, open HACS, search for HA-MCP, then Download. On Home Assistant 2026.11 or newer, open Settings → Marketplace, accept its first-run warning, and search for HA-MCP, then Install. HA-MCP is in the default catalog, so installing it and receiving its updates do not require connecting GitHub or adding a custom repository. The badge above also opens its catalog page. Already installed from the earlier homeassistant-ai/ha-mcp-integration repository? It keeps receiving the same releases. On the Marketplace, keep GitHub connected for its background checks on that custom repository. Older installed releases may still appear as HA-MCP Custom Component; searching for HA-MCP matches both names. Restart Home Assistant.
快速入门:以下设置适用于 9.0.0 版本(2026 年 10 月 28 日)及更高版本;早期版本显示的设置表单较短,不包含管理员账户步骤。安装 HA-MCP 集成(需要 Home Assistant 2026.8.0 或更新版本;请参阅兼容性详情)。在 Home Assistant 2026.8–2026.10 版本上,打开 HACS,搜索 HA-MCP,然后下载。在 Home Assistant 2026.11 或更新版本上,打开“设置”→“市场”,接受首次运行警告,搜索 HA-MCP,然后安装。HA-MCP 位于默认目录中,因此安装和接收更新无需连接 GitHub 或添加自定义存储库。上方的徽章也会打开其目录页面。如果已经从早期的 homeassistant-ai/ha-mcp-integration 存储库安装过?它会继续接收相同的版本更新。在市场上,请保持 GitHub 连接,以便对该自定义存储库进行后台检查。旧的已安装版本可能仍显示为“HA-MCP Custom Component”;搜索 HA-MCP 可匹配这两个名称。重启 Home Assistant。
Decide which administrator account the server acts as. Either create a long-lived access token on your own account (your profile → Security → Long-lived access tokens → Create token; it works from anywhere if it leaks, and the server’s changes show under your name), or, safer, create an account just for HA-MCP under Settings → People → Add person with Allow login, Local access only and Administrator on. Never use your own login for the second option. Go to Settings → Devices & Services → Add Integration, search for HA-MCP and choose HA-MCP Server. Paste your token, or enter the user name and password of the account you made for HA-MCP (HA-MCP creates its token), pick how clients may connect — Remote access through Home Assistant (start with Secret URL, the simplest; Home Assistant sign-in adds a login) and/or Network access: Local network — then click Submit. Both start disabled, so a client on another device needs one of them. Copy the connect URL from the entry’s Configure screen (Settings → Devices & Services → “HA-MCP — Manage Home Assistant with AI” → HA-MCP Server → Configure). A notification confirms the server started and points you there. Paste that URL into your AI client — done.
确定服务器将以哪个管理员账户身份运行。您可以为自己的账户创建一个长期访问令牌(个人资料 → 安全 → 长期访问令牌 → 创建令牌;如果泄露,它可以在任何地方使用,且服务器的更改将显示在您的名下),或者更安全地,在“设置”→“人员”→“添加人员”下专门为 HA-MCP 创建一个账户,并开启“允许登录”、“仅限本地访问”和“管理员”权限。第二种选项切勿使用您自己的登录信息。前往“设置”→“设备与服务”→“添加集成”,搜索 HA-MCP 并选择“HA-MCP Server”。粘贴您的令牌,或输入您为 HA-MCP 创建的账户的用户名和密码(HA-MCP 会自动创建其令牌),选择客户端的连接方式——通过 Home Assistant 进行远程访问(从 Secret URL 开始,这是最简单的方式;Home Assistant 登录会增加一层验证)和/或网络访问:本地网络——然后点击提交。两者默认均为禁用状态,因此其他设备上的客户端需要启用其中之一。从条目的“配置”屏幕(设置 → 设备与服务 → “HA-MCP — Manage Home Assistant with AI” → HA-MCP Server → 配置)复制连接 URL。通知会确认服务器已启动并引导您前往该处。将该 URL 粘贴到您的 AI 客户端中——完成。
Connect URL. The Configure screen gives you a Home Assistant webhook URL for remote clients — https://
连接 URL。“配置”屏幕为您提供了一个用于远程客户端的 Home Assistant Webhook URL — https://
Manual install (no HACS or Marketplace): copy custom_components/ha_mcp_tools/ from this repository into your Home Assistant config/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. Full app documentation → ⚠️ 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@latest entry with HOMEASSISTANT_URL / HOMEASSIS
手动安装(无 HACS 或市场):将此存储库中的 custom_components/ha_mcp_tools/ 复制到您的 Home Assistant config/custom_components/ 目录中,然后重启并按上述方法添加集成。该组件的第二个条目类型,即文件与 YAML 服务条目(HA-MCP File & YAML Tools),仅在您启用 ha-mcp 的可选文件和 YAML 编辑工具(功能标志,默认关闭)时才需要——否则请跳过;您可以随时添加。它适用于任何服务器类型(进程内、应用程序、Docker 或 stdio)。完整的进程内服务器文档 → · 针对特定客户端配置的设置向导 → 🏠 Home Assistant 应用程序(插件)。更喜欢将 ha-mcp 作为 Home Assistant 应用程序(插件)运行?在 Home Assistant OS 和 Supervised 安装中,这是第二好的选择——无需管理访问令牌,并且它适用于 Claude Desktop、Claude.ai、ChatGPT 以及您本地网络上或配置为远程访问的任何其他 MCP 客户端。将存储库添加到您的 Home Assistant 实例:如果打开应用商店时没有出现添加存储库的对话框(这是 Home Assistant 的已知问题),请手动添加:设置 → 应用程序 → 安装应用程序 → ⋮ → 存储库,然后粘贴 https://github.com/homeassistant-ai/ha-mcp。从“设置”→“应用程序”→“安装应用程序”中安装“Home Assistant MCP Server”并点击启动。(Home Assistant 2026.2 将“Add-ons”重命名为“Apps”;在旧版本中,这是“Add-on store”。)打开“日志”选项卡以找到您唯一的 MCP URL。将您的 AI 客户端连接到该 URL——无需设置令牌或凭据。完整的应用程序文档 → ⚠️ 每个客户端仅配置一种安装方法。自定义组件、应用程序、Docker/PyPI 和本地 stdio 是运行同一服务器的独立方式——选择一种并将您的 AI 客户端指向该单一 URL。在同一个客户端中保留同一服务器的两个条目(例如,一个带有 HOMEASSISTANT_URL / HOMEASSIS 的本地 uvx ha-mcp@latest 条目)。