ha-mcp
Provides full Home Assistant control including reading entity states, calling services, querying history, rendering templates, and resolving rooms/areas.
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., "@ha-mcpturn off the living room lights"
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.
ha-mcp
A self-hosted Model Context Protocol server for Home Assistant, in TypeScript. It gives an MCP client (Claude Desktop, Claude Code, Codex CLI, …) the full Home Assistant control surface: read any entity's state, call any service, query history, render templates, and resolve rooms/areas - over a single local stdio connection.
Why
Home Assistant ships an official MCP Server integration, but it's deliberately narrow: it
only exposes the Assist intent layer over entities you've explicitly exposed to voice
assistants - no raw states, no arbitrary service calls, no history, no templates, no area
registry. ha-mcp wraps the documented REST
and WebSocket APIs directly, so
the model can work with everything in your instance.
Related MCP server: HA Vibecode Agent
Tools
Tool | What it does |
| List entity states; optional |
| Full state + attributes for one |
| Call any service ( |
| State-change history for an entity over the last N hours |
| Render a Jinja2 template against live state |
| HA version, location, unit system, components |
| The error log, for troubleshooting |
| All areas/rooms |
| Entities in a room, resolving device→area inheritance |
Listing automations is just
ha_get_statesfiltered toautomation.*; triggering one isha_call_service('automation','trigger'). Scenes and scripts work the same way - no separate tools needed.
Requirements
Node.js ≥ 20
A Home Assistant instance and a long-lived access token (HA → your profile → Security → Long-lived access tokens → Create token).
Install
git clone https://github.com/qubit999/ha-mcp.git
cd ha-mcp
npm install
npm run buildThis produces dist/index.js - the executable the clients launch.
Configuration
The server reads two environment variables:
Variable | Default | Description |
|
| Base URL of your Home Assistant instance |
| (required) | A long-lived access token |
The same token authenticates both the REST calls and the WebSocket (used for the area
registry). For local development you can drop these in a .env file and run npm run dev.
Connect a client
All three clients launch the server locally over stdio. Use the absolute path to
dist/index.js.
Claude Desktop - one-click (recommended)
Download the latest ha-mcp.mcpb from the
Releases page (no build step needed), or
build it yourself with npm run bundle.
Then in Claude Desktop: Settings → Extensions → Install Extension… (or just drag
ha-mcp.mcpb into the window). Claude shows a form for Home Assistant URL and
token (the token is masked and stored in your OS keychain), then launches the server
for you. Restarting the app or re-pasting config is not needed.
Claude Desktop - manual (alternative)
If you'd rather not bundle, edit the config directly - Settings → Developer → Edit Config
opens the file (path: ~/Library/Application Support/Claude/claude_desktop_config.json -
note the space in "Application Support", so quote it in a shell). Add the block below and
fully quit + relaunch the app:
{
"mcpServers": {
"ha-mcp": {
"command": "node",
"args": ["/Users/alex/ha-mcp/dist/index.js"],
"env": {
"HASS_URL": "http://localhost:8123",
"HASS_TOKEN": "your-long-lived-token"
}
}
}
}Claude Code
claude mcp add ha-mcp \
--scope user \
--env HASS_URL=http://localhost:8123 \
--env HASS_TOKEN=your-long-lived-token \
-- node /Users/alex/ha-mcp/dist/index.jsVerify with claude mcp list / claude mcp get ha-mcp.
Codex CLI
Add to ~/.codex/config.toml:
[mcp_servers.ha-mcp]
command = "node"
args = ["/Users/alex/ha-mcp/dist/index.js"]
env = { HASS_URL = "http://localhost:8123", HASS_TOKEN = "your-long-lived-token" }Then ask: "Turn on the kitchen light" or "What's the temperature in the living room?"
Security
A long-lived token grants full control of your Home Assistant (and thus your home). This
server is designed to run locally over stdio - the client launches it as a subprocess; no
network port is opened and the token never leaves your machine. Keep the token out of version
control (the included .gitignore excludes .env). If you scope it into a shared
.mcp.json, use a non-admin HA user or environment variables instead. There is intentionally
no remote/HTTP transport here.
Development
npm run dev # run from source with tsx (+ .env)
npm run build # type-check and emit dist/Tools are thin wrappers over src/ha.ts (REST helpers + a short-lived WebSocket client for
the registries). The WebSocket connection is opened per registry fetch and cached briefly -
there's no long-lived socket to manage.
License
MIT © qubit999
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
- AlicenseAqualityBmaintenanceA Model Context Protocol server that enables AI assistants like Claude to interact directly with Home Assistant, allowing them to query device states, control smart home entities, and perform automation tasks.Last updated16309MIT
- Alicense-qualityBmaintenanceAn MCP server and Home Assistant add-on that enables AI assistants to manage smart homes by creating automations, designing dashboards, and interacting with entities. It features native access to Home Assistant APIs, built-in Git versioning for safe rollbacks, and full management of HACS integrations.Last updated602MIT
- AlicenseAqualityBmaintenanceMCP server for full Home Assistant control, enabling AI agents to manage dashboards, automations, files, apps, entities, and more via REST API, WebSocket, and SSH.Last updated66135MIT
- Alicense-qualityCmaintenanceAn MCP server that enables AI assistants to control Home Assistant via natural language, including device control, automation management, and system configuration.Last updatedMIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
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/qubit999/ha-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server