Home Assistant MCP Server
Enables Claude Desktop to read and control Home Assistant devices via natural language, with configurable safety restrictions on sensitive actions.
README
Home Assistant MCP Server
This project lets Claude Desktop talk to your Home Assistant system.
After setup, you can ask Claude things like:
What lights are on?
Turn off the kitchen light.
Set the thermostat to 72.
Show me the outdoor temperature history.
Run my morning automation if it is allowed by my safety settings.
Claude does this by using Home Assistant's local API. Nothing in this project opens a public web server.
See changelog.md for project changes.
Who This Is For
Use this if:
- You use Home Assistant.
- You use Claude Desktop or another app that supports MCP.
- You want Claude to read or control your smart home devices.
This works on:
- macOS
- Windows 11
What You Need
Before you start, you need:
- Home Assistant already running.
- Python 3 installed.
- Claude Desktop installed.
- A Home Assistant long-lived access token.
If you do not know whether Python is installed, the setup steps below will help you check.
Important Safety Note
Claude may be able to control real devices in your home, depending on what you ask it to do and what permissions your Home Assistant token has.
This project blocks sensitive actions by default.
Be careful with devices like:
- Door locks
- Garage doors
- Alarms
- Climate controls
- Heaters
- Ovens
- Irrigation systems
- Any automation that changes your home state
Use a Home Assistant token from an account with only the permissions you are comfortable giving Claude.
Sensitive actions can be allowed later, but you should only allow devices you understand and trust.
Step 1: Download This Project
Download or clone this project to your computer.
For example, you might put it here:
macOS:
/Users/yourname/homeassistant-mcp
Windows:
C:\Users\yourname\homeassistant-mcp
Step 2: Install Python Dependencies
Open a terminal in the project folder.
On macOS, use Terminal and run:
python3 -m pip install -r requirements.txt
On Windows 11, use PowerShell and run:
py -3 -m pip install -r requirements.txt
If this step says Python is missing, install Python 3 from python.org and try again.
Step 3: Create a Home Assistant Token
In Home Assistant:
- Open your user profile.
- Scroll to Long-Lived Access Tokens.
- Create a new token.
- Name it something clear, like
Claude MCP. - Copy the token.
You will only see the token once, so save it somewhere private until setup is complete.
Do not commit this token to GitHub. Do not share it publicly.
Step 4: Connect It To Claude Desktop
The easiest way is to use the setup script.
macOS
In Terminal, from this project folder, run:
python3 setup_mcp.py --ha-url http://homeassistant.local:8123 --ha-token YOUR_TOKEN_HERE
Replace YOUR_TOKEN_HERE with the token you copied from Home Assistant.
If your Home Assistant does not use homeassistant.local, use its IP address instead:
python3 setup_mcp.py --ha-url http://192.168.1.100:8123 --ha-token YOUR_TOKEN_HERE
To allow one sensitive device, add --allowed-sensitive-entities.
Example:
python3 setup_mcp.py --ha-url http://homeassistant.local:8123 --ha-token YOUR_TOKEN_HERE --allowed-sensitive-entities lock.front_door
Windows 11
In PowerShell, from this project folder, run:
py -3 setup_mcp.py --ha-url http://homeassistant.local:8123 --ha-token YOUR_TOKEN_HERE
Replace YOUR_TOKEN_HERE with the token you copied from Home Assistant.
If your Home Assistant does not use homeassistant.local, use its IP address instead:
py -3 setup_mcp.py --ha-url http://192.168.1.100:8123 --ha-token YOUR_TOKEN_HERE
To allow one sensitive device, add --allowed-sensitive-entities.
Example:
py -3 setup_mcp.py --ha-url http://homeassistant.local:8123 --ha-token YOUR_TOKEN_HERE --allowed-sensitive-entities lock.front_door
Windows Alternative
Windows users can also use the included PowerShell script:
.\Set-ClaudeMcp.ps1 -HaUrl "http://homeassistant.local:8123" -HaToken "YOUR_TOKEN_HERE"
To allow one sensitive device with the PowerShell helper:
.\Set-ClaudeMcp.ps1 -HaUrl "http://homeassistant.local:8123" -HaToken "YOUR_TOKEN_HERE" -AllowedSensitiveEntities "lock.front_door"
Step 5: Restart Claude Desktop
Close Claude Desktop completely, then open it again.
After restarting, Claude should be able to use the Home Assistant tools.
What Tools Are Included
Claude gets tools that can:
- Read your Home Assistant configuration.
- List devices and entity states.
- Check the state of one device or sensor.
- Turn devices on, off, or toggle them.
- Set a thermostat or climate device temperature.
- Lock and unlock supported lock devices.
- Open and close supported covers, such as shades, blinds, curtains, or garage doors.
- Call Home Assistant services.
- List available Home Assistant services.
- Trigger automations.
- Read recent history for one entity.
- Render Home Assistant templates.
- Ask Home Assistant to check its configuration.
In normal use, you do not need to call these tools by name. You can usually ask Claude in plain English.
Safety Settings
Sensitive actions are blocked unless you explicitly allow them.
Blocked by default:
- Alarms
- Automations
- Climate devices
- Covers, such as garage doors, shades, blinds, and curtains
- Door locks
- Humidifiers
- Scripts
- Sirens
- Valves
- Water heaters
You can allow sensitive actions in three ways:
| Setting | What It Does |
|---|---|
HA_ALLOW_SENSITIVE_ACTIONS=true |
Allows all sensitive actions |
HA_ALLOWED_SENSITIVE_DOMAINS=climate,cover |
Allows whole sensitive device groups |
HA_ALLOWED_SENSITIVE_ENTITIES=lock.front_door |
Allows only listed sensitive devices |
HA_SENSITIVE_DOMAINS=lock,cover,climate |
Replaces the default sensitive device group list |
You can also block devices even if they would otherwise be allowed:
| Setting | What It Does |
|---|---|
HA_DENIED_DOMAINS=lock |
Always blocks a whole device group |
HA_DENIED_ENTITIES=lock.front_door,switch.oven_* |
Always blocks listed devices or wildcard patterns |
For most users, the safest choice is to allow individual entities only.
Example:
HA_ALLOWED_SENSITIVE_ENTITIES=climate.hallway,cover.living_room_shades
Common Problems
Claude cannot reach Home Assistant
Try using the IP address instead of homeassistant.local.
Example:
http://192.168.1.100:8123
Claude says unauthorized
Your token may be wrong, expired, or copied incorrectly.
Create a new long-lived access token in Home Assistant and run the setup again.
Claude does not show the Home Assistant tools
Try these steps:
- Restart Claude Desktop.
- Make sure you ran the setup command from this project folder.
- Make sure the Python dependency install step finished successfully.
- Run the setup command again.
A Python module is missing
The dependencies may have been installed into a different Python installation.
Run the dependency install command again from this project folder:
macOS:
python3 -m pip install -r requirements.txt
Windows:
py -3 -m pip install -r requirements.txt
Files In This Project
| File | What It Does |
|---|---|
server.py |
The actual Home Assistant MCP server |
setup_mcp.py |
Setup helper for macOS and Windows |
Set-ClaudeMcp.ps1 |
Windows PowerShell setup helper |
requirements.txt |
Python packages this project needs |
README.md |
This guide |
For Advanced Users
The setup script edits Claude Desktop's MCP configuration file and creates a backup before saving changes.
The MCP server entry points Claude to server.py and passes these environment variables:
| Variable | Meaning |
|---|---|
HA_URL |
Your Home Assistant address |
HA_TOKEN |
Your Home Assistant long-lived access token |
HA_ALLOW_SENSITIVE_ACTIONS |
Allows all sensitive actions when set to true |
HA_SENSITIVE_DOMAINS |
Custom list of domains treated as sensitive |
HA_ALLOWED_SENSITIVE_DOMAINS |
Sensitive domains allowed by name |
HA_ALLOWED_SENSITIVE_ENTITIES |
Sensitive entities allowed by name or wildcard pattern |
HA_DENIED_DOMAINS |
Domains that are always blocked |
HA_DENIED_ENTITIES |
Entities or wildcard patterns that are always blocked |
You can edit Claude Desktop's MCP config manually if you prefer, but most users should use the setup script.
License
This project is licensed under the MIT License. See LICENSE for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。