Skip to main content
Glama

Hass-MCP-Plus

PyPI version License: MIT Docker Pulls Tests

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

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 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 host and use http://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

Related MCP server: hass-mcp-server

Client Configuration

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.

  1. Open Claude Desktop → Settings → Developer → Edit Config

  2. 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"
      }
    }
  }
}
  1. Replace YOUR_LONG_LIVED_TOKEN with your actual token and update HA_URL to match your Home Assistant instance

  2. Save and restart Claude Desktop

  1. Go to Cursor Settings → MCP → Add New MCP Server

  2. 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
  3. Replace YOUR_LONG_LIVED_TOKEN with your actual token and update HA_URL

  4. 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 filtering

  • entity_action: Perform actions on entities (turn on, off, toggle) with domain-specific parameters

  • list_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 attributes

  • query_entities: Filter entities using CEL expressions with numeric comparisons and boolean logic

  • domain_summary: Get a summary of a domain's entities with state distribution and examples

  • system_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/unhide

  • remove_entity: Remove an entity from the registry (requires explicit confirm=True flag)

Automation & Debugging

  • list_automations: Get all automations with pagination support

  • list_automation_traces: Get recent execution traces for a specific automation

  • get_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 filtering

  • get_core_logs: Get core journal logs (DEBUG/INFO/WARNING/ERROR) with integration/pattern filtering

  • set_log_level: Set log level for any integration (enable debug logging, then read with get_core_logs)

Historical Data

  • get_history: Get raw state change history with automatic pagination and sampling

  • get_history_range: Get state changes for a specific date/time range with sampling strategies

  • get_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 version

  • call_service: Call any Home Assistant service (low-level API access)

  • restart_ha: Restart Home Assistant

Development

Running Tests

uv run pytest tests/ -v

License

MIT License

Available Tools

22 tools
call_serviceB

Call any Home Assistant service directly (low-level API).

Args: domain: Service domain (e.g. 'light', 'automation') service: Service name (e.g. 'turn_on', 'reload') data: Service data (e.g. {'entity_id': 'light.x', 'brightness': 255})

Examples: call_service("light", "turn_on", {"entity_id": "light.x", "brightness": 255}) call_service("automation", "reload")

Inputs: domain (required), service (required), data.

domain_summaryA

Get a summary of entities in a domain (counts, state distribution, examples).

Args: domain: Domain to summarize (e.g. 'light', 'switch', 'sensor') example_limit: Max examples per state (default: 3)

Examples: domain_summary("light") domain_summary("climate", example_limit=5)

Inputs: domain (required), example_limit.

entity_actionA

Perform an action on a Home Assistant entity (on, off, toggle).

Args: entity_id: Entity ID to control (e.g. 'light.living_room') action: 'on', 'off', or 'toggle' params: Additional service parameters (e.g. {"brightness": 255, "temperature": 22.5})

Domain-specific params: Lights: brightness (0-255), color_temp, rgb_color, transition, effect Covers: position (0-100), tilt_position Climate: temperature, target_temp_high, target_temp_low, hvac_mode Media players: source, volume_level (0-1)

Examples: entity_action("light.living_room", "on", {"brightness": 255}) entity_action("switch.garden_lights", "off")

Inputs: entity_id (required), action (required), params.

get_automation_traceA

Get detailed trace for a specific automation run (trigger, conditions, actions, errors).

Args: automation_id: Automation ID (e.g. 'motion_light') run_id: Run/trace ID from list_automation_traces domain: 'automation' or 'script' (default: 'automation')

Examples: get_automation_trace("motion_light", "1700000000.123456")

Inputs: automation_id (required), run_id (required), domain.

get_core_logsA

Get Home Assistant core logs (all levels) from the Supervisor journal, with fallback to error log.

Args: limit: Max records (1-200, default: 50) level: Filter: "DEBUG", "INFO", "WARNING", or "ERROR" integration: Filter by integration (e.g. "mqtt", "llmvision") pattern: Case-insensitive substring match on message since_minutes: Only logs from last N minutes lines: Journal lines to request (default: 500) truncate_traces: Truncate stacktraces to 3 lines (default: True)

Use set_log_level to enable DEBUG before reading debug logs; reset to WARNING after.

Examples: get_core_logs(level="DEBUG", integration="llmvision") get_core_logs(pattern="timeout", since_minutes=60)

Inputs: limit, level, integration, pattern, +3 more.

get_entityA

Get the state of a Home Assistant entity with optional field filtering.

Args: entity_id: Entity ID (e.g. 'light.living_room') fields: Fields to include (e.g. ['state', 'attr.brightness']) detailed: If True, returns all fields unfiltered

