# Home Assistant MCP — Control Home Assistant from Agents > Home Assistant MCP exposes smart-home actions as MCP tools so agents can query state and trigger automations via a controlled, auditable interface. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. Install / run: ```bash git clone https://github.com/homeassistant-ai/ha-mcp && cd ha-mcp ``` 2. Start / smoke test: ```bash sed -n '1,260p' README.md ``` 3. Verify: - Start the server as documented, then from your MCP client call one read-only tool (e.g., list entities) before you enable any write actions. ## Intro Home Assistant MCP exposes smart-home actions as MCP tools so agents can query state and trigger automations via a controlled, auditable interface. - **Best for:** Home Assistant users who want agent-driven status checks and automations without giving the agent full UI access - **Works with:** An MCP-capable agent client + a Home Assistant instance (credentials per repo docs) - **Setup time:** 20 minutes ## Practical Notes - Setup time ~20 minutes (credentials + run server + connect client) - Safety check: keep write actions disabled until read-only calls are stable - GitHub stars + forks (verified): see Source & Thanks Treat smart-home tool calls like production ops. Define ‘safe defaults’ (read-only), then add a small set of allowed writes with guardrails. If your agent can’t explain why it’s turning something on, it shouldn’t be allowed to do it. ### FAQ **Q: Can I let an agent control everything?** A: You can, but start with read-only tools and explicitly whitelist safe actions. **Q: How do I prevent accidental triggers?** A: Require confirmations for writes, and add rate limits / time windows for automations. **Q: Is this better than UI automation?** A: Yes for reliability: tool calls are structured and auditable, unlike fragile UI clicks. ## Source & Thanks > Source: https://github.com/homeassistant-ai/ha-mcp > License: MIT > GitHub stars: 2,807 · forks: 114 --- ## 快速使用 1. 安装 / 运行: ```bash git clone https://github.com/homeassistant-ai/ha-mcp && cd ha-mcp ``` 2. 启动 / 冒烟测试: ```bash sed -n '1,260p' README.md ``` 3. 验证: - 按文档启动 server 后,先从 MCP 客户端调用一个只读工具(如列出实体),确认无误再开启写入类动作。 ## 简介 Home Assistant MCP 把智能家居的“查询状态/触发自动化”能力封装成 MCP 工具,让 agent 以最小权限、可审计的方式调用,并把家庭控制从 UI 自动化升级为结构化工具调用。 - **适合谁:** Home Assistant 用户:想让 agent 做状态查询/触发自动化,但不想开放完整 UI 权限 - **可搭配:** 支持 MCP 的客户端 + Home Assistant 实例(凭证配置以仓库文档为准) - **准备时间:** 20 分钟 ## 实战建议 - 上手约 20 分钟(配置凭证 + 启动 server + 连接客户端) - 安全验收:只读调用稳定前,不要开放写入类动作 - GitHub stars + forks(已核验):见「来源与感谢」 把智能家居的工具调用当成“生产运维”来做:默认只读,再加少量可写动作并设置护栏。如果 agent 不能清楚解释为何要开灯/开空调,那它就不该被允许这么做。 ### FAQ **能让 agent 控制一切吗?** A: 技术上可以,但建议先只读,再按白名单逐步开放安全动作。 **如何避免误触发?** A: 写入类动作要求二次确认,并加上频控与时间窗口限制。 **比 UI 自动化更好吗?** A: 在可靠性上更好:工具调用结构化、可审计,不像 UI 点击那么脆弱。 ## 来源与感谢 > Source: https://github.com/homeassistant-ai/ha-mcp > License: MIT > GitHub stars: 2,807 · forks: 114 --- Source: https://tokrepo.com/en/workflows/home-assistant-mcp-control-home-assistant-from-agents Author: MCP Hub