Home Assistant MCP Server
Provides tools for controlling and managing a Home Assistant instance, including entities and services, dashboards, automations/scripts/scenes, add-ons, logs, system configuration, backups, notifications, input helpers, and device/integration registries.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Home Assistant MCP Server
A Model Context Protocol (MCP) server for Home Assistant. Control entities, automations, dashboards, add-ons, and system settings from any MCP-compatible LLM client.

Table of Contents
Related MCP server: Home Assistant MCP Server (HA-mcp)
Features
Category | Tools |
Entities & Devices | List, get, set state, call services, search, areas, devices, history, logbook, templates, events |
Dashboards | List, get config, create, update, delete Lovelace dashboards |
Add-ons | List, install, uninstall, update, start, stop, restart, configure, manage repositories |
Logs | Error log, Supervisor logs, Core logs, Host logs, add-on logs |
Automations | List, trigger, enable, disable, and reload automations. Run scripts and activate scenes |
System | HA config, validate config, restart, integrations, health, users, backups, OS/Core/Supervisor updates |
Notifications | Send notifications via any notify service, manage persistent UI notifications |
Input Helpers & Timers | Set input_boolean, input_number, input_select, input_text, input_datetime, and timer entities |
Device & Integration Registry | Browse device hardware info, list config entries, reload integrations |
77 tools in total.
Requirements
Python 3.14+
uv: Python package and environment manager
A running Home Assistant instance reachable over the network
A long-lived access token from your HA profile (see below)
Supervisor-based tools (add-ons, OS updates, backups) require a Home Assistant OS or Supervised installation. They will return errors on plain Docker/Core setups.
Installation
git clone https://github.com/but3k4/ha-mcp-server.git
cd ha-mcp-server
# Create the virtual environment and install dependencies
uv syncGenerating a Long-Lived Access Token
Open your Home Assistant instance in a browser.
Click your profile avatar in the bottom-left corner (or go to
http://<your-ha-url>/profile).Click on the Security tab.
Scroll to the Long-Lived Access Tokens section at the bottom of the page.
Click Create Token.
Give it a name (e.g.
mcp-server) and click OK.Copy the token immediately. It will not be shown again.
Keep this token secret. It grants full API access to your Home Assistant instance.
Configuration
Single instance
Copy the example environment file and fill in your values:
cp .env.example .envEdit .env:
# Base URL of your Home Assistant instance (no trailing slash)
HA_URL=http://homeassistant.local:8123
# Long-lived access token generated in your HA profile
HA_TOKEN=your_long_lived_access_token_hereCommon HA_URL formats:
Setup | URL |
Local network (default hostname) |
|
Local network (IP address) |
|
Nabu Casa / Remote UI |
|
Custom domain with SSL |
|
Multiple instances
Create a ha-mcp.yaml file in the project root (or anywhere and point HA_CONFIG at it):
instances:
- name: home
url: http://homeassistant.local:8123
token: your_long_lived_token_here
- name: office
url: http://office-ha.local:8123
token: another_token_here
default: home # optional. Defaults to the first entryThe server resolves configuration in this order:
File at the path given by
HA_CONFIGha-mcp.yaml,ha-mcp.yml, orha-mcp.jsonauto-discovered in the working directoryHA_URL+HA_TOKENenvironment variables (single instance, backward-compatible)
Environment Variables
Variable | Required | Default | Description |
| yes* | — | Base URL of your Home Assistant instance |
| yes* | — | Long-lived access token |
| no | — | Path to a YAML or JSON multi-instance config file. When set, |
| no |
| Transport mode: |
| no |
| HTTP port when |
| no |
| Python logging level ( |
* Not required when HA_CONFIG is set or when a ha-mcp.yaml file is present in the working directory.
Running the Server
Directly with uv
uv run haThe server communicates over stdio by default and is meant to be launched by an MCP client (like Claude Code), not run manually in a terminal for day-to-day use.
To verify the setup is working:
uv run python -c "from ha_mcp.server import create_server; print('OK')"With Docker or Podman (stdio)
Build the image:
docker build -t ha-mcp-server .
# or
podman build -t ha-mcp-server .Run in stdio mode (launched by the MCP client):
docker run --rm -i \
-e HA_URL=http://homeassistant.local:8123 \
-e HA_TOKEN=your_token_here \
ha-mcp-serverThe
-iflag keeps stdin open, which is required for stdio MCP transport.
Rootless Podman networking note: use --network=host if HA is on the local network:
podman run --rm -i --network=host --env-file .env ha-mcp-serverWith Docker or Podman (SSE: persistent remote server)
Run the server as a long-lived SSE service so any MCP client on the network can connect without spawning a local process.
docker run -d --name ha-mcp \
-p 8765:8765 \
-e HA_URL=http://homeassistant.local:8123 \
-e HA_TOKEN=your_token_here \
-e TRANSPORT=sse \
ha-mcp-serverThe server listens on http://0.0.0.0:8765. Connect clients to http://<host>:8765/sse.
With Podman and network_mode: host (recommended when HA also uses host networking):
podman run -d --name ha-mcp \
--network=host \
-e HA_URL=http://127.0.0.1:8123 \
-e HA_TOKEN=your_token_here \
-e TRANSPORT=sse \
-e PORT=8765 \
ha-mcp-serverConnecting to Claude Desktop
Open Claude Desktop.
Click the hamburger menu (≡) in the top-left corner.
Go to Settings → Developer tab.
Click Edit Config. This opens
claude_desktop_config.jsonin your text editor.Add the
mcpServersblock to the existing JSON (merge it, do not create a second{}):
{
"mcpServers": {
"home-assistant": {
"command": "uv",
"args": [
"run",
"--project", "/absolute/path/to/ha-mcp-server",
"ha"
]
}
}
}The
.envfile in the project directory is picked up automatically, so there is no need to repeat credentials here.
Save the file and fully quit and relaunch Claude Desktop.
A hammer icon near the message input confirms the tools are loaded.
Connecting to Claude Code
Add the server to your Claude Code MCP configuration. The config file location depends on the scope you want:
Scope | File |
Current project only |
|
All projects for your user |
|
Option 1: Run directly with uv (recommended for local dev)
{
"mcpServers": {
"home-assistant": {
"command": "uv",
"args": [
"run",
"--project", "/absolute/path/to/ha-mcp-server",
"ha"
],
"env": {
"HA_URL": "http://homeassistant.local:8123",
"HA_TOKEN": "your_token_here"
}
}
}
}Alternatively, omit the
envblock and use a.envfile in the project directory instead.
Option 2: Run with Docker
{
"mcpServers": {
"home-assistant": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "HA_URL=http://homeassistant.local:8123",
"-e", "HA_TOKEN=your_token_here",
"ha-mcp-server"
]
}
}
}Option 3: Run with Podman
{
"mcpServers": {
"home-assistant": {
"command": "podman",
"args": [
"run", "--rm", "-i",
"--network=host",
"-e", "HA_URL=http://homeassistant.local:8123",
"-e", "HA_TOKEN=your_token_here",
"ha-mcp-server"
]
}
}
}Option 4: Connect to a remote SSE server
If you are running the server as a persistent SSE container on another machine (e.g. a home server or NUC), connect via the CLI:
claude mcp add --transport sse home-assistant http://192.168.1.250:8765/sseOr add it manually to ~/.claude.json:
{
"mcpServers": {
"home-assistant": {
"type": "sse",
"url": "http://192.168.1.250:8765/sse"
}
}
}After editing the config, restart Claude Code or run /mcp to reload servers.
Available Tools
Entities & Services
Tool | Description |
| List all entities, optionally filtered by domain (e.g. |
| Get the current state and attributes of a single entity |
| Directly write state to the HA state machine (use for virtual/input entities) |
| Call any HA service. This is the primary way to control physical devices |
| Search entities by ID, friendly name, or state |
| List all available services grouped by domain |
| List all configured areas |
| List all entities with their friendly names and area assignments |
| List entities assigned to an area, with friendly names and area info |
| Get historical state changes for an entity over a time range |
| Fetch logbook entries, optionally filtered by entity and time |
| Render a Jinja2 template using HA's template engine |
| Fire a custom event on the HA event bus |
Dashboards (Lovelace)
Tool | Description |
| List all configured Lovelace dashboards |
| Get the full YAML/JSON config for a dashboard |
| Create a new Lovelace dashboard |
| Update metadata (title, icon, sidebar visibility) for an existing dashboard |
| Replace the full configuration of a dashboard |
| Delete a dashboard by its internal ID |
Add-ons (Supervisor only)
Tool | Description |
| List all available and installed add-ons |
| Get detailed info for a specific add-on |
| Install an add-on from the store |
| Remove an installed add-on |
| Update an add-on to the latest version |
| Start a stopped add-on |
| Stop a running add-on |
| Restart an add-on |
| Fetch stdout/stderr logs for an add-on |
| Update configuration options for an add-on |
| List configured add-on repositories |
| Add a third-party add-on repository by Git URL |
Logs
Tool | Description |
| Get the HA Core error log |
| Get Supervisor process logs |
| Get Core process logs via Supervisor |
| Get host OS / journald logs |
| Get Multicast service logs |
Automations, Scripts & Scenes
Tool | Description |
| List all automations |
| Manually trigger an automation |
| Enable a disabled automation |
| Disable an automation |
| Reload automations from YAML without restarting |
| List all scripts |
| Execute a script entity, optionally with variables |
| List all scenes |
| Activate a scene |
System & Configuration
Tool | Description |
| Get HA core configuration (version, location, units, etc.) |
| Validate YAML configuration files |
| Restart the Home Assistant Core process |
| Get Supervisor version and update status |
| Get Core process info via Supervisor |
| Get host OS info (CPU, memory, hostname) |
| Get HA OS version and update status |
| Update HA Core to the latest version |
| Update the Supervisor |
| Update the HA OS |
| List all installed integration config entries |
| Get health status for all components |
| List all HA user accounts |
| Trigger a full system backup |
| List all available backups |
Notifications
Tool | Description |
| List available notify service names (e.g. |
| Send a notification via any notify service, with optional title, target, and extra data |
| List active persistent notifications in the HA UI bell menu |
| Create a persistent notification (Markdown supported. Optional stable ID for upsert) |
| Dismiss a persistent notification by its notification ID |
Input Helpers & Timers
Tool | Description |
| List all helper and timer entities, optionally filtered by domain |
| Turn an |
| Set the numeric value of an |
| Select an option on an |
| Set the text value of an |
| Set date, time, or combined datetime on an |
| Start or restart a |
| Pause a running |
| Cancel a |
Device & Integration Registry
Tool | Description |
| List physical devices with manufacturer, model, firmware, and area assignments |
| List all loaded integration config entries with |
| Reload a single integration by |
Notes on Supervisor Tools
Tools in the Add-ons, Logs (except get_error_log), and System (update/backup) categories use the Supervisor API (/api/hassio/). These are only available on:
Home Assistant OS (the recommended full installation on a dedicated device)
Home Assistant Supervised (manual installation on a generic Linux system)
They will return a HomeAssistantError on:
Home Assistant Container (plain Docker image, no Supervisor)
Home Assistant Core (bare Python installation)
If you are on Container or Core, the entity, service, dashboard, automation, and configuration tools will still work normally.
Development
Setting up the environment
git clone https://github.com/but3k4/ha-mcp-server.git
cd ha-mcp-server
# Create the virtual environment and install all dependencies (including dev)
uv sync --all-groupsThis creates a .venv directory and installs both runtime and development dependencies (including ruff).
Linting and formatting
Ruff is used for both linting and formatting. Run it before making changes to establish a clean baseline, and again after your changes before committing:
# Check for lint errors
uv run ruff check .
# Auto-fix lint errors where possible
uv run ruff check --fix .
# Format code
uv run ruff format .Always run
ruff checkandruff formatbefore and after every change. Do not commit code with ruff errors.
Type checking
mypy is used for static type checking. Run it alongside ruff:
uv run mypy .All function signatures must have type hints. Do not commit code with mypy errors.
License
This project is licensed under the MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Control your existing Philips lights, Sonos speakers, Roborock vacuums and other supported devices through Port OS cloud. Give ChatGPT, Claude and other MCP-compatible assistants access to the devices you connect. Turn off the living room lights, play music on your speakers, adjust the thermostat, run a vacuum in a room, check a camera snapshot or find a connected tracker. Available actions depend on your linked provider accounts and each device’s supported capabilities. Port OS runs in the cloud; no local server is required. You choose the account, device and capability permissions each assistant receives. Device operations require user OAuth; public tool discovery does not grant device access. Port OS is in alpha. Setup: https://portoperatingsystem.com/docs/getting-started/ Support: https://portoperatingsystem.com/contact/
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables comprehensive control of Home Assistant through natural language, including managing entities, automations, services, dashboards, and configurations with support for multiple transport methods (STDIO, SSE, HTTP).MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with Home Assistant to control smart home devices, query entity states, and manage automations using natural language. It provides over 90 tools for comprehensive system management, including dashboard configuration, service execution, and automation debugging.MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to control Home Assistant devices, including lights, switches, and climate devices, through natural language commands.-
- AlicenseAqualityCmaintenanceEnables AI clients to inspect and control a Home Assistant instance over its REST API using a long-lived access token, reading entity states, services, history, logbook, error logs, and calendars, rendering Jinja2 templates, and calling services, firing events, or setting and deleting states, with a generic API escape hatch for other endpoints.15MIT