Home Assistant MCP
This MCP server enables AI assistants to control Home Assistant smart home devices through natural language commands.
Capabilities:
Search for devices - Find Home Assistant entities using natural language descriptions (e.g., "office light", "kitchen fan") to discover their entity IDs and friendly names
Control device power - Turn any Home Assistant entity on or off by specifying its entity ID and desired state
Set light colors - Change RGB colors of compatible light entities using red, green, and blue values (0-255)
Adjust brightness - Control light brightness levels (0-255) when setting colors or independently
Two-step workflow - Search for entities using natural language, then control them using their specific entity IDs
Requirements:
Home Assistant instance accessible via API
Long-Lived Access Token for authentication
Python 3.11 or higher
Allows AI assistants to control Home Assistant devices, providing tools to search for entities in a Home Assistant instance and control devices (turn them on/off) through the Home Assistant API.
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., "@Home Assistant MCP turn on the living room lights"
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 MCP
A Model Context Protocol (MCP) integration for controlling Home Assistant devices using AI assistants.
Overview
This MCP allows AI assistants to control your Home Assistant devices. It provides tools to:
Search for entities in your Home Assistant instance
Control devices (turn them on/off)
Control light colors and brightness
Related MCP server: Hass-MCP
Prerequisites
Python 3.11 or higher
Home Assistant instance running and accessible via API
Home Assistant Long-Lived Access Token
Installation
Installing via Smithery
To install Home Assistant Integration for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @hpohlmann/home-assistant-mcp --client claudeManual Installation
Clone this repository
Set up a Python environment:
cd home-assistant
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -U pip
pip install uv
uv pip install -e .Configuration
Get a Home Assistant Long-Lived Access Token
Go to your Home Assistant instance
Navigate to your profile (click on your username in the sidebar)
Scroll down to "Long-Lived Access Tokens"
Create a new token with a descriptive name like "MCP Integration"
Copy the token (you'll only see it once)
Set up in Cursor AI
Add the following configuration to your MCP configuration in Cursor:
{
"mcpServers": {
"home_assistant": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/home-assistant-mcp",
"run",
"main.py"
],
"env": {
"HOME_ASSISTANT_TOKEN": "your_home_assistant_token_here"
},
"inheritEnv": true
}
}
}Replace:
/path/to/your/home-assistantwith the actual path to this directoryyour_home_assistant_token_herewith your Home Assistant Long-Lived Access Token
Home Assistant URL Configuration
By default, the MCP tries to connect to Home Assistant at http://homeassistant.local:8123.
If your Home Assistant is at a different URL, you can modify the HA_URL variable in app/config.py.
Usage
Once configured, you can use Cursor AI to control your Home Assistant devices:
Search for devices: "Find my living room lights"
Control devices: "Turn on the kitchen light"
Control light colors: "Set my living room lights to red"
Adjust brightness: "Set my dining room lights to blue at 50% brightness"
Light Control Features
The MCP now supports advanced light control capabilities:
Color Control: Set any RGB color for compatible lights
Specify colors using RGB values (0-255 for each component)
Example:
set_device_color("light.living_room", 255, 0, 0)for red
Brightness Control: Adjust light brightness
Optional brightness parameter (0-255)
Can be combined with color changes
Example:
set_device_color("light.dining_room", 0, 0, 255, brightness=128)for medium-bright blue
Troubleshooting
If you get authentication errors, verify your token is correct and has not expired
Check that your Home Assistant instance is reachable at the configured URL
For color control issues:
Verify that your light entity supports RGB color control
Check that the light is turned on before attempting to change colors
Future Capabilities
Dynamic Entity Exposure
The current implementation requires a two-step process to control devices:
Search for entities using natural language
Control the entity using its specific entity_id
A planned enhancement is to create a more dynamic way to expose entities to the control devices tool, allowing the AI to:
Directly control devices through more natural commands (e.g., "turn off the kitchen lights")
Cache frequently used entities for faster access
Support more complex operations like adjusting brightness, temperature, or other attributes
Handle entity groups and scenes more intuitively
This would significantly reduce the time to action and create a more seamless user experience when controlling Home Assistant devices through an AI assistant.
Available Tools
3 toolscontrol_deviceB
Control a Home Assistant entity by turning it on or off.
Args:
entity_id: The Home Assistant entity ID to control (format: domain.entity)
state: The desired state ('on' or 'off')
Inputs: entity_id (required), state (required).
search_entitiesA
Search for Home Assistant entities matching a natural language description.
Args:
description: Natural language description of the entity (e.g., "office light", "kitchen fan")
Returns:
A list of matching entity IDs with their friendly names, or an error message
Inputs: description (required).
set_device_colorA
Set the color and optionally brightness of a light entity.
Args:
entity_id: The Home Assistant entity ID to control (format: light.entity)
red: Red component (0-255)
green: Green component (0-255)
blue: Blue component (0-255)
brightness: Optional brightness level (0-255)
Inputs: entity_id (required), red (required), green (required), blue (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap. control_device handles basic on/off states, search_entities finds devices by description, and set_device_color manages color/brightness for lights. An agent can easily distinguish when to use each tool based on the specific operation needed.
All three tools follow a consistent verb_noun pattern with snake_case throughout: control_device, search_entities, and set_device_color. The naming is predictable and follows the same grammatical structure, making the tool set easy to understand at a glance.
With only 3 tools, this feels thin for a Home Assistant integration that presumably manages many device types and operations. While the tools cover basic control, search, and color settings, the scope suggests more operations would be needed for comprehensive home automation coverage. The count is borderline minimal for the domain.
There are significant gaps in the tool surface for home automation. Missing operations include getting device status/state, adjusting non-color attributes (like temperature for thermostats or speed for fans), managing scenes/automations, and handling other entity types beyond lights. The current tools provide only partial coverage of the Home Assistant domain.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Hosted MCP server connecting AI assistants to 9,000+ apps and 40,000+ actions via Zapier.
An MCP server that integrates with Discord to provide AI-powered features.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that integrates with Home Assistant to provide smart home control capabilities through natural language, supporting devices like lights, climate systems, locks, alarms, and humidifiers.3MIT
- AlicenseAqualityBmaintenanceA Model Context Protocol server that enables AI assistants like Claude to interact directly with Home Assistant, allowing them to query device states, control smart home entities, and perform automation tasks.29351MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows large language models to control and query Home Assistant smart home systems through natural language interactions.34 npm5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control Home Assistant devices and services through the Model Context Protocol.104 PyPI106MIT