Home Assistant MCP
Provides tools for interacting with a Home Assistant instance, enabling AI agents to read entity states, call services, run scripts and automations, and send commands to phones via the Home Assistant companion app.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Home Assistant MCPturn off all lights and lock the front door"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Home Assistant MCP
An MCP server that exposes a Home Assistant instance as a tool set, running as a stateful agent on Cloudflare Workers. Point an MCP client (Claude, etc.) at the deployed endpoint and it can read entity states, call services, run scripts and automations, and send commands to phones via the HA companion app — all against your own Home Assistant instance.
The tool surface is built for a model rather than for the REST API: results
are scoped to the entities you exposed to your voice assistant, rendered as
one compact line per entity grouped by room, and every entity argument
accepts a friendly name as readily as an entity_id.
How it works
MCP client ──HTTP/SSE──► Worker (/mcp) ──► HomeAssistantMCP (Durable Object)
│
EntityCatalog
│
HomeAssistantClient
│
HA REST API + /api/websocket (long-lived token)HomeAssistantMCP is a McpAgent
hosted on a Durable Object. EntityCatalog sits between the tools and the
API: it joins entity states to their area and floor, narrows them to the
exposed set, resolves friendly names to entity IDs, and caches everything.
HomeAssistantClient underneath is a thin, cache-free wrapper around the HA
REST API. Areas, floors and hidden entities have no REST endpoint, so they
come from a single /api/template Jinja render.
Only what you exposed
/api/states on a real installation is a wall of firmware-update notices,
signal-strength sensors and diagnostic switches. So the server scopes itself
to the entities you picked in Settings → Voice assistants → Expose, read
over the WebSocket API (homeassistant/expose_entity/list — there is no REST
equivalent, and it requires a token belonging to an admin user).
If that list can't be read, the server falls back to Home Assistant's own
default-exposure rules — lights, switches, covers, climate, media players and
the handful of sensor device classes HA itself exposes by default — and says
so in list_areas. A filter narrow enough to match nothing exposed (say
domain: "automation") widens automatically, so nothing is unreachable.
Caching
The Durable Object outlives a tool call, so a multi-tool turn costs one request to Home Assistant rather than one per tool: states are cached for 3 seconds and invalidated the moment a service call changes something, while the area registry and the Expose list are cached for 10 minutes.
Related MCP server: hass-mcp
Tools
Tool | Description |
| Exposed entities grouped by area, filtered by domain / area / search / state |
| Full state and attributes for up to 20 entities at once |
| Call any HA service ( |
| Trigger an automation, run a script, apply a scene, press a button |
| Areas with their floor and entity counts |
| Time spent in each state plus the changes, for up to 10 entities |
| List commands sendable to the HA mobile app |
| Send a command (e.g. DND toggle) to a phone |
get_entities returns lines like:
## Kitchen — Ground
light.kitchen_ceiling | Kitchen Ceiling | on | brightness=71%
sensor.kitchen_temp | Kitchen Temperature | 21.4 °CAnything taking an entity — get_entity_state, call_service's
entity_id, activate, get_history — accepts "kitchen ceiling" just as
well as light.kitchen_ceiling, and answers an ambiguous name with the
candidates rather than a guess.
Setup
npm installHA_URL is set in wrangler.jsonc under vars — point it at your own Home
Assistant instance before deploying. HA_ASSISTANT is optional and names the
assistant whose Expose list to use; it defaults to conversation.
HA_TOKEN (a long-lived access token from HA, belonging to an admin
user so the Expose list is readable) is read from Cloudflare's
Secrets Store, not a
plain Wrangler secret. Create it once per account and it's reusable across
Workers:
wrangler secrets-store secret create <store-id> \
--name home-assistant-token --scopes workers --remotewrangler.jsonc then binds it via secrets_store_secrets:
"secrets_store_secrets": [
{ "binding": "HA_TOKEN", "store_id": "<store-id>", "secret_name": "home-assistant-token" }
]For local dev, create a local-only secret with the same name (omit
--remote) so wrangler dev has something to read.
Development
npm run dev # wrangler dev
npm test # vitest run
npm run test:watch # vitest watch mode
npm run typecheck # tsc --noEmitTests mock fetch — including the WebSocket handshake — so no live Home
Assistant instance is required to run them.
Deploy
npm run deployOr connect this repository to a Cloudflare Worker for git-based deploys.
Either way, the home-assistant-token secret must exist in the account's
Secrets Store — it is never stored in the repo.
Stack
Cloudflare Workers + Durable Objects (SQLite-backed)
Cloudflare Agents SDK (
agents/mcp)
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control and monitor Home Assistant smart home devices through natural language interactions. Supports device control, entity state monitoring, history access, and automation generation with both MCP protocol and standalone HTTP REST API modes.1MIT
- AlicenseAqualityDmaintenanceMCP server for controlling and querying Home Assistant via its REST API, exposing tools to get entity states, list all states, and call services.16276MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to control Home Assistant smart home devices via MCP, with zero external dependencies. Supports calling services, getting states, and looking up service parameters.18MIT
- FlicenseNot gradedqualityAmaintenanceConnects LLM coding agents to Home Assistant instances, enabling configuration file management, service calls, template testing, and automation diagnostics via MCP tools.
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/crunchypancake1/home-assistant-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server