MCP Home Assistant
Enables natural language control of Home Assistant smart home devices through Cursor AI, supporting entity queries, automation management, configuration file editing, and system operations.
README
MCP Home Assistant
Build smart home automations with AI - just describe what you want in natural language 🏠🤖
Stop manually writing YAML! This MCP server enables Cursor AI to analyze YOUR Home Assistant setup and create intelligent automations, scripts, and configurations tailored specifically to your devices.
Example: "Install smart climate control for my radiators" → AI creates 10+ automations, helpers, sensors, and scripts optimized for YOUR TRVs.
Built on Model Context Protocol and powered by HA Cursor Agent.
🎯 What can you do?
Cursor AI analyzes your actual Home Assistant configuration and creates smart automations tailored to YOUR devices:
🏗️ Build Complex Systems from Scratch
- 💬 "Install a smart climate control system for my TRV radiators with predictive shutdown and buffer mode"
- 💬 "Create a presence-based lighting system using my motion sensors and schedule"
- 💬 "Set up energy monitoring with notifications when consumption is high"
AI will:
- ✅ Read your current configuration
- ✅ Detect your devices and entities
- ✅ Create automations, scripts, helpers
- ✅ Test and validate everything
- ✅ Deploy - all automatically!
🔧 Intelligent Configuration
- 💬 "Optimize my heating system based on room priorities and occupancy patterns"
- 💬 "Create smart scenes for movie night using my actual lights and media devices"
- 💬 "Build a security system with my door sensors and cameras"
🐛 Debug and Fix Issues
- 💬 "Why isn't my bedroom automation working? Check the logs and fix it"
- 💬 "My climate control keeps turning off early - analyze and improve the logic"
No manual YAML editing. No copy-pasting. Just describe what you want! 🚀
📋 Prerequisites
Before installing, you need:
- Home Assistant running (any version)
- HA Cursor Agent v1.0.10+ installed as add-on
- API Key from HA Cursor Agent (auto-generated on first start)
- Cursor AI editor installed
🚀 Quick Start (5 minutes)
Step 1: Install HA Cursor Agent
Install the agent in your Home Assistant:
- Go to Settings → Add-ons → Add-on Store
- Click ⋮ → Repositories
- Add:
https://github.com/Coolver/home-assistant-cursor-agent - Install HA Cursor Agent (v1.0.10+)
- Start the agent
Step 2: Get API Key
Easy way - Use Ingress Panel:
- Look in Home Assistant Sidebar → 🔑 API Key panel appears
- Click on API Key panel
- Click "Copy to Clipboard" button
- Done! ✅
Alternative ways:
- View in add-on Logs (shown on first start)
- Read file:
/config/.ha_cursor_agent_key
Step 3: Configure Cursor
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"home-assistant": {
"command": "npx",
"args": ["-y", "@coolver/mcp-home-assistant@latest"],
"env": {
"HA_AGENT_URL": "http://homeassistant.local:8099",
"HA_TOKEN": "YOUR_API_KEY_HERE"
}
}
}
}
Why @latest?
- ✅ Always get the newest features and bug fixes
- ✅ Automatic updates when you restart Cursor
- ✅ No manual version management needed
Alternative (fixed version):
"args": ["-y", "@coolver/mcp-home-assistant@1.0.5"]
Use this if you want predictable, controlled updates.
Or if installed globally:
{
"mcpServers": {
"home-assistant": {
"command": "mcp-home-assistant",
"env": {
"HA_AGENT_URL": "http://homeassistant.local:8099",
"HA_TOKEN": "YOUR_LONG_LIVED_ACCESS_TOKEN_HERE"
}
}
}
}
Step 5: Restart Cursor
Restart Cursor AI and start chatting!
💬 Real-World Examples
Once configured, describe what you want in natural language. Cursor AI will analyze YOUR configuration and create tailored solutions:
🏗️ Install Complete Systems
Install a smart climate control system for my home.
Analyze my TRV radiators, create automations for efficient
heating with predictive shutdown, and set up a dashboard.
AI will:
- Detect your TRV entities
- Create 8-10 automations for smart heating
- Add helper entities for system state
- Create template sensors for monitoring
- Set up scripts for boiler control
- Generate Lovelace dashboard
- Test everything and deploy
Build a presence detection system using my phone trackers
and create automations for lights, climate, and security.
AI will:
- Find your device_tracker entities
- Create zones and presence helpers
- Set up lighting automations per room
- Configure climate based on presence
- Add security notifications
- All tailored to YOUR devices!
🔧 Optimize Existing Systems
My heating system wastes energy. Analyze my current
automations and optimize for efficiency while maintaining comfort.
AI will:
- Read current automations
- Analyze heating patterns
- Add predictive logic
- Implement adaptive cooldowns
- Keep your existing setup intact
🐛 Debug and Fix Issues
My bedroom lights automation isn't working properly.
Check the logs, analyze the automation, and fix the issue.
AI will:
- Read automation configuration
- Check entity states
- Review agent logs for errors
- Identify the problem
- Fix and test the solution
🎨 Create Custom Solutions
I want movie mode: dim all lights, close blinds,
turn on TV and soundbar. Create scenes and automations.
AI will:
- Detect your lights, covers, media devices
- Create input_boolean for movie mode
- Build automation with all steps
- Add script for easy activation
- Customize based on YOUR devices
🔧 Configuration
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
HA_AGENT_URL |
URL of HA Cursor Agent | Yes | http://homeassistant.local:8099 |
HA_TOKEN |
Long-Lived Access Token | Yes | - |
Custom Agent URL
If your agent runs on a different URL:
{
"mcpServers": {
"home-assistant": {
"command": "npx",
"args": ["-y", "@coolver/mcp-home-assistant@latest"],
"env": {
"HA_AGENT_URL": "http://192.168.1.100:8099",
"HA_TOKEN": "your_token_here"
}
}
}
}
🛠️ Available Tools
The MCP server provides these tools to Cursor AI:
📁 Files
ha_read_file- Read configuration filesha_write_file- Write configuration filesha_list_files- List files in directoryha_delete_file- Delete files
🏠 Entities
ha_list_entities- List all entities (with domain filter)ha_get_entity_state- Get specific entity state
🔧 Helpers
ha_list_helpers- List all input helpersha_create_helper- Create new input helperha_delete_helper- Delete helper
🤖 Automations
ha_list_automations- List all automationsha_create_automation- Create new automationha_delete_automation- Delete automation
📜 Scripts
ha_list_scripts- List all scriptsha_create_script- Create new scriptha_delete_script- Delete script
🔄 System
ha_check_config- Check configuration validityha_reload_config- Reload configurationha_get_logs- Get agent logs
💾 Backup
ha_git_commit- Commit changes to githa_git_history- View git historyha_git_rollback- Rollback to previous version
🐛 Troubleshooting
"Invalid token" error
- Check your token is correct in
mcp.json - Make sure HA Cursor Agent is running
- Verify agent is accessible:
curl http://homeassistant.local:8099/api/health
"Connection refused"
- Check HA Cursor Agent is started in Home Assistant
- Verify the URL in
HA_AGENT_URL - Make sure port 8099 is not blocked by firewall
Check Agent Logs
Ask Cursor AI:
Show me the agent logs
This will display what's happening in the agent.
🔐 Security
- ✅ All communication goes through HA Cursor Agent (port 8099)
- ✅ Agent validates your token against Home Assistant
- ✅ Agent uses internal SUPERVISOR_TOKEN for operations
- ✅ Your token is stored only in local config file
- ⚠️ Never commit
mcp.jsonwith your token to git!
🤝 Related Projects
- HA Cursor Agent - Home Assistant add-on (required)
- Model Context Protocol - Protocol specification
📝 License
MIT © Vladimir Eremeev
🙏 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
💬 Support
- 🐛 Issues: GitHub Issues
- 💡 Discussions: GitHub Discussions
⭐ Show your support
Give a ⭐️ if this project helped you control your smart home with AI!
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。