Home Assistant MCP Server
Provides tools for controlling and monitoring a Home Assistant smart home instance, including lights, switches, climate devices, covers, locks, scenes, automations, areas, entities, sensors, energy usage, security checks, and calling Home Assistant services.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Home Assistant MCP Server
A specialized Model Context Protocol (MCP) server for Home Assistant device control and monitoring. This Docker-based server enables Claude Desktop and other MCP clients to interact with your Home Assistant instance for controlling smart home devices, monitoring sensors, and managing automations.
Features
Device Control: Control lights, switches, covers, locks, and climate devices
WebSocket Support: Advanced connectivity with WebSocket fallback for areas and entities
Sensor Monitoring: Organize and query 345+ sensors across 9 categories
Area Management: Access 24+ home areas via WebSocket API
Scene & Automation: Trigger scenes and execute automations
Entity Queries: Query states from 1,500+ entities
Service Execution: Call any Home Assistant service
Energy Monitoring: Track energy usage and consumption
Security Checks: Monitor locks, doors, and security sensors
Caching: Optional PostgreSQL-backed (or in-memory) response cache
Docker Support: Easy deployment with Docker and Docker Compose
Related MCP server: Home Assistant MCP Server
Prerequisites
Docker and Docker Compose (for containerized deployment)
Home Assistant: A running Home Assistant instance (local or remote)
Long-Lived Access Token: Generated from your Home Assistant profile
Network Access: Server must be able to reach your Home Assistant instance
Claude Desktop (optional): For MCP client integration
Quick Start
1. Get Your Home Assistant Access Token
Open your Home Assistant instance
Click your profile (bottom left)
Scroll to "Long-Lived Access Tokens"
Click "Create Token"
Give it a name (e.g., "MCP Server")
Copy the generated token immediately (it won't be shown again)
2. Clone and Configure
cd homeassistant-mcp
cp .env.example .env.localEdit .env.local and add your Home Assistant details:
# Home Assistant URL (include http:// or https://)
HA_URL=http://homeassistant.local:8123
# Long-lived access token
HA_TOKEN=your-long-lived-access-token-here
# SSL verification (set to false for self-signed certificates)
HA_VERIFY_SSL=true
# Debug mode
DEBUG=false
# Optional cache: a PostgreSQL database, or CACHE_BACKEND=memory for local dev
# DATABASE_URL=postgresql://user:password@host:5432/homeassistant_mcp?sslmode=require
# CACHE_BACKEND=memory3. Run with Docker Compose
docker-compose up --buildThe server will start in stdio mode, ready to accept MCP connections.
4. Connect to Claude Desktop
Add this configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"homeassistant": {
"command": "docker",
"args": ["compose", "-f", "/path/to/homeassistant-mcp/docker-compose.yml", "run", "--rm", "homeassistant-mcp"]
}
}
}Restart Claude Desktop to activate the server.
Configuration
Environment Variables
Variable | Required | Default | Description |
| Yes | - | Home Assistant URL (e.g., http://homeassistant.local:8123) |
| Yes | - | Long-lived access token |
| No |
| Verify SSL certificates (set to false for self-signed) |
| No |
| Enable debug logging |
| No | - | PostgreSQL URL for the response cache (e.g. |
| No | - | Set to |
| No | see | Override a cache TTL in seconds ( |
Available MCP Tools
The Home Assistant MCP server provides the following tools:
Device Control
Lights:
turn_on_light- Turn on a light with optional brightnessturn_off_light- Turn off a lighttoggle_light- Toggle light stateset_light_brightness- Set brightness (0-100%)
Switches:
turn_on_switch- Turn on a switchturn_off_switch- Turn off a switchtoggle_switch- Toggle switch state
Climate:
set_temperature- Set target temperatureset_hvac_mode- Set HVAC mode (heat, cool, auto, off)turn_on_climate- Turn on climate deviceturn_off_climate- Turn off climate device
Covers (Blinds/Shades):
open_cover- Open a coverclose_cover- Close a coverstop_cover- Stop cover movementset_cover_position- Set cover position (0-100%)
Locks:
lock_door- Lock a doorunlock_door- Unlock a door
Scene & Automation
activate_scene- Activate a scenetrigger_automation- Trigger an automationrun_script- Execute a script
Entity & State Queries
get_entity_state- Get state of a specific entityget_all_entities- List all entitiesget_entities_by_area- Get entities in an areaget_entities_by_domain- Get entities by type (light, switch, etc.)
Area Management
get_all_areas- List all areasget_area_devices- Get devices in an areaget_area_entities- Get entities in an area
Sensor Monitoring
get_all_sensors- Get all sensor statesget_sensors_by_category- Get sensors by category (weather, HVAC, energy, etc.)get_sensor_value- Get specific sensor value
Sensor Categories:
Weather (temperature, humidity, pressure)
Pool (temperature, chemical levels)
Air Quality (PM2.5, VOC, CO2)
HVAC (climate controls)
Energy (power, consumption)
Security (doors, locks, motion)
Media (TV, audio status)
Network (connectivity)
System (battery, diagnostics)
Service Execution
call_service- Call any Home Assistant serviceexecute_service- Execute a service with parameters
Server Management
get_server_status- Check server healthget_server_config- View server configurationtest_connection- Test Home Assistant connectionget_cache_stats- View cache performance metricsclear_cache- Clear cached dataget_cache_info- View cache backend, database and size
Local Development
Without Docker
Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -e .Set environment variables:
export HA_URL=http://homeassistant.local:8123
export HA_TOKEN=your-tokenRun the server:
python server.pyRunning the tests
pip install -e ".[dev]"
pytest -qThe PostgreSQL cache tests run only when TEST_DATABASE_URL points at a scratch database
(the tests delete every cache entry in it):
docker run -d --rm --name pgtest -e POSTGRES_PASSWORD=pw -p 55432:5432 postgres:18
TEST_DATABASE_URL=postgresql://postgres:pw@localhost:55432/postgres pytest -q
docker stop pgtestWith Docker
Build and run:
docker build -t homeassistant-mcp .
docker run -e HA_URL=http://... -e HA_TOKEN=... homeassistant-mcpTesting
Test Server Status
You can test the server by connecting via Claude Desktop and asking:
"What's the status of my Home Assistant server?"
Test Device Control
"Turn on the living room lights" "Set the bedroom temperature to 72 degrees" "Lock the front door"
Test Sensor Queries
"What's the current temperature?" "Show me all weather sensors" "What's my energy consumption?"
Test Automation
"Activate the movie night scene" "Run the good morning automation"
Troubleshooting
"Home Assistant not configured"
Solution: Ensure both HA_URL and HA_TOKEN are set in your .env.local file.
Connection Test Failed
Solution:
Verify
HA_URLis correct and accessible from the Docker containerCheck that Home Assistant is running
Ensure the access token is valid
For HTTPS with self-signed certificates, set
HA_VERIFY_SSL=false
SSL Certificate Errors
Solution:
If using a self-signed certificate, set
HA_VERIFY_SSL=falseConsider using HTTP for local network connections
Ensure certificates are valid if using HTTPS
Entity Not Found
Solution:
Use
get_all_entitiesto list available entitiesCheck entity ID format (e.g.,
light.living_room, notliving_room)Verify the entity exists in Home Assistant
WebSocket Connection Issues
Solution:
The server automatically falls back to WebSocket for certain operations
Check Home Assistant logs for WebSocket errors
Ensure WebSocket port (usually 8123) is accessible
Architecture
The Home Assistant MCP server follows this architecture:
Claude Desktop
↓ (stdio)
Docker Container
↓
MCP Server (FastMCP)
↓
Home Assistant Client
├─ REST API (primary)
├─ WebSocket API (fallback/advanced)
└─ SSE (Server-Sent Events)
↓
Home Assistant Instance
├─ Entities (1,500+)
├─ Areas (24+)
├─ Sensors (345+)
└─ ServicesAn optional cache (a table in the service's PostgreSQL database, or in-memory for local development) reduces calls to Home Assistant. Cache errors never fail a request: the server backs off for 30 seconds and calls Home Assistant directly.
Advanced Features
WebSocket Areas Support
The server uses WebSocket API to access area information when REST API is insufficient. This provides:
Real-time area updates
Access to 24+ home areas
Comprehensive device listings per area
Sensor Categorization
Sensors are automatically categorized into 9 groups:
Weather: Temperature, humidity, pressure sensors
Pool: Pool temperature, chemical sensors
Air Quality: PM2.5, VOC, CO2 sensors
HVAC: Climate and heating sensors
Energy: Power and consumption sensors
Security: Door, lock, motion sensors
Media: TV and audio status sensors
Network: Connectivity sensors
System: Battery and diagnostic sensors
Percentage-Based Brightness
Light brightness is handled as percentages (0-100%) for better usability, automatically converting to Home Assistant's 0-255 range.
Security Notes
Never commit your
.env.localfile or access tokens to version controlUse environment-specific
.envfilesConsider network isolation for Docker containers
Long-lived access tokens should be rotated periodically
Use HTTPS for remote Home Assistant connections
Tokens are never exposed through MCP tool responses
Performance
Automatic Caching: Entity states are cached to reduce API calls
WebSocket Fallback: Efficient real-time updates via WebSocket
Shared Cache: Optional PostgreSQL cache shared by every replica
Connection Pooling: Reuses HTTP connections for better performance
Entity ID Format
Home Assistant uses domain-prefixed entity IDs:
Lights:
light.living_room_lampSwitches:
switch.bedroom_fanSensors:
sensor.outdoor_temperatureClimate:
climate.thermostatCovers:
cover.bedroom_blindsLocks:
lock.front_door
License
Released under the Apache License 2.0; see LICENSE.
Support
For Home Assistant documentation, visit: https://www.home-assistant.io/docs/
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Control your existing Philips lights, Sonos speakers, Roborock vacuums and other supported devices through Port OS cloud. Give ChatGPT, Claude and other MCP-compatible assistants access to the devices you connect. Turn off the living room lights, play music on your speakers, adjust the thermostat, run a vacuum in a room, check a camera snapshot or find a connected tracker. Available actions depend on your linked provider accounts and each device’s supported capabilities. Port OS runs in the cloud; no local server is required. You choose the account, device and capability permissions each assistant receives. Device operations require user OAuth; public tool discovery does not grant device access. Port OS is in alpha. Setup: https://portoperatingsystem.com/docs/getting-started/ Support: https://portoperatingsystem.com/contact/
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Atendio is a WhatsApp AI assistant for businesses in Latin America, on the official WhatsApp Business Platform. This MCP server lets Claude (or any MCP client) list and read WhatsApp conversations, view analytics and assistant settings, and create, edit or delete the rules your AI assistant follows. Remote, OAuth 2.1; the business always reviews and publishes rule changes.
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control and monitor Home Assistant smart home devices through natural language interactions. Supports device control, entity state monitoring, history access, and automation generation with both MCP protocol and standalone HTTP REST API modes.1MIT
- FlicenseBqualityNot gradedmaintenanceEnables control and monitoring of Home Assistant smart home devices through MCP, allowing users to list entities, check device states, and call services to control lights, switches, sensors, and other connected devices.4-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to control Home Assistant smart home devices via MCP, with zero external dependencies. Supports calling services, getting states, and looking up service parameters.MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to read and control Home Assistant devices via natural language, with configurable safety restrictions on sensitive actions.3MIT