hanz/home-assistant-mcp
Built by Metorial, the integration platform for agentic AI.
hanz/home-assistant-mcp
Server Summary
Search for entities
Control devices (turn on/off)
Adjust light colors
Adjust brightness
A Model Context Protocol (MCP) integration for controlling Home Assistant devices using AI assistants.
This MCP allows AI assistants to control your Home Assistant devices. It provides tools to:
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 .
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-assistant
with the actual path to this directoryyour_home_assistant_token_here
with your Home Assistant Long-Lived Access TokenBy 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
.
Once configured, you can use Cursor AI to control your Home Assistant devices:
The MCP now supports advanced light control capabilities:
Color Control: Set any RGB color for compatible lights
set_device_color("light.living_room", 255, 0, 0)
for redBrightness Control: Adjust light brightness
set_device_color("light.dining_room", 0, 0, 255, brightness=128)
for medium-bright blueThe current implementation requires a two-step process to control devices:
A planned enhancement is to create a more dynamic way to expose entities to the control devices tool, allowing the AI to:
This would significantly reduce the time to action and create a more seamless user experience when controlling Home Assistant devices through an AI assistant.