io.github.homeassistant-ai/ha-mcp

AI 与智能体编辑精选

by homeassistant-ai

io.github.homeassistant-ai/ha-mcp 是让 AI 助手直接控制你的 Home Assistant 智能家居的 MCP 服务器。

这个服务器解决了智能家居自动化中需要手动配置的痛点,最适合那些想用 Claude 或类似 AI 来语音或文本控制灯光、温度等设备的开发者。不过,由于它依赖 Home Assistant 的 API 稳定性,在复杂场景下可能需要额外调试。

3.0kGitHub

什么是 io.github.homeassistant-ai/ha-mcp

io.github.homeassistant-ai/ha-mcp 是让 AI 助手直接控制你的 Home Assistant 智能家居的 MCP 服务器。

README

Breaking change (v7.3.0): ha_config_set_yaml has been moved to beta.

<div align="center"> <img src="docs/img/ha-mcp-logo.png" alt="Home Assistant MCP Server Logo" width="300"/>

The Unofficial and Awesome Home Assistant MCP Server

<!-- mcp-name: io.github.homeassistant-ai/ha-mcp --> <p align="center"> <img src="https://img.shields.io/badge/tools-89-blue" alt="95+ Tools"> <a href="https://github.com/homeassistant-ai/ha-mcp/releases"><img src="https://img.shields.io/github/v/release/homeassistant-ai/ha-mcp" alt="Release"></a> <a href="https://github.com/homeassistant-ai/ha-mcp/actions/workflows/e2e-tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/homeassistant-ai/ha-mcp/e2e-tests.yml?branch=master&label=E2E%20Tests" alt="E2E Tests"></a> <a href="LICENSE.md"><img src="https://img.shields.io/github/license/homeassistant-ai/ha-mcp.svg" alt="License"></a> <br> <a href="https://github.com/homeassistant-ai/ha-mcp/commits/master"><img src="https://img.shields.io/github/commit-activity/m/homeassistant-ai/ha-mcp.svg" alt="Activity"></a> <a href="https://github.com/jlowin/fastmcp"><img src="https://img.shields.io/badge/Built%20with-FastMCP-purple" alt="Built with FastMCP"></a> <img src="https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fhomeassistant-ai%2Fha-mcp%2Fmaster%2Fpyproject.toml" alt="Python Version"> <a href="https://github.com/sponsors/julienld"><img src="https://img.shields.io/badge/GitHub_Sponsors-☕-blueviolet" alt="GitHub Sponsors"></a> <a href="https://homeassistant-ai.github.io/ha-mcp/"><img src="https://img.shields.io/badge/Website-docs-teal" alt="Website"></a> </p> <p align="center"> <em>A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with Home Assistant.<br> Using natural language, control smart home devices, query states, execute services and manage your automations.</em> </p> </div>

Demo with Claude Desktop


🚀 Get Started

Full guide to get you started with Claude Desktop (~10 min)

No paid subscription required. Click on your operating system:

<p> <a href="https://homeassistant-ai.github.io/ha-mcp/guide-macos/"><img src="https://img.shields.io/badge/Setup_Guide_for_macOS-000000?style=for-the-badge&logo=apple&logoColor=white" alt="Setup Guide for macOS" height="120"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://homeassistant-ai.github.io/ha-mcp/guide-windows/"><img src="https://img.shields.io/badge/Setup_Guide_for_Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white" alt="Setup Guide for Windows" height="120"></a> </p>

Quick install (~5 min)

<details> <summary><b>🍎 macOS</b></summary>
  1. Go to claude.ai and sign in (or create a free account)
  2. Open Terminal and run:
    sh
    curl -LsSf https://raw.githubusercontent.com/homeassistant-ai/ha-mcp/master/scripts/install-macos.sh | sh
    
  3. Download Claude Desktop (or restart: Claude menu → Quit)
  4. Ask Claude: "Can you see my Home Assistant?"

You're now connected to the demo environment! Connect your own Home Assistant →

</details> <details> <summary><b>🪟 Windows</b></summary>
  1. Go to claude.ai and sign in (or create a free account)
  2. Open Windows PowerShell (from Start menu) and run:
    powershell
    irm https://raw.githubusercontent.com/homeassistant-ai/ha-mcp/master/scripts/install-windows.ps1 | iex
    
  3. Download Claude Desktop (or restart: File → Exit)
  4. Ask Claude: "Can you see my Home Assistant?"