Examples: get_entity("light.living_room", fields=["state", "attr.brightness"])

Inputs: entity_id (required), fields, detailed.

get_entity_registryA

Get the full entity registry entry (platform, config, device, disabled/hidden, area).

Args: entity_id: Entity ID to look up (e.g. 'light.living_room')

Examples: get_entity_registry("light.living_room")

Inputs: entity_id (required).

get_error_logA

Get the Home Assistant error log (WebSocket API). Stacktraces truncated by default.

Args: limit: Max records (1-100, default: 50) integration: Filter by integration (e.g. "mqtt", "zwave") level: Filter by level: "ERROR" or "WARNING" since_minutes: Only errors from last N minutes truncate_traces: Truncate stacktraces to 3 lines (default: True)

Examples: get_error_log(integration="mqtt") get_error_log(level="ERROR", since_minutes=60)

Inputs: limit, integration, level, since_minutes, +1 more.

get_historyA

Get raw state changes for an entity. For aggregated trends, use get_statistics instead.

By default returns last N hours. Provide start_time to query a specific date range instead. Best for: exact state change timestamps, infrequently-changing entities (doors, switches), short time periods. NOT for: long ranges on frequently-updating sensors — use get_statistics.

Args: entity_id: Entity ID to get history for hours: Hours of history (default: 24). Ignored if start_time is provided. start_time: ISO 8601, date only, or 'yesterday'/'today'. If set, uses range mode instead of hours. end_time: End of range (default: 'now'). Only used with start_time. limit: Max records (1-500, default: 100) sample_strategy: 'recent' (default), 'first', or 'even' — how to sample if over limit minimal_response: Reduce response size in range mode (default: true)

Examples: get_history("binary_sensor.front_door") get_history("sensor.temperature", hours=1, limit=50) get_history("sensor.temp", start_time="2025-10-28T10:00:00Z", end_time="2025-10-28T11:00:00Z") get_history("light.living_room", start_time="yesterday", end_time="today")

Inputs: entity_id (required), hours, start_time, end_time, +3 more.

get_statisticsA

Get aggregated statistics (mean/min/max) for an entity. Best tool for historical data — no token limits.

By default returns last N hours. Provide start_time to query a specific date range instead. Handles any range efficiently (days, months, years). If get_history hits token limits, use this tool with the same time range instead.

Args: entity_id: Entity ID to get statistics for hours: Hours of data (default: 24). Ignored if start_time is provided. start_time: ISO 8601, date only, or 'yesterday'/'today'. If set, uses range mode instead of hours. end_time: End of range (default: 'now'). Only used with start_time. period: Aggregation period (default: 'hour'): '5minute' (~12 points/hr), 'hour' (24/day), 'day' (monthly views), 'week' (quarterly), 'month' (yearly). Match period to time range.

Examples: get_statistics("sensor.temperature", hours=24, period="hour") get_statistics("sensor.power_usage", hours=168, period="day") get_statistics("sensor.temperature", start_time="2024-10-01", end_time="2024-10-31", period="day") get_statistics("sensor.humidity", start_time="yesterday", period="5minute")

Inputs: entity_id (required), hours, start_time, end_time, +1 more.

get_versionA

Get the Home Assistant version.

Inputs: no named parameters.

list_automationsA

List automations with their IDs, entity IDs, state, and aliases.

Args: limit: Max automations to return (1-200, default: 50)

Examples: list_automations() list_automations(limit=200)

Inputs: limit.

list_automation_tracesA

List recent execution traces for a specific automation.

Args: automation_id: Automation ID (e.g. 'motion_light' or 'automation.motion_light') domain: 'automation' or 'script' (default: 'automation') limit: Max traces to return (default: 10, max: 50)

Use run_id from results with get_automation_trace for full details.

Examples: list_automation_traces("motion_light") list_automation_traces("kitchen_lights", limit=5)

Inputs: automation_id (required), domain, limit.

list_entitiesB

List Home Assistant entities with optional filtering.

Args: domain: Domain filter (e.g. 'light', 'switch', 'sensor') search_query: Search by name, id, or attributes (no wildcards) limit: Max entities to return (default: 100) fields: Specific fields to include per entity detailed: If True, returns all fields unfiltered compact: If True, returns only entity_id/state/friendly_name (overrides detailed/fields)

Examples: list_entities(domain="light") list_entities(search_query="kitchen", limit=20) list_entities(compact=True)

Inputs: domain, search_query, limit, fields, +2 more.

list_entity_registryA

List entity registry entries (platform, config, disabled/hidden, area). Not states — use list_entities for states.

