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!
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.