You're now connected to the demo environment! Connect your own Home Assistant →

</details> <details> <summary><b>🏠 Home Assistant OS (Add-on)</b></summary>
  1. Add the repository to your Home Assistant instance:

    Add Repository

  2. Install "Home Assistant MCP Server" from the Add-on Store and wait for it to complete

  3. Click Start, then open the Logs tab to find your unique MCP URL

  4. Configure your AI client with that URL

No token or credential setup needed — the add-on connects to Home Assistant automatically.

Full add-on documentation →

</details> <details> <summary><b>🌐 Remote Access (Nabu Casa / Webhook Proxy)</b></summary>

Already have Nabu Casa or another reverse proxy pointing at your Home Assistant? The Webhook Proxy add-on routes MCP traffic through your existing setup — no separate tunnel or port forwarding needed.

  1. Install the MCP Server add-on (see above) and the Webhook Proxy add-on from the same store
  2. Start the webhook proxy and restart Home Assistant when prompted
  3. Copy the webhook URL from the add-on logs:
    code
    MCP Server URL (remote): https://xxxxx.ui.nabu.casa/api/webhook/mcp_xxxxxxxx
    
  4. Configure your AI client with that URL

For other remote access methods (Cloudflare Tunnel, custom reverse proxy), see the Setup Wizard.

Webhook proxy documentation →

</details>

🧙 Setup Wizard for 15+ clients

Claude Code, Gemini CLI, ChatGPT, Open WebUI, VSCode, Cursor, and more.

<p> <a href="https://homeassistant-ai.github.io/ha-mcp/setup/"><img src="https://img.shields.io/badge/Open_Setup_Wizard-4A90D9?style=for-the-badge" alt="Open Setup Wizard" height="40"></a> </p>

Having issues? Check the FAQ & Troubleshooting


💬 What Can You Do With It?

Just talk to Claude naturally. Here are some real examples:

You SayWhat Happens
"Create an automation that turns on the porch light at sunset"Creates the automation with proper triggers and actions
"Add a weather card to my dashboard"Updates your Lovelace dashboard with the new card
"The motion sensor automation isn't working, debug it"Analyzes execution traces, identifies the issue, suggests fixes
"Make my morning routine automation also turn on the coffee maker"Reads the existing automation, adds the new action, updates it
"Create a script that sets movie mode: dim lights, close blinds, turn on TV"Creates a reusable script with the sequence of actions

Spend less time configuring, more time enjoying your smart home.


✨ Features

CategoryCapabilities
🔍 SearchFuzzy entity search, deep config search, system overview
🏠 ControlAny service, bulk device control, real-time states
🔧 ManageAutomations, scripts, helpers, dashboards, areas, zones, groups, calendars, blueprints
📊 MonitorHistory, statistics, camera snapshots, automation traces, ZHA devices
💾 SystemBackup/restore, updates, add-ons, device registry
<details> <!-- TOOLS_TABLE_START --> <summary><b>Complete Tool List (89 tools)</b></summary>
CategoryTools
Add-onsha_get_addon, ha_manage_addon
Areas & Floorsha_config_list_areas, ha_config_list_floors, ha_list_floors_areas, ha_remove_area_or_floor, ha_set_area_or_floor
Automationsha_config_get_automation, ha_config_remove_automation, ha_config_set_automation
Blueprintsha_get_blueprint, ha_import_blueprint
Calendarha_config_get_calendar_events, ha_config_remove_calendar_event, ha_config_set_calendar_event
Cameraha_get_camera_image
Dashboardsha_config_delete_dashboard_resource, ha_config_delete_dashboard, ha_config_get_dashboard, ha_config_list_dashboard_resources, ha_config_set_dashboard_resource, ha_config_set_dashboard
Device Registryha_get_device, ha_remove_device, ha_update_device
Energyha_manage_energy_prefs
Entity Registryha_get_entity_exposure, ha_get_entity, ha_remove_entity, ha_set_entity
Filesha_delete_file (beta), ha_list_files (beta), ha_read_file (beta), ha_write_file (beta)
Groupsha_config_list_groups, ha_config_remove_group, ha_config_set_group
HACSha_hacs_add_repository, ha_hacs_download, ha_hacs_repository_info, ha_hacs_search
Helper Entitiesha_config_list_helpers, ha_config_set_helper, ha_delete_helpers_integrations, ha_get_helper_schema
History & Statisticsha_get_automation_traces, ha_get_history, ha_get_logs
Integrationsha_get_integration, ha_set_integration_enabled
Labels & Categoriesha_config_get_category, ha_config_get_label, ha_config_remove_category, ha_config_remove_label, ha_config_set_category, ha_config_set_label
Scenesha_config_get_scene, ha_config_remove_scene, ha_config_set_scene
Scriptsha_config_get_script, ha_config_remove_script, ha_config_set_script
Search & Discoveryha_deep_search, ha_get_overview, ha_get_state, ha_search_entities
Service & Device Controlha_bulk_control, ha_call_event, ha_call_service, ha_get_operation_status, ha_list_services
Systemha_backup_create, ha_backup_restore, ha_check_config, ha_config_set_yaml (beta), ha_get_system_health, ha_get_updates, ha_manage_custom_tool (beta), ha_reload_core, ha_restart
Todo Listsha_get_todo, ha_remove_todo_item, ha_set_todo_item
Utilitiesha_eval_template, ha_install_mcp_tools (beta), ha_report_issue
Zonesha_get_zone, ha_remove_zone, ha_set_zone
<!-- TOOLS_TABLE_END --> </details>

