Sandbox
@homeassistant-ai/ha-mcp

MCP server for Home Assistant control and editing

ha-mcp connects an MCP client to Home Assistant so the agent can read states, call services, and edit Home Assistant configuration. It supports multiple install paths, including a Home Assistant custom component, a Home Assistant add-on, Docker, and local stdio.

4,686 stars206 forksPythonUpdated 6d ago
Who it's for

Builders who want their agent to control and maintain Home Assistant instead of just reading device state.

What it delivers

You can ask an agent to create automations, update dashboards, inspect logs, and manage your smart home from one chat.

What it does

Search and control Home Assistant

Find entities, read current state, call services, control devices in bulk, and inspect system overviews.

Edit automations and dashboards

Create, update, and remove automations, scripts, scenes, helpers, groups, zones, and dashboard content.

Inspect and debug

Read history, statistics, logs, automation traces, and camera snapshots to understand what went wrong.

Manage system features

Handle backups, updates, apps, HACS, device and entity registry, themes, security policies, and core restart actions.

Optional file and YAML tools

With the custom component and beta flags, the server can read, write, list, and delete allowed files and edit `configuration.yaml` safely.

Remote and local connection options

Run it as a Home Assistant custom component, add-on, Docker server, or stdio client, with webhook and OIDC options for remote access.

Bundled Home Assistant skills

Serves Home Assistant agent skills as MCP resources and provides `ha_get_skill_guide` for tool-only clients.

How to get it

  1. 1Copy the webhook URL from the app logs
    MCP Server URL (remote): https://xxxxx.ui.nabu.casa/api/webhook/mcp_xxxxxxxx

README

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

Home Assistant MCP Server Logo

The Unofficial and Awesome Home Assistant MCP Server

95+ Tools Release E2E Tests License
Activity Built with FastMCP Python Version GitHub Sponsors Website

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.


Demo with Claude Desktop


🚀 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):

Add HA-MCP to HACS

Quick start:

  1. 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.
  2. Restart Home Assistant.
  3. 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.
  4. 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.
  5. 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_auth to 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 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.

  1. Add the repository to your Home Assistant instance:

    Add Repository

    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.

  2. 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.)

  3. Open the Logs tab to find your unique MCP URL.

  4. 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 / HOMEASSISTANT_TOKEN alongside 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-mcp in HTTP mode, pointed at your Home Assistant URL and a long-lived token, 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-mcp package with uvx ha-mcp@latest (or pip) as a streamable-HTTP server the same way. Details in the Setup Wizard.

  • Local stdio (not recommended): runs ha-mcp on your own machine over stdio. The one-command installers in the Demo server section below use this path; the Setup Wizard covers connecting it to your own Home Assistant.

  • OIDC authentication: gate remote access behind an external identity provider (Authentik, Keycloak, Auth0, etc.) instead of a secret URL — all authenticated users share the server's Home Assistant credentials. See OIDC Mode.

    ⚠️ stdio has known transport issues. The stdio transport has connection problems that streamable HTTP does not (#1713). It is recommended only for demo/testing tinkering — for a real setup, use the custom component or an HTTP method above.

🌐 Remote access (Nabu Casa / Webhook Proxy app / OpenAI Tunnel)

Using the HA-MCP custom component? You do not need the Webhook Proxy — the component has its own built-in webhook for remote access (see the Get Started quick start at the top). The proxy is for the app (it can also front another external server via its mcp_server_url option). The OpenAI Tunnel below is different: it applies to any install method when Home Assistant isn't publicly reachable at all (no Nabu Casa or reverse proxy).

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

  1. Install the MCP Server app (see above) and the Webhook Proxy app from the same store
  2. Start the webhook proxy and restart Home Assistant when prompted
  3. Copy the webhook URL from the app logs:
    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.

ChatGPT / Codex behind a firewall (OpenAI Tunnel). ChatGPT connectors normally require a publicly reachable URL. If you can't (or don't want to) expose one, the community OpenAI Tunnel for HA-MCP integration by @norpol runs OpenAI's tunnel-client inside Home Assistant and connects your local MCP server URL to an OpenAI-hosted tunnel over an outbound-only connection — no port forwarding, reverse proxy, or public URL. Point it at your ha-mcp URL, then attach the ChatGPT connector to the same tunnel ID. See the FAQ entry and #1811.

Webhook proxy documentation →

🧪 Demo server (Windows / macOS / Linux)

Want to try ha-mcp before connecting your own Home Assistant? No paid subscription required. These one-command scripts set up a local stdio connection to a hosted demo environment so you can see it working in a few minutes. Each script's Connect your own Home Assistant link then shows how to point it at your instance.

🍎 macOS
  1. Go to claude.ai and sign in (or create a free account)
  2. Open Terminal and run:
    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 →

🐧 Linux

Anthropic doesn't ship Claude Desktop for Linux, so pick one path:

Claude Desktop — free, via the community build:

  1. Install the community Claude Desktop for Linux build and sign in with a free claude.ai account
  2. Open Terminal and run:
    curl -LsSf https://raw.githubusercontent.com/homeassistant-ai/ha-mcp/master/scripts/install-linux.sh | sh
    
  3. Restart Claude Desktop, then ask: "Can you see my Home Assistant?"

Claude Code — official CLI, requires a paid Claude plan:

  1. Install Claude Code: curl -fsSL https://claude.ai/install.sh | bash
  2. Configure ha-mcp, then run claude:
    curl -LsSf https://raw.githubusercontent.com/homeassistant-ai/ha-mcp/master/scripts/install.sh | sh -s -- --claude-code
    
  3. Start claude, run /mcp to confirm, then ask: "Can you see my Home Assistant?"

