Skip to content
Conduit

mcp server

homeassistant-mcp

Home Assistant MCP Server - Control your smart home with AI assistants via the Model Context Protocol

robbrad/homeassistant-mcpcommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

Before you start

  • uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "robbrad-homeassistant-mcp": {
      "command": "uvx",
      "args": [
        "homeassistant-mcp"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 25, 2026

Home Assistant MCP Server

A Model Context Protocol (MCP) server that lets AI assistants control Home Assistant. Built with Python and FastMCP.

Works with Claude, GPT-4, Cursor, Kiro, and any MCP-compatible client.

What it does

  • 40 tools covering lights, climate, covers, locks, media players, vacuums, fans, cameras, alarms, and more
  • BM25 tool search — LLMs discover tools on demand instead of receiving all 40 schemas upfront
  • MCP Resources for read-only entity, area, device, and service data
  • MCP Prompts for guided workflows (automation creation, troubleshooting, energy optimization)
  • Tool annotations — readOnlyHint lets clients skip confirmation prompts for safe operations
  • Smart error log parsing — deduplicates and summarises HA error logs instead of dumping raw text
  • Context-aware responses — compact list responses, domain-filtered queries, progress reporting
  • Async throughout with TTL-based caching to reduce API load

Installation

uvx (recommended)

No install needed. Just configure your MCP client:

{
  "mcpServers": {
    "homeassistant": {
      "command": "uvx",
      "args": ["homeassistant-mcp"],
      "env": {
        "HASS_HOST": "http://homeassistant.local:8123",
        "HASS_TOKEN": "your_long_lived_access_token_here"
      }
    }
  }
}

pip

pip install homeassistant-mcp
homeassistant-mcp

From source

git clone https://github.com/robbrad/homeassistant-mcp.git
cd homeassistant-mcp
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e ".[dev]"
homeassistant-mcp

Configuration

The server needs two environment variables:

VariableDescription
HASS_HOSTHome Assistant URL, e.g. http://homeassistant.local:8123
HASS_TOKENLong-lived access token (how to create one)

Optional:

VariableDefaultDescription
CACHE_TTL_STATES30Cache TTL for bulk state queries (seconds)
CACHE_TTL_ENTITY10Cache TTL for individual entity queries (seconds)
LOG_LEVELINFOLogging level

These can be set via environment variables (as shown in the MCP client configs above) or in a .env file. See .env.example.

MCP Client Setup

Claude Desktop

Add to your config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "homeassistant": {
      "command": "uvx",
      "args": ["homeassistant-mcp"],
      "env": {
        "HASS_HOST": "http://homeassistant.local:8123",
        "HASS_TOKEN": "your_token_here"
      }
    }
  }
}

Cursor / Kiro / Other MCP Clients

Same config format. Place it in your client's MCP configuration file (e.g. .cursor/mcp.json, .kiro/settings/mcp.json).

The server uses stdio transport, which is the standard for MCP.

How Tool Discovery Works

With 40 tools, the server uses BM25 search to keep the LLM's context lean. Instead of sending all 40 tool schemas upfront, the LLM sees 8 tools:

ToolPurpose
discover_toolsReturns the full catalog of all 40 tools by category
states_controlEntity state management (list, get, set, delete)
list_devicesDevice discovery with domain/area/floor filtering
call_serviceCall any HA service directly
template_renderRender Jinja2 templates in HA context
error_log_getParsed and deduplicated error log summary
search_toolsBM25 search to find tools by description
call_toolExecute a discovered tool by name

The LLM calls discover_tools() to see what's available, then search_tools(query="lights brightness") to get the full schema, then calls the tool directly.

All Tools

Device Control (16 tools)

ToolDomainCapabilities
lights_controllightBrightness, color temp, RGB
climate_controlclimateHVAC modes, temperature, fan
switch_controlswitchOn/off, bulk operations
cover_controlcoverPosition, tilt, open/close
lock_controllockLock/unlock with codes
media_player_controlmedia_playerPlayback, volume, source
camera_controlcameraSnapshots, streams, motion detection
vacuum_controlvacuumStart, dock, fan speed
fan_controlfanSpeed, oscillation, direction
alarm_controlalarm_control_panelArm/disarm modes
weather_controlweatherConditions, daily/hourly forecasts
water_heater_controlwater_heaterTemperature, modes
humidifier_controlhumidifierHumidity levels
siren_controlsirenActivation control
valve_controlvalveOpen/close
lawn_mower_controllawn_mowerStart, stop, dock

Automation & Scenes (3 tools)

ToolCapabilities
automation_controlList, trigger, enable, disable, reload
scene_controlList, activate
script_controlList, execute with variables, reload

Input Helpers (5 tools)

ToolCapabilities
input_boolean_controlToggle on/off
input_number_controlSet value, increment, decrement
input_select_controlSelect from options
input_text_controlSet text value
input_datetime_controlSet date/time

API & State (4 tools)

ToolCapabilities
api_infoAPI status, HA config, loaded components
events_controlList event types, fire custom events
services_controlList services by domain, call services
states_controlList/get/set/delete entity states with filtering

History (3 tools)

ToolCapabilities
history_queryState changes by entity + hours (not ISO timestamps)
logbook_queryHuman-readable logbook entries
error_log_getParsed, deduplicated error summary with component counts

Specialized (5 tools)

ToolCapabilities
calendar_accessList calendars, get events by date range
camera_proxy_getCamera images with optional resize
config_checkValidate HA configuration
intent_handleProcess natural language intents
template_renderRender Jinja2 templates

General (4 tools)

ToolCapabilities
list_devicesFilter by any domain, area, or floor
call_serviceCall any HA service with custom data
send_notificationSend alerts via HA notification services
discover_toolsFull tool catalog for LLM discovery

MCP Resources

URI PatternDescription
hass://entity/{entity_id}Entity state and attributes
hass://area/{area_id}Area entities (compact summaries)
hass://device/{device_id}Device entities (compact summaries)
hass://servicesAll services organized by domain
hass://entity/{entity_id}/historyEntity history with pagination

Development

git clone https://github.com/robbrad/homeassistant-mcp.git
cd homeassistant-mcp
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest

# Format and lint
black src/ tests/
ruff check src/ tests/

# Type check
mypy src/

Publishing

Commits to main auto-publish to PyPI via GitHub Actions + python-semantic-release:

  • fix: commits → patch bump (3.1.0 → 3.1.1)
  • feat: commits → minor bump (3.1.0 → 3.2.0)
  • BREAKING CHANGE: → major bump (3.1.0 → 4.0.0)

Architecture

AI Assistant  <-->  MCP Server (FastMCP/stdio)  <-->  Home Assistant REST API
                         |
                   +-----+-----+
                   |           |
                 Tools      Cache
                 Layer      Layer
  • FastMCP Server handles MCP protocol over stdio with BM25 tool search
  • Home Assistant Client is an async httpx client with auth and connection pooling
  • Cache Layer provides TTL-based caching for states and entities
  • Tools Layer — 40 tools with annotations, tags, timeouts, and context logging
  • Resources — 5 read-only data endpoints with compact response envelopes
  • Prompts — 13 guided workflows for automation, troubleshooting, and optimization

License

MIT

↑↓ navigate openesc close