🔌 Custom Component (ha_mcp_tools) (beta)

Some tools require a companion custom component installed in Home Assistant. Standard HA APIs do not expose file system access or YAML config editing. This component provides both.

Tools that require the component:

ToolDescription
ha_config_set_yaml (beta)Safely add, replace, or remove top-level YAML keys in configuration.yaml and package files (automatic backup, validation, and config check)
ha_list_files (beta)List files in allowed directories (www/, themes/, custom_templates/)
ha_read_file (beta)Read files from allowed paths (config YAML, logs, www/, themes/, custom_templates/, custom_components/)
ha_write_file (beta)Write files to allowed directories
ha_delete_file (beta)Delete files from allowed directories

All other tools work without the component. These five return an error with installation instructions if the component is missing.

These tools also require feature flags: HAMCP_ENABLE_FILESYSTEM_TOOLS=true (file tools) and ENABLE_YAML_CONFIG_EDITING=true (YAML editing). To enable the ha_install_mcp_tools installer tool, set HAMCP_ENABLE_CUSTOM_COMPONENT_INTEGRATION=true.

Install using HACS (recommended)

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

To add manually: open HACS > Integrations > three-dot menu > Custom repositories > add https://github.com/homeassistant-ai/ha-mcp (category: Integration) > Download.

After installing, restart Home Assistant. Then open Settings > Devices & Services > Add Integration and search for HA MCP Tools.

Install manually

Copy custom_components/ha_mcp_tools/ from this repository into your HA config/custom_components/ directory. Restart Home Assistant, then add the integration as described above.


🧠 Better Results with Agent Skills

This server gives your AI agent tools to control Home Assistant. For better configurations, pair it with Home Assistant Agent Skills — domain knowledge that teaches the agent Home Assistant best practices.

An MCP server can create automations, helpers, and dashboards, but it has no opinion on how to structure them. Without domain knowledge, agents tend to over-rely on templates, pick the wrong helper type, or produce automations that are hard to maintain. The skills fill that gap: native constructs over Jinja2 workarounds, correct helper selection, safe refactoring workflows, and proper use of automation modes.

Bundled Skills (built-in)

Skills from homeassistant-ai/skills are bundled and served as MCP resources via skill:// URIs. Any MCP client that supports resources can discover them automatically — no manual installation needed. For tool-only clients (claude.ai, etc.), the same skills are reachable through the polymorphic ha_get_skill_guide tool — call it with no args to list bundled skills, with a skill arg to list its files, or with skill + file to read content. Resources are not auto-injected into context — clients must explicitly request them, so idle context cost is just the metadata listing.

ha_get_skill_guide is mandatory-pinned: the catalog always exposes it so tool-only clients never see a silently missing skill surface.

Skills can still be installed manually for clients that prefer local skill files — see the skills repo for instructions.


🔍 Tool Discovery for AI Agents

By default, the full tool catalog (~86 tools) is listed to the client through the standard MCP tools/list response. Clients with deferred / on-demand tool loading (Claude Sonnet, Claude Opus,) handle that fine — tools are pulled into context only when needed, so idle context cost is near-zero.