Full Linux guide →

🪟 Windows
  1. Go to claude.ai and sign in (or create a free account)
  2. Open Windows PowerShell (from Start menu) and run:
    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 →

🧙 Setup Wizard for 15+ clients

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

Open Setup Wizard

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, apps, device registry
🔒 SafetyRead Only Mode toggle, per-tool enable/disable, tool security policies (user approval), automatic edit backups
Complete Tool List (87 tools)
CategoryTools
Apps (add-ons)ha_get_app, ha_manage_app
Areas & Floorsha_list_floors_areas, ha_remove_area_or_floor, ha_set_area_or_floor
Assistha_manage_pipeline
Automationsha_config_get_automation, ha_config_remove_automation, ha_config_set_automation
Blueprintsha_manage_blueprints
Calendarha_config_get_calendar_events, ha_config_remove_calendar_event, ha_config_set_calendar_event
Cameraha_get_camera_image
Dashboardha_get_dashboard_screenshot (beta)
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
Developerha_dev_manage_server, ha_dev_manage_settings
Device Registryha_get_device, ha_remove_device, ha_set_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_get_hacs_info, ha_manage_hacs
Helper Entitiesha_config_list_helpers, ha_config_set_helper, ha_remove_helpers_integrations
History & Statisticsha_get_automation_traces, ha_get_history, ha_get_logs
Integrationsha_get_integration, ha_get_system_health, ha_set_integration
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
Matterha_manage_radio
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_get_overview, ha_get_state, ha_search
Service & Device Controlha_bulk_control, ha_call_event, ha_call_service, ha_get_operation_status, ha_list_services
Systemha_config_get_yaml (beta), ha_config_set_yaml (beta), ha_manage_backup, ha_manage_custom_tool (beta), ha_manage_security_policy, ha_manage_theme, ha_manage_updates, ha_reload_core, ha_restart
Todo Listsha_get_todo, ha_remove_todo_item, ha_set_todo_item
Utilitiesha_eval_template, ha_report_issue
Zonesha_get_zone, ha_remove_zone, ha_set_zone

🆚 ha-mcp vs. Home Assistant's built-in MCP Server

Home Assistant ships its own MCP Server integration. It is built on the Assist pipeline, so a connected MCP client can read and control the entities you have exposed to Assist and run the intents Assist understands — handy for voice-style control of already-exposed devices.

ha-mcp is a standalone server built for configuring, building, and debugging your smart home, not just controlling it. On top of device control, it adds capabilities the built-in integration does not have:

CapabilityBuilt-in MCP Serverha-mcp
Control exposed devices, query statesYesYes
Entity scopeOnly entities exposed to AssistEverything in Home Assistant
Create / edit automations, scripts, scenesNoYes
Build & edit dashboardsNoYes
Debug automations from traces, read history & logsNoYes
Manage helpers, areas, zones, labels, groupsNoYes
Backups, apps, HACS, device & entity registryNoYes

Rule of thumb: Use the built-in integration for voice-style control of devices you have already exposed; use ha-mcp when you want an AI assistant that can also build and maintain your Home Assistant setup.


🔌 Custom Component (ha_mcp_tools) — File & YAML Services

The HA-MCP Custom Component also powers a set of privileged tools that standard Home Assistant APIs can't provide: file system access and YAML config editing. (The same component runs the full server in-process — that's the recommended install in the Get Started section at the top.) Its File & YAML services entry (HA-MCP File & YAML Tools) enables the tools below.

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
ha_read_file (beta)Read files from allowed paths (config YAML, logs, and allowed directories)
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 beta feature flags. See Beta Features for how to enable them — including the ENABLE_BETA_FEATURES master flag, which must be on before the filesystem/YAML sub-flags take effect.

Install

Install the HA-MCP File & YAML Tools entry from the same HA-MCP Custom Component:

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-integration (category: Integration) > Download. Or copy custom_components/ha_mcp_tools/ from this repository into your HA config/custom_components/ directory.

After installing, restart Home Assistant, then open Settings > Devices & Services > Add Integration, search for HA-MCP Custom Component, and add the HA-MCP File & YAML Tools entry.

To run the full ha-mcp server in-process through this same component, see the Get Started section at the top and the full in-process server documentation →.


🧠 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 a mandatory tool: the catalog always exposes it (it can't be disabled) so tool-only clients never see a silently missing skill surface.

Skills can still be installed manually for clients that prefer

Files in the repo

Repository payload47 top-level entries
  • .claude
  • .gemini
  • .github
  • custom_components
  • docs
  • homeassistant-addon
  • homeassistant-addon-dev
  • homeassistant-addon-webhook-proxy
  • homeassistant-addon-webhook-proxy-dev
  • packaging
  • rules
  • scripts
  • site
  • src
  • templates
  • tests
  • .coderabbit.yaml
  • .dockerignore
  • .env.example
  • .gitattributes
  • .gitignore
  • .gitmodules
  • .python-version
  • AGENTS.md
  • CHANGELOG.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • coverage.json
  • docker-compose.screenshot.yml
  • docker-compose.yml
  • Dockerfile
  • fastmcp-http.json
  • fastmcp-webclient.json
  • fastmcp.json
  • hacs.json
  • lefthook.yml
  • LICENSE
  • MANIFEST.in
  • PRIVACY.md
  • pyproject.toml
  • README.md
  • renovate.json
  • repository.yaml
  • SECURITY.md
  • server.json
  • sgconfig.yml
  • uv.lock

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k