hass-mcp

v0.6.2
hass-mcp Checked 7 hours ago Published 12 days ago

Home Assistant Model Context Protocol (MCP) server

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_version

Get the Home Assistant version Returns: A string with the Home Assistant version (e.g., "2025.3.0")

get_entity

Get the state of a Home Assistant entity with optional field filtering Args: entity_id: The entity ID to get (e.g. 'light.living_room') fields: Optional list of fields to include (e.g. ['state', 'attr.brightness']) detailed: If True, returns all entity fields without filtering Examples: entity_id="light.living_room" - basic state check entity_id="light.living_room", fields=["state", "attr.brightness"] - specific fields entity_id="light.living_room", detailed=True - all details

ParameterTypeDescription
entity_id *string
detailedboolean
fields

entity_action

Perform an action on a Home Assistant entity (on, off, toggle) Args: entity_id: The entity ID to control (e.g. 'light.living_room') action: The action to perform ('on', 'off', 'toggle') params: Optional dictionary of additional parameters for the service call Returns: The response from Home Assistant Examples: entity_id="light.living_room", action="on", params={"brightness": 255} entity_id="switch.garden_lights", action="off" entity_id="climate.living_room", action="on", params={"temperature": 22.5} Domain-Specific Parameters: - Lights: brightness (0-255),…

ParameterTypeDescription
action *string
entity_id *string
params

list_entities

Get a list of Home Assistant entities with optional filtering Args: domain: Optional domain to filter by (e.g., 'light', 'switch', 'sensor') search_query: Optional search term to filter entities by name, id, or attributes (Note: Does not support wildcards. To get all entities, leave this empty) limit: Maximum number of entities to return (default: 100) fields: Optional list of specific fields to include in each entity detailed: If True, returns all entity fields without filtering Returns: A list of entity dictionaries with lean formatting by default…

ParameterTypeDescription
detailedboolean
domain
fields
limitinteger
search_query

get_entities_by_area