For models without deferred tool support — Claude Haiku, Gemini, ChatGPT OpenAI-compatible local models, smaller open-weights models — listing 86 tools eats ~46K tokens of idle context. To address that, the server ships with a search-based discovery mode built on top of FastMCP's BM25 search transform.

Enable search-based discovery

Set ENABLE_TOOL_SEARCH=true (or toggle the option in the HA add-on). The full catalog is replaced in the tool list with four entry points plus a small set of always-visible "pinned" tools (ha_search_entities, ha_get_overview, ha_restart, etc.). All tools remain callable directly by name once discovered:

ToolPurpose
ha_search_toolsBM25 keyword search across all tools. Returns name, description, parameters, and annotations (readOnlyHint / destructiveHint) so the agent can pick the right one.
ha_call_read_toolExecute a readOnlyHint tool by name. Safe — clients can auto-approve.
ha_call_write_toolExecute a write tool that creates or updates data.
ha_call_delete_toolExecute a tool that removes / deletes data.

The proxy split lets MCP clients apply different permission policies per category (e.g. auto-approve reads, prompt for writes, confirm deletes) without parsing tool docstrings.

SettingDefaultDescription
ENABLE_TOOL_SEARCHfalseReplace full tool catalog with search-based discovery (~46K → ~5K idle tokens).
TOOL_SEARCH_MAX_RESULTS5Max results returned by ha_search_tools (range 2–10).
PINNED_TOOLSemptyComma-separated tool names to keep always visible. The web settings UI is the primary way to manage this.

When to enable

  • Claude Haiku, OpenAI-compatible local models, Gemini, ChatGPT or any model without native deferred tool support — large idle-context savings.
  • MCP clients that cap total tool count (some cap at 100) — surfaces a minimal set (~10 tools) instead of 86.
  • Cost-sensitive deployments — fewer idle tokens per turn.

Leave it off when using Claude Sonnet/Opus or any client with deferred tool loading; the full catalog has no idle cost there and direct calls skip the search step. If you choose to use our toolsearch then you should disable the native Claude Opus/Sonnet toolsearch, which is called deferred tools in the settings.

For the HA add-on, the same option is documented in homeassistant-addon/DOCS.md along with the in-add-on settings UI for fine-grained tool enable/disable/pin.


🧪 Dev Channel

Want early access to new features and fixes? Dev releases (.devN) are published on every push to master.

Dev Channel Documentation — Instructions for pip/uvx, Docker, and Home Assistant add-on.


🤝 Contributing

For development setup, testing instructions, and contribution guidelines, see CONTRIBUTING.md.

For comprehensive testing documentation, see tests/README.md.


🔒 Privacy

Ha-mcp runs locally on your machine. Your smart home data stays on your network.

  • Configurable telemetry — optional anonymous usage stats
  • No personal data collection — we never collect entity names, configs, or device data
  • User-controlled bug reports — only sent with your explicit approval

For full details, see our Privacy Policy.


📄 License

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


🙏 Acknowledgments

👥 Contributors

Maintainers

