ha-ai
Provides tools for interacting with Home Assistant, enabling AI agents to inspect and configure dashboards, manage automations and scripts, list entities, retrieve logs, and create or restore backups, with visual rendering capabilities for UI validation.
Click on "Deploy 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., "@ha-aitake a screenshot of my dashboard on mobile viewport"
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 AI Helper (ha-ai)
Lightweight, paranoid-secure Home Assistant MCP Server and OS App with client-side Playwright visual feedback for autonomous AI agents.
Overview
The ha-ai platform enables autonomous AI coding agents (such as Antigravity, Gemini CLI, Claude Code, OpenCode, and Cursor) to safely inspect, configure, iterate on, and visually validate a remote Home Assistant instance.
Primary Capabilities
ðïļ Visual Dashboard Iteration: Render Lovelace dashboards headlessly via client-side Playwright, capture full or card-level screenshots across desktop, tablet, and mobile viewports, and visually iterate until UI design is perfected.
⥠Full Lifecycle Automation & Script Authoring: Safely read, write, validate, and trigger automations and scripts with automatic syntax checks and zero-downtime service reloads.
ðĄïļ Paranoid Security: Strict path jailing within
/config, constant-time API key verification, automatic secret redaction, and zero unauthorized command execution.ðŠķ Minimal Server Footprint: Lightweight Python FastAPI container running as a Home Assistant OS App (< 35MB RAM, ~0% idle CPU) with zero heavy browser or ML dependencies on the HA host.
ð Atomic Snapshots & One-Click Rollback: Automatic pre-edit snapshots created before every file modification, with instant atomic rollback capabilities.
Related MCP server: pagelens
Architecture
flowchart TD
subgraph Workstation["Local Workstation / AI Agent Host"]
Agent["AI Coding Agent<br/>(Antigravity / Claude / OpenCode)"]
MCPServer["Local MCP Server<br/>(TypeScript / Stdio)"]
Renderer["Playwright Browser Engine<br/>(Client-Side Headless)"]
Agent <-->|"Model Context Protocol"| MCPServer
MCPServer -->|"Render Requests"| Renderer
end
subgraph HAHost["Remote Home Assistant OS Instance"]
HACore["Home Assistant Core<br/>(REST & WebSocket APIs)"]
Addon["AI Helper App<br/>(FastAPI / Alpine Container)"]
Storage["HA Filesystem (/config)<br/>- automations.yaml<br/>- ui-lovelace.yaml<br/>- .snapshots/<br/>- home-assistant.log<br/>- audit.jsonl"]
Addon -->|"Mounts rw"| Storage
end
MCPServer <-->|"HTTPS / WSS :8123"| HACore
MCPServer <-->|"HTTP :8099 (X-Addon-API-Key / Ephemeral Token)"| Addon
Renderer -.->|"HTTP/S (Render Web UI)"| HACoreSecurity & Safety Highlights
Security Guard | Implementation | Protection |
Path Traversal Jail |
| Prevents access to |
Constant-Time Auth |
| Eliminates timing-attack vulnerabilities against app API authentication. |
Deny-List Protection | File path blocking on | Protects sensitive user credentials and tokens from being read or overwritten. |
Secret Redaction | Regex redaction filters on log streaming | Automatically sanitizes passwords, long-lived tokens, and API keys from tail logs. |
Atomic Pre-Edit Snapshots | Automated | Guarantees safe rollback to the exact prior disk state upon syntax or runtime errors. |
Role-Based Access Control | Ephemeral token issuance with strict policy bounds ( | Restricts AI subagents to explicit tool, file, and service boundaries, limiting blast radius. |
Audit Logging Service | Append-only JSONL event logging across API endpoints ( | Provides immutable, queryable records of all AI actions, blocked attempts, and operational rationale. |
Quickstart
1. Prerequisites
Node.js 20+ and npm installed locally.
Python 3.11+ with
uv(for running app tests locally).Running Home Assistant OS instance.
2. Installation & Build
# Clone the repository
git clone https://github.com/sserhii-tech/home-assistant-mcp.git
cd home-assistant-mcp
# Install root dependencies
npm install
# Build the TypeScript MCP server
npm run build3. Developer Workflows & Commands
# Local Development: Start App daemon with hot-reloading on :8099
npm run dev:addon
# Local Development: Start MCP server in TypeScript watch mode
npm run dev:mcp
# Run full test suites (TypeScript Vitest & Python Pytest)
npm test
npm run test:addon
# Synchronize versions across all manifests and code atomically
npm run version:bump patch # e.g. 0.1.0 -> 0.1.1
npm run version:bump minor # e.g. 0.1.0 -> 0.2.0
npm run version:bump 1.0.0 # explicit version targetMCP Tools Reference
The server exposes 15 specialized tools under the Model Context Protocol:
ð Dashboard Tools
Tool Name | Parameters | Description |
|
| Retrieve Lovelace dashboard configuration via WebSocket or storage file. |
|
| Validate YAML schema, trigger automatic safety snapshot, and commit dashboard updates. |
|
| Render high-resolution PNG screenshot via Playwright (presets: |
âïļ Automation & Script Tools
Tool Name | Parameters | Description |
|
| List active automations/scripts with entity IDs, friendly names, and trigger times. |
|
| Fetch the exact YAML definition of a specific automation or script. |
|
| Validate YAML syntax, snapshot file, update automation block, and trigger service reload. |
|
| Manually trigger an automation or script entity to verify execution. |
ð ïļ System, Diagnostics & Safety Tools
Tool Name | Parameters | Description |
| (none) | Check health and connectivity of both Home Assistant Core and the App daemon. |
|
| Search and filter entities by domain (e.g. |
|
| Invoke any Home Assistant domain service (e.g. |
|
| Retrieve the last $N$ lines of Home Assistant core logs with automatic secret redaction. |
|
| Create a named manual snapshot backup in |
|
| Atomically restore a file from a snapshot ID with safety backup preservation. |
ð Security, Audit & Agent Management
Tool Name | Parameters | Description |
|
| Query immutable JSONL audit logs for security, troubleshooting, and compliance filtering by agent, role, or status. |
|
| Issue a short-lived ephemeral token dynamically scoped to specific RBAC role boundaries (default 60m TTL). |
| (none) | Retrieve all active RBAC agent roles, their tool permissions, path restrictions, and service whitelists. |
AI Skill Pack (skills/)
This repository includes 4 production-ready AI agent skills:
ðŪ
ha-device-controller: Standard Operating Procedure for querying entity states, executing domain service requests (lights, switches, climate, media), and verifying post-execution state transitions.ðĻ
ha-dashboard-designer: Standard Operating Procedure for entity discovery, Lovelace card drafting, responsive layout verification, and iterative screenshot-based visual feedback loops.ð§
ha-automation-builder: Standard Operating Procedure for drafting automations, validating trigger conditions, safe saving with automatic reloads, and log trace verification.ðĻ
ha-troubleshooter: Safety SOP for diagnosing integration errors, analyzing sanitized logs, and triggering immediate rollback restorations.
Documentation
For full installation instructions, app configuration, agent integration guides (Antigravity, Gemini CLI, Claude Desktop, OpenCode, Cursor), and network architecture details, see:
ð Full Installation & Setup Guide
License
This project is licensed under the Apache License, Version 2.0. See LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted browser for AI agents: screenshots, post-JS DOM, console, WCAG. No install, no API key.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
- openhelmOAuthai.openhelm
Autonomous cloud agent tasks: real browser + your tools, structured evidence-backed results.
Related MCP Servers
FlicenseNot gradedqualityCmaintenanceEnables AI agents to capture screenshots and inspect DOM elements from connected browser pages via WebSocket.-- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents to visually interact with frontend apps by taking screenshots, clicking elements, reading console logs, and performing visual diffs.4 npm3MIT
- AlicenseAqualityBmaintenanceEnables AI coding assistants to visually inspect local web pages by providing screenshots, console errors, and sanitized DOM snapshots.13 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to see and interact with real Chrome pages through structured DOM inspection, targeted screenshots, recordings, and human-in-the-loop approvals across major coding-agent hosts.MIT