hass-mcp-plus
Enhanced Home Assistant MCP server with 22 context efficient tools for smart home control, automation trace debugging, entity registry management, CEL expression queries, and long-term statistics.
README
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
<details> <summary><strong>Claude Code (CLI)</strong></summary>
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.
</details>
<details> <summary><strong>Claude Desktop</strong></summary>
- 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
</details>
<details> <summary><strong>Cursor</strong></summary>
- 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
</details>
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。