Contributors

  • @bigeric08 — Explicit mcp dependency for protocol version 2025-11-25 support.
  • @airlabno — Support for data field in schedule time blocks.
  • @ryphez — Codex Desktop UI MCP quick setup guide.
  • @Danm72 — Entity registry tools (ha_set_entity, ha_get_entity) for managing entity properties.
  • @Raygooo — SOCKS proxy support.
  • @cj-elevate — Integration & entity management tools (enable/disable/delete); person/zone/tag config store routing.
  • @maxperron — Beta testing.
  • @kingbear2 — Windows UV setup guide.
  • @konradwalsh — Financial support via GitHub Sponsors. Thank you! ☕
  • @knowald — Area resolution via device registry in ha_get_system_overview for entities assigned through their parent device. Financial support via GitHub Sponsors. Thank you! ☕
  • @zorrobyte — Per-client WebSocket credentials in OAuth mode, fixing WebSocket tool failures.
  • @deanbenson — Fixed ha_deep_search timeout on large Home Assistant instances with many automations.
  • @saphid — Config entry options flow tools (initial design, #590).
  • @adraguidev — Fix menu-based config entry flows for group helpers (#647).
  • @transportrefer — Integration options inspection (ha_get_integration schema support, #689).
  • @teh-hippo — Fix blueprint import missing save step.
  • @smenzer — Documentation fix.
  • @The-Greg-O — REST API for config entry deletion.
  • @restriction — Responsible disclosure: python_transform sandbox missing call target validation.
  • @lcrostarosa — Diagnostic and health monitoring tools concept (#675), inspiring system/error logs, repairs, and ZHA radio metrics integration.
  • @roysha1 — Copilot CLI support in the installation wizard; replaced placeholder logo SVGs with real brand icons on the documentation site.
  • @Patch76ha_remove_entity tool, history/statistics pagination and validation, docs sync automation, docstring guidelines, dashboard tool consolidation.
  • @teancom — Fix add-on stats endpoint (/addons/{slug}/stats).
  • @TomasDJo — Category support for automations, scripts, and scenes.
  • @bzelchpython_transform support for automations and scripts.
  • @gcormier — Windows installer improvements: removed unused variable and fixed terminal closing after install.
  • @ekobres — Feature flags for HAMCP_ENABLE_FILESYSTEM_TOOLS and HAMCP_ENABLE_CUSTOM_COMPONENT_INTEGRATION in the add-on config, with beta tagging in source and docs.
  • @w3z315 — Financial support via GitHub Sponsors. Thank you! ☕
  • @griffinmartin — Added OpenCode (by Anomaly) as a selectable AI client in the setup wizard, with both stdio and streamable HTTP support.
  • @hhopke — Fixed addon API calls to route through HA Core ingress proxy instead of direct container connections, fixing ha_manage_addon proxy mode on addon installs.

💬 Community


⭐ Star History

Star History Chart

常见问题

io.github.homeassistant-ai/ha-mcp 是什么?

Comprehensive Model Context Protocol server for managing Home Assistant through AI assistants.

相关 Skills

Claude接口

by anthropics

Universal
热门

面向接入 Claude API、Anthropic SDK 或 Agent SDK 的开发场景,自动识别项目语言并给出对应示例与默认配置,快速搭建 LLM 应用。

想把Claude能力接进应用或智能体,用claude-api上手快、兼容Anthropic与Agent SDK,集成路径清晰又省心

AI 与智能体
未扫描137.2k

RAG架构师

by alirezarezvani

Universal
热门

聚焦生产级RAG系统设计与优化,覆盖文档切块、检索链路、索引构建、召回评估等关键环节,适合搭建可扩展、高准确率的知识库问答与检索增强应用。

面向RAG落地,把知识库、向量检索和生成链路系统串联起来,做架构设计时更清晰,也更少踩坑。

AI 与智能体
未扫描15.4k

多智能体架构

by alirezarezvani

Universal
热门

聚焦多智能体系统架构设计,梳理 Supervisor、Swarm、分层和 Pipeline 等模式,覆盖角色定义、通信协作与性能评估,适合规划稳健可扩展的 AI agent 编排方案。

帮你系统解决多智能体应用的架构设计与协同编排难题,适合构建复杂 AI 工作流,成熟度高、社区认可也很亮眼。

AI 与智能体
未扫描15.4k

相关 MCP Server

知识图谱记忆

编辑精选

by Anthropic

热门

Memory 是一个基于本地知识图谱的持久化记忆系统,让 AI 记住长期上下文。

帮 AI 和智能体补上“记不住”的短板,用本地知识图谱沉淀长期上下文,连续对话更聪明,数据也更可控。

AI 与智能体
85.9k

顺序思维

编辑精选

by Anthropic

热门

Sequential Thinking 是让 AI 通过动态思维链解决复杂问题的参考服务器。

这个服务器展示了如何让 Claude 像人类一样逐步推理,适合开发者学习 MCP 的思维链实现。但注意它只是个参考示例,别指望直接用在生产环境里。

AI 与智能体
85.9k

PraisonAI

编辑精选

by mervinpraison

热门

PraisonAI 是一个支持自反思和多 LLM 的低代码 AI 智能体框架。

如果你需要快速搭建一个能 24/7 运行的 AI 智能体团队来处理复杂任务(比如自动研究或代码生成),PraisonAI 的低代码设计和多平台集成(如 Telegram)让它上手极快。但作为非官方项目,它的生态成熟度可能不如 LangChain 等主流框架,适合愿意尝鲜的开发者。

AI 与智能体
7.8k

评论