Home Assistant Model Context Protocol (MCP) server - Enhanced fork with automation traces and improved token efficiency
Project description
Hass-MCP-Plus
A complete rewrite of voska/hass-mcp — an MCP server for Home Assistant built for token efficiency, security hardening, and context flooding prevention. Thanks to Matt Voska for the original project.
Features:
- 24 tools covering entity control, registry management, statistics, logs, and automation debugging
- CEL expression filtering for complex entity queries (e.g., "all battery sensors below 20%")
- Entity registry management with safe two-phase delete
- Long-term statistics with hourly/daily/weekly/monthly aggregation and date range support
- Core journal log access with debug-level and integration filtering
- Automation trace inspection for debugging failed runs
- Configurable output formats (lean/compact/detailed)
- Input validation, error sanitization, and context flooding prevention across all calls
- Works with Claude Desktop, Claude Code, Cursor, and other MCP clients
Installation
Prerequisites
- Home Assistant instance with a Long-Lived Access Token
- One of the following:
- Docker (recommended)
- Python 3.13+ and uv
Environment Variables
| Variable | Required | Description |
|---|---|---|
HA_URL |
Yes | Home Assistant URL (e.g., http://192.168.1.100:8123) |
HA_TOKEN |
Yes | Home Assistant Long-Lived Access Token |
HA_VERIFY_SSL |
No | Set to true to enable SSL certificate verification (default: false). Useful when using HTTPS with self-signed certificates. |
TZ |
No | Timezone (e.g., America/Los_Angeles) |
Docker (Recommended)
docker pull rmaher001/hass-mcp-plus:latest
Verify the server starts correctly:
docker run -i --rm \
-e HA_URL=http://homeassistant.local:8123 \
-e HA_TOKEN=YOUR_LONG_LIVED_TOKEN \
rmaher001/hass-mcp-plus
Note: If Home Assistant is running on the same machine, use
http://host.docker.internal:8123(Docker Desktop on Mac/Windows) or add--network hostand usehttp://localhost:8123.
Python (uv/uvx)
pip install hass-mcp-plus
Run the server:
HA_URL=http://homeassistant.local:8123 HA_TOKEN=YOUR_LONG_LIVED_TOKEN uvx hass-mcp-plus
Client Configuration
Claude Code (CLI)
claude mcp add hass-mcp-plus \
-e HA_URL=http://homeassistant.local:8123 \
-e HA_TOKEN=YOUR_LONG_LIVED_TOKEN \
-- docker run -i --rm -e HA_URL -e HA_TOKEN rmaher001/hass-mcp-plus
Replace YOUR_LONG_LIVED_TOKEN with your actual token and update HA_URL.
Claude Desktop
- Open Claude Desktop → Settings → Developer → Edit Config
- Add to
claude_desktop_config.json:
Using Docker:
{
"mcpServers": {
"hass-mcp-plus": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"HA_URL",
"-e",
"HA_TOKEN",
"rmaher001/hass-mcp-plus"
],
"env": {
"HA_URL": "http://homeassistant.local:8123",
"HA_TOKEN": "YOUR_LONG_LIVED_TOKEN"
}
}
}
}
Using uvx:
{
"mcpServers": {
"hass-mcp-plus": {
"command": "uvx",
"args": ["hass-mcp-plus"],
"env": {
"HA_URL": "http://homeassistant.local:8123",
"HA_TOKEN": "YOUR_LONG_LIVED_TOKEN"
}
}
}
}
- Replace
YOUR_LONG_LIVED_TOKENwith your actual token and updateHA_URLto match your Home Assistant instance - Save and restart Claude Desktop
Cursor
- Go to Cursor Settings → MCP → Add New MCP Server
- Fill in the form:
- Name:
Hass-MCP-Plus - Type:
command - Command:
docker run -i --rm -e HA_URL=http://homeassistant.local:8123 -e HA_TOKEN=YOUR_LONG_LIVED_TOKEN rmaher001/hass-mcp-plus
- Name:
- Replace
YOUR_LONG_LIVED_TOKENwith your actual token and updateHA_URL - Click "Add" to save
Usage Examples
Here are some examples of prompts you can use with Claude once Hass-MCP-Plus is set up:
- "What's the current state of my living room lights?"
- "Turn off all the lights in the kitchen"
- "Find all battery sensors below 20%"
- "Give me a summary of my climate entities"
- "Show me the hourly temperature statistics for the last week"
- "Why didn't my motion sensor automation fire last night?"
- "List all unavailable or unknown entities"
- "Disable the orphaned sensor that no longer exists"
- "Show me the debug logs for the MQTT integration"
- "Search for entities related to my living room"
Available Tools
Hass-MCP-Plus provides 24 tools for interacting with Home Assistant:
Entity Management
get_entity: Get the state of a specific entity with optional field filteringentity_action: Perform actions on entities (turn on, off, toggle) with domain-specific parameterslist_entities: Get entities with domain filtering, search, and output format options (lean/compact/detailed)search_entities: Search for entities matching a query string across IDs, names, and attributesquery_entities: Filter entities using CEL expressions with numeric comparisons and boolean logicdomain_summary: Get a summary of a domain's entities with state distribution and examplessystem_overview: Get a comprehensive overview of the entire Home Assistant system
Entity Registry
get_entity_registry: Get detailed registry entry for a single entity (platform, device, area, status)list_entity_registry: List all registry entries with optional domain filter (for auditing and bulk management)update_entity: Update entity properties — rename, change icon, assign area, disable/enable, hide/unhideremove_entity: Remove an entity from the registry (requires explicitconfirm=Trueflag)
Automation & Debugging
list_automations: Get all automations with pagination supportlist_automation_traces: Get recent execution traces for a specific automationget_automation_trace: Get detailed trace for a specific automation run (trigger, conditions, actions, errors)get_error_log: Get the Home Assistant error log with integration/level filteringget_core_logs: Get core journal logs (DEBUG/INFO/WARNING/ERROR) with integration/pattern filteringset_log_level: Set log level for any integration (enable debug logging, then read withget_core_logs)
Historical Data
get_history: Get raw state change history with automatic pagination and samplingget_history_range: Get state changes for a specific date/time range with sampling strategiesget_statistics: Get aggregated statistics (mean, min, max) with configurable periods (5min/hour/day/week/month)get_statistics_range: Get long-term statistics for any date range — the best tool for historical analysis
System
get_version: Get the Home Assistant versioncall_service: Call any Home Assistant service (low-level API access)restart_ha: Restart Home Assistant
Development
Running Tests
uv run pytest tests/ -v
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hass_mcp_plus-0.2.1.tar.gz.
File metadata
- Download URL: hass_mcp_plus-0.2.1.tar.gz
- Upload date:
- Size: 70.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b46df5ea040ef5cf273e5a8dfc563dc79d444e2db8b711be57255ad3d7cffd03
|
|
| MD5 |
c5d9e22a6a46851322d1088158092c7e
|
|
| BLAKE2b-256 |
6ce8b359860112e9c4a18a79799fb4708a5374dccc08e3fac5f0dd1400dc0d7a
|
Provenance
The following attestation bundles were made for hass_mcp_plus-0.2.1.tar.gz:
Publisher:
publish.yml on rmaher001/hass-mcp-plus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hass_mcp_plus-0.2.1.tar.gz -
Subject digest:
b46df5ea040ef5cf273e5a8dfc563dc79d444e2db8b711be57255ad3d7cffd03 - Sigstore transparency entry: 1023694715
- Sigstore integration time:
-
Permalink:
rmaher001/hass-mcp-plus@1cf466541dd5279b257262ae00d9c023c431a0f1 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/rmaher001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1cf466541dd5279b257262ae00d9c023c431a0f1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hass_mcp_plus-0.2.1-py3-none-any.whl.
File metadata
- Download URL: hass_mcp_plus-0.2.1-py3-none-any.whl
- Upload date:
- Size: 44.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a674f6f5f4763725c24a2343eb0d99cf4c0304d2617f34483afde42569a05c7
|
|
| MD5 |
36b7828ed2dc0a2b3a3d3fc3ffd59c03
|
|
| BLAKE2b-256 |
b5f72cd8f06344b198e410425b366dc095ed4e9ff91db06afd20a6dfb04cf1d4
|
Provenance
The following attestation bundles were made for hass_mcp_plus-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on rmaher001/hass-mcp-plus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hass_mcp_plus-0.2.1-py3-none-any.whl -
Subject digest:
2a674f6f5f4763725c24a2343eb0d99cf4c0304d2617f34483afde42569a05c7 - Sigstore transparency entry: 1023694802
- Sigstore integration time:
-
Permalink:
rmaher001/hass-mcp-plus@1cf466541dd5279b257262ae00d9c023c431a0f1 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/rmaher001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1cf466541dd5279b257262ae00d9c023c431a0f1 -
Trigger Event:
release
-
Statement type: