homeassistant-mcp
Controls Home Assistant entities and services including lights, climate, covers, locks, media players, vacuums, fans, cameras, alarms, and more. Provides tool discovery, error log parsing, and context-aware responses.
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., "@homeassistant-mcpturn on 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.
Home Assistant MCP Server
A Model Context Protocol (MCP) server that lets AI assistants control Home Assistant. Built with Python and FastMCP.
Works with Claude, GPT-4, Cursor, Kiro, and any MCP-compatible client.
What it does
40 tools covering lights, climate, covers, locks, media players, vacuums, fans, cameras, alarms, and more
BM25 tool search — LLMs discover tools on demand instead of receiving all 40 schemas upfront
MCP Resources for read-only entity, area, device, and service data
MCP Prompts for guided workflows (automation creation, troubleshooting, energy optimization)
Tool annotations —
readOnlyHintlets clients skip confirmation prompts for safe operationsSmart error log parsing — deduplicates and summarises HA error logs instead of dumping raw text
Context-aware responses — compact list responses, domain-filtered queries, progress reporting
Async throughout with TTL-based caching to reduce API load
Installation
uvx (recommended)
No install needed. Just configure your MCP client:
{
"mcpServers": {
"homeassistant": {
"command": "uvx",
"args": ["homeassistant-mcp"],
"env": {
"HASS_HOST": "http://homeassistant.local:8123",
"HASS_TOKEN": "your_long_lived_access_token_here"
}
}
}
}pip
pip install homeassistant-mcp
homeassistant-mcpFrom source
git clone https://github.com/robbrad/homeassistant-mcp.git
cd homeassistant-mcp
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e ".[dev]"
homeassistant-mcpConfiguration
The server needs two environment variables:
Variable | Description |
| Home Assistant URL, e.g. |
| Long-lived access token (how to create one) |
Optional:
Variable | Default | Description |
|
| Cache TTL for bulk state queries (seconds) |
|
| Cache TTL for individual entity queries (seconds) |
|
| Logging level |
These can be set via environment variables (as shown in the MCP client configs above) or in a .env file. See .env.example.
MCP Client Setup
Claude Desktop
Add to your config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"homeassistant": {
"command": "uvx",
"args": ["homeassistant-mcp"],
"env": {
"HASS_HOST": "http://homeassistant.local:8123",
"HASS_TOKEN": "your_token_here"
}
}
}
}Cursor / Kiro / Other MCP Clients
Same config format. Place it in your client's MCP configuration file (e.g. .cursor/mcp.json, .kiro/settings/mcp.json).
The server uses stdio transport, which is the standard for MCP.
How Tool Discovery Works
With 40 tools, the server uses BM25 search to keep the LLM's context lean. Instead of sending all 40 tool schemas upfront, the LLM sees 8 tools:
Tool | Purpose |
| Returns the full catalog of all 40 tools by category |
| Entity state management (list, get, set, delete) |
| Device discovery with domain/area/floor filtering |
| Call any HA service directly |
| Render Jinja2 templates in HA context |
| Parsed and deduplicated error log summary |
| BM25 search to find tools by description |
| Execute a discovered tool by name |
The LLM calls discover_tools() to see what's available, then search_tools(query="lights brightness") to get the full schema, then calls the tool directly.
All Tools
Device Control (16 tools)
Tool | Domain | Capabilities |
| light | Brightness, color temp, RGB |
| climate | HVAC modes, temperature, fan |
| switch | On/off, bulk operations |
| cover | Position, tilt, open/close |
| lock | Lock/unlock with codes |
| media_player | Playback, volume, source |
| camera | Snapshots, streams, motion detection |
| vacuum | Start, dock, fan speed |
| fan | Speed, oscillation, direction |
| alarm_control_panel | Arm/disarm modes |
| weather | Conditions, daily/hourly forecasts |
| water_heater | Temperature, modes |
| humidifier | Humidity levels |
| siren | Activation control |
| valve | Open/close |
| lawn_mower | Start, stop, dock |
Automation & Scenes (3 tools)
Tool | Capabilities |
| List, trigger, enable, disable, reload |
| List, activate |
| List, execute with variables, reload |
Input Helpers (5 tools)
Tool | Capabilities |
| Toggle on/off |
| Set value, increment, decrement |
| Select from options |
| Set text value |
| Set date/time |
API & State (4 tools)
Tool | Capabilities |
| API status, HA config, loaded components |
| List event types, fire custom events |
| List services by domain, call services |
| List/get/set/delete entity states with filtering |
History (3 tools)
Tool | Capabilities |
| State changes by entity + hours (not ISO timestamps) |
| Human-readable logbook entries |
| Parsed, deduplicated error summary with component counts |
Specialized (5 tools)
Tool | Capabilities |
| List calendars, get events by date range |
| Camera images with optional resize |
| Validate HA configuration |
| Process natural language intents |
| Render Jinja2 templates |
General (4 tools)
Tool | Capabilities |
| Filter by any domain, area, or floor |
| Call any HA service with custom data |
| Send alerts via HA notification services |
| Full tool catalog for LLM discovery |
MCP Resources
URI Pattern | Description |
| Entity state and attributes |
| Area entities (compact summaries) |
| Device entities (compact summaries) |
| All services organized by domain |
| Entity history with pagination |
Development
git clone https://github.com/robbrad/homeassistant-mcp.git
cd homeassistant-mcp
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
# Run tests
pytest
# Format and lint
black src/ tests/
ruff check src/ tests/
# Type check
mypy src/Publishing
Commits to main auto-publish to PyPI via GitHub Actions + python-semantic-release:
fix:commits → patch bump (3.1.0 → 3.1.1)feat:commits → minor bump (3.1.0 → 3.2.0)BREAKING CHANGE:→ major bump (3.1.0 → 4.0.0)
Architecture
AI Assistant <--> MCP Server (FastMCP/stdio) <--> Home Assistant REST API
|
+-----+-----+
| |
Tools Cache
Layer LayerFastMCP Server handles MCP protocol over stdio with BM25 tool search
Home Assistant Client is an async httpx client with auth and connection pooling
Cache Layer provides TTL-based caching for states and entities
Tools Layer — 40 tools with annotations, tags, timeouts, and context logging
Resources — 5 read-only data endpoints with compact response envelopes
Prompts — 13 guided workflows for automation, troubleshooting, and optimization
License
MIT
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.
Latest Blog Posts
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/robbrad/homeassistant-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server