Args: domain: Domain filter (e.g. 'light', 'sensor') limit: Max entries (default: 100, max: 5000)

Examples: list_entity_registry(domain="light") list_entity_registry(domain="sensor", limit=50)

Inputs: domain, limit.

query_entitiesA

Query entities using CEL (Common Expression Language) expressions.

CEL context: entity_id (string), state (numeric if possible, else string), domain (string), attributes (dict).

Args: domain: Domain pre-filter (e.g. "sensor", "light") expression: CEL filter expression limit: Max entities (default: 50) lean: Minimal fields with domain-specific attrs (default: True) compact: Only entity_id/state/friendly_name (default: False)

CEL examples: domain="sensor", expression='state < 30 && attributes.device_class == "battery"' domain="light", expression='state == "on" && attributes.brightness < 50' expression='state == "unavailable" || state == "unknown"'

Inputs: domain, expression, limit, lean, +1 more.

remove_entityA

Remove an entity from the entity registry. Two-phase safety: preview first, then confirm.

By default returns a preview. Set confirm=True to actually delete. Entity may reappear if integration recreates it; consider disable instead.

Args: entity_id: Entity ID to remove (e.g. 'light.old_device') confirm: False=preview (default), True=permanently remove

Examples: remove_entity("light.orphaned_device") # preview remove_entity("light.orphaned_device", confirm=True) # delete

Inputs: entity_id (required), confirm.

restart_haA

Restart Home Assistant. WARNING: Temporarily disrupts all operations.

Inputs: no named parameters.

search_entitiesA

Search for entities matching a query string across IDs, names, and attributes.

Args: query: Search term (no wildcards; empty string returns all entities) limit: Max results (default: 20)

Examples: search_entities("temperature") search_entities("living room", limit=10)

Inputs: query (required), limit.

set_log_levelA

Set the log level for a Home Assistant integration.

Args: integration: Integration name (e.g. "mqtt", "llmvision") level: "debug", "info", "warning", or "error" custom_component: If True, targets custom_components.X (for HACS integrations)

Examples: set_log_level("mqtt", "debug") set_log_level("llmvision", "debug", custom_component=True) set_log_level("mqtt", "warning") # reset to normal

Inputs: integration (required), level (required), custom_component.

system_overviewA

Get a comprehensive overview of the Home Assistant system (domain counts, samples, areas).

Good first call when exploring an unfamiliar instance. Use domain_summary to drill deeper.

Inputs: no named parameters.

update_entityA

Update entity registry properties (name, icon, area, disable/enable, hide/unhide, rename).

For fields that can be cleared, pass "none" as the string value to set to null.

Args: entity_id: Entity ID to update name: Friendly name (or "none" to clear) icon: Icon (e.g. 'mdi:lamp', or "none" to clear) disabled_by: "user" to disable, "none" to re-enable hidden_by: "user" to hide, "none" to unhide area_id: Area ID (or "none" to remove) new_entity_id: Rename entity ID (e.g. 'light.new_name') options: Platform options dict

Examples: update_entity("sensor.old", disabled_by="user") update_entity("sensor.old", disabled_by="none") # re-enable update_entity("light.x", name="Living Room Lamp", area_id="kitchen")

Inputs: entity_id (required), name, icon, disabled_by, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 22 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. Overlapping entity retrieval tools (get_entity, list_entities, search_entities, query_entities, get_entity_registry, list_entity_registry) are differentiated by focus and filtering. get_history and get_statistics clearly explain when to use each.

    Naming Consistency5/5

    All tool names use snake_case consistently, following a verb_noun pattern (e.g., call_service, list_automations, get_automation_trace). No mixing of conventions or vague names.

    Tool Count5/5

    22 tools is well-scoped for a Home Assistant MCP server, covering entity control, querying, history, automations, logs, and system management without being overwhelming or insufficient.

    Completeness5/5

    The tool surface covers core Home Assistant operations: entity CRUD, service calls, history/statistics, automation traces, logs, system overview, version, restart, and log level control. Obvious gaps like entity creation are intentionally out of scope.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      An 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.
      657
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server for full Home Assistant control, enabling AI agents to manage dashboards, automations, files, apps, entities, and more via REST API, WebSocket, and SSH.
      66
      151 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      An MCP server that layers additional Home Assistant tools on top of voska/hass-mcp, enabling Lovelace dashboard management, automation/scene manipulation, SSH file access, and recorder database queries.
      28
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      A self-hosted MCP server for Home Assistant that exposes full control over entity states, service calls, history, templates, and areas via local stdio, enabling AI assistants to manage your smart home.
      9
      MIT