Get all entities assigned to a specific Home Assistant area (room). Area lookup is case-insensitive and matches the area's name as configured in Home Assistant (e.g., "Kitchen", "Living Room"). Entities inherit their area from their parent device when no area is set directly, matching HA's own resolution behavior. Args: area: Name of the area to filter by (case-insensitive) domain: Optional domain to further filter results (e.g., 'light') lean: If True (default), returns token-efficient entity records Returns: A dictionary containing: - area: The matched area name (as c…

ParameterTypeDescription
area *string
domain
leanboolean

search_entities_tool

Search for entities matching a query string Args: query: The search query to match against entity IDs, names, and attributes. (Note: Does not support wildcards. To get all entities, leave this blank or use list_entities tool) limit: Maximum number of results to return (default: 20) Returns: A dictionary containing search results and metadata: - count: Total number of matching entities found - results: List of matching entities with essential information - domains: Map of domains with counts (e.g. {"light": 3, "sensor": 2}) Examples: query="temperat…

ParameterTypeDescription
query *string
limitinteger

domain_summary_tool

Get a summary of entities in a specific domain Args: domain: The domain to summarize (e.g., 'light', 'switch', 'sensor') example_limit: Maximum number of examples to include for each state Returns: A dictionary containing: - total_count: Number of entities in the domain - state_distribution: Count of entities in each state - examples: Sample entities for each state - common_attributes: Most frequently occurring attributes Examples: domain="light" - get light summary domain="climate", example_limit=5 - climate summary with more examples Best Practices…

ParameterTypeDescription
domain *string
example_limitinteger

system_overview

Get a comprehensive overview of the entire Home Assistant system Returns: A dictionary containing: - total_entities: Total count of all entities - domains: Dictionary of domains with their entity counts and state distributions - domain_samples: Representative sample entities for each domain (2-3 per domain) - domain_attributes: Common attributes for each domain - area_distribution: Entities grouped by area (if available) Examples: Returns domain counts, sample entities, and common attributes Best Practices: - Use this as the first call when exploring an u…

list_automations

Get a list of all automations from Home Assistant This function retrieves all automations configured in Home Assistant, including their IDs, entity IDs, state, and display names. Returns: A list of automation dictionaries, each containing id, entity_id, state, and alias (friendly name) fields. Examples: Returns all automation objects with state and friendly names

restart_ha

Restart Home Assistant ⚠️ WARNING: Temporarily disrupts all Home Assistant operations Returns: Result of restart operation

call_service_tool

Call any Home Assistant service (low-level API access) Args: domain: The domain of the service (e.g., 'light', 'switch', 'automation') service: The service to call (e.g., 'turn_on', 'turn_off', 'toggle') data: Optional data to pass to the service (e.g., {'entity_id': 'light.living_room'}) Returns: A dictionary with success status, the domain/service called, and the list of affected entity states returned by Home Assistant. Examples: domain='light', service='turn_on', data={'entity_id': 'light.x', 'brightness': 255} domain='automation', service='reload' domai…

ParameterTypeDescription
domain *string
service *string
data

list_dashboards

List Home Assistant dashboards (Lovelace) Returns: A list of dashboards. Each entry has `url_path` (None for the default "Overview" dashboard), `title`, and `mode` ("storage" or "yaml"). Only "storage"-mode dashboards can be edited via these tools.

get_dashboard_config

Get a dashboard's full configuration Args: url_path: The dashboard's URL path (e.g. "my-dash"). Omit or pass None for the default "Overview" dashboard. Returns: The dashboard config dict (a top-level `views` list of cards). If the dashboard has no stored config yet, returns an empty `{"views": []}` scaffold with a `note`.

ParameterTypeDescription
url_path

set_dashboard_config

Replace a dashboard's full configuration (low-level write) ⚠️ WARNING: Overwrites the ENTIRE dashboard and updates every open browser live. The prior config is backed up first (use restore_dashboard to undo). Requires an admin token; only storage-mode dashboards can be saved. Args: url_path: Dashboard URL path, or None for the default dashboard. config: The complete new config dict (must contain a `views` list). dry_run: If True, validate and return the resulting config + a change summary WITHOUT saving. Returns: On save: {success, url_path, backup_id, summ…

ParameterTypeDescription
config
dry_runboolean
url_path

add_card

Add a card to a dashboard view (live) Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view — an integer index, or a string matching the view's `path` or `title`. card: The card config dict (must include a string `type`), e.g. {"type": "markdown", "content": "Hello"}. position: Insert index within the target card list (default: append). section: For a "sections"-type view, which section to add into — an index, section title, or heading text. REQUIRED for sections views (use list_view_sect…

ParameterTypeDescription
card
dry_runboolean
position
section
url_path
view

update_card

Replace a card in a dashboard view (live) Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view (index, or matching `path`/`title`). card_index: Index of the card to replace within the target card list. card: The new card config dict (must include a string `type`). section: For a "sections"-type view, which section the card is in (index/title/heading). Required for sections views. dry_run: Preview without saving. Returns: Save result with a `backup_id`, or a dry-run preview.

ParameterTypeDescription
card
card_indexinteger
dry_runboolean
section
url_path
view

remove_card

Remove a card from a dashboard view (live) Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view (index, or matching `path`/`title`). card_index: Index of the card to remove within the target card list. section: For a "sections"-type view, which section the card is in (index/title/heading). Required for sections views. dry_run: Preview without saving. Returns: Save result with a `backup_id`, or a dry-run preview.

ParameterTypeDescription
card_indexinteger
dry_runboolean
section
url_path
view

move_card

Reorder a card within a dashboard view (live) Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view (index, or matching `path`/`title`). card_index: Current index of the card. new_index: Destination index within the same card list. section: For a "sections"-type view, which section the card is in (index/title/heading). Required for sections views. dry_run: Preview without saving. Returns: Save result with a `backup_id`, or a dry-run preview.

ParameterTypeDescription
card_indexinteger
dry_runboolean
new_indexinteger
section
url_path
view

list_view_sections

List the sections of a "sections"-type dashboard view Modern Home Assistant views of `type: sections` hold their cards inside sections (not a top-level card list). Use this to discover which section to target with the card tools' `section` argument. Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view (index, or matching `path`/`title`). Returns: A list of {index, title, heading, card_count}, one per section. Errors if the view is not a sections view.

ParameterTypeDescription
url_path
view

add_view

Add a new view to a dashboard (live) Args: url_path: Dashboard URL path, or None for the default dashboard. view_config: The view config dict, e.g. {"title": "Garage", "path": "garage"}. position: Insert index among views (default: append). dry_run: Preview without saving. Returns: Save result with a `backup_id`, or a dry-run preview.

ParameterTypeDescription
dry_runboolean
position
url_path
view_config

remove_view

Remove a view from a dashboard (live) ⚠️ Removes the view and all its cards. Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view (index, or matching `path`/`title`). dry_run: Preview without saving. Returns: Save result with a `backup_id`, or a dry-run preview.

ParameterTypeDescription
dry_runboolean
url_path
view

update_view

Update a view's properties — title, path, icon, etc. (live) Cards in the view are preserved unless `changes` includes a `cards` key. Args: url_path: Dashboard URL path, or None for the default dashboard. view: Target view (index, or matching `path`/`title`). changes: Dict of view properties to merge in, e.g. {"title": "New Title"}. dry_run: Preview without saving. Returns: Save result with a `backup_id`, or a dry-run preview.

ParameterTypeDescription
changes
dry_runboolean
url_path
view

list_dashboard_backups

List on-disk backups of a dashboard's config Backups are written automatically before every dashboard write. NOTE: in Docker, backups persist only if HASS_MCP_BACKUP_DIR is volume-mounted. Args: url_path: Dashboard URL path, or None for the default dashboard. Returns: A list of {backup_id, path}, oldest first.

ParameterTypeDescription
url_path

restore_dashboard

Restore a dashboard from a backup (live) Restores the most recent backup unless `backup_id` is given. The current config is itself backed up first, so a restore can be undone. Args: url_path: Dashboard URL path, or None for the default dashboard. backup_id: A specific backup id from list_dashboard_backups (default: newest). dry_run: Preview without saving. Returns: Save result plus `restored_from`, or a dry-run preview.

ParameterTypeDescription
backup_id
dry_runboolean
url_path

get_history

Get the history of an entity's state changes Args: entity_id: The entity ID to get history for hours: Number of hours of history to retrieve (default: 24) Returns: A dictionary containing: - entity_id: The entity ID requested - states: List of state objects with timestamps - count: Number of state changes found - first_changed: Timestamp of earliest state change - last_changed: Timestamp of most recent state change Examples: entity_id="light.living_room" - get 24h history entity_id="sensor.temperature", hours=168 - get 7 day history Best Practice…

ParameterTypeDescription
entity_id *string
hoursinteger

get_history_range

Get raw state-change history for an entity over a date/time range. Like `get_history`, but takes an explicit window instead of "N hours from now". Useful for inspecting what happened on a specific day or correlating with an external event. Args: entity_id: The entity to fetch history for. start_time: ISO-8601 start (e.g. `2026-05-15` or `2026-05-15T08:00:00Z`). Treated as UTC if no offset. end_time: ISO-8601 end. Defaults to now (UTC). Returns: Same shape as `get_history`: `entity_id`, `states`, `count`, `first_changed`, `last_changed`. Examples: ge…

ParameterTypeDescription
entity_id *string
start_time *string
end_time

get_statistics

Get long-term aggregated statistics for an entity over the last N hours. Uses HA's recorder statistics (over WebSocket) — aggregated buckets (mean / min / max per period) that survive the short-term retention window. Use this instead of `get_history` when: - You want data older than the recorder's default 10-day window. - You want aggregated values rather than every individual change. - The entity is a high-frequency sensor (temperature, power) and raw history would be too many tokens. Args: entity_id: The entity (must have a `state_class` HA records as…

ParameterTypeDescription
entity_id *string
hoursinteger
periodstring

get_statistics_range

Get long-term aggregated statistics for an entity over a date/time range. Same data source as `get_statistics`, but with an explicit window — useful for "what was my power usage from Jan 1 to Jan 31?" type questions. Aggregated bucket data survives the short-term retention window, so this works for data months/years old. Args: entity_id: The entity (must be statistics-tracked). start_time: ISO-8601 start (`2026-01-01` or `2026-01-01T00:00:00Z`). UTC if no offset. end_time: ISO-8601 end. Defaults to now. period: `5minute`, `hour`, `day`, `week`, or `month`.…

ParameterTypeDescription
entity_id *string
start_time *string
end_time
periodstring

get_error_log

Get the Home Assistant error log for troubleshooting. All filters are optional and combine (AND semantics). Stats (error_count, warning_count, integration_mentions, total_lines) are computed over the filtered output so they match what's returned. Args: level: Filter to lines containing this log level — ERROR, WARNING, INFO, or DEBUG. Case-insensitive. integration: Filter to lines mentioning this integration. Matches `[name]` or `[homeassistant.components.name]`. Case-insensitive. search_term: Case-insensitive substring filter applie…

ParameterTypeDescription
integration
level
lines
search_term