Skip to main content
Glama

MCP Home Assistant

by Coolver

MCP Home Assistant

Control your Home Assistant through natural language in Cursor AI ๐Ÿ ๐Ÿค–

MCP (Model Context Protocol) server that enables Cursor AI to interact with Home Assistant through the HA Cursor Agent.

NPM Version License: MIT


๐ŸŽฏ What can you do?

Talk to Cursor AI in natural language to control your smart home:

  • ๐Ÿ’ฌ "Show me all my lights"

  • ๐Ÿ’ฌ "List my climate automations"

  • ๐Ÿ’ฌ "What's the temperature in the bedroom?"

  • ๐Ÿ’ฌ "Create a new automation"

  • ๐Ÿ’ฌ "Show the agent logs"

Cursor AI will use this MCP server to communicate with your Home Assistant!


๐Ÿ“‹ Prerequisites

Before installing, you need:

  1. Home Assistant running (any version)

  2. HA Cursor Agent installed as add-on

  3. Long-Lived Access Token from Home Assistant

  4. Cursor AI editor installed


๐Ÿš€ Quick Start (5 minutes)

Step 1: Install HA Cursor Agent

Install the agent in your Home Assistant:

  1. Go to Settings โ†’ Add-ons โ†’ Add-on Store

  2. Click โ‹ฎ โ†’ Repositories

  3. Add: https://github.com/Coolver/home-assistant-cursor-agent

  4. Install HA Cursor Agent

  5. Start the agent

Step 2: Get Access Token

  1. In Home Assistant, click your Profile (bottom left)

  2. Scroll to Long-Lived Access Tokens

  3. Click CREATE TOKEN

  4. Name it Cursor AI and copy the token

Step 3: Install MCP Server

npx @coolver/mcp-home-assistant

Or install globally:

npm install -g @coolver/mcp-home-assistant

Step 4: Configure Cursor

Add to your ~/.cursor/mcp.json:

{ "mcpServers": { "home-assistant": { "command": "npx", "args": ["-y", "@coolver/mcp-home-assistant"], "env": { "HA_AGENT_URL": "http://homeassistant.local:8099", "HA_TOKEN": "YOUR_LONG_LIVED_ACCESS_TOKEN_HERE" } } } }

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!


๐Ÿ’ฌ Usage Examples

Once configured, just talk to Cursor AI:

๐Ÿ” Query Information

Show me all my climate entities
What automations do I have?
List all my input helpers

๐Ÿ“Š Check Status

What's the state of climate.bedroom_trv?
Show me the last 20 agent logs

๐Ÿ“ Read Configuration

Show me my automations.yaml file
What scripts do I have configured?

๐Ÿ› ๏ธ Manage Home Assistant

Create a new automation that turns on lights at sunset
Add a new input boolean for vacation mode

๐Ÿ”ง 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"], "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 files

  • ha_write_file - Write configuration files

  • ha_list_files - List files in directory

  • ha_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 helpers

  • ha_create_helper - Create new input helper

  • ha_delete_helper - Delete helper

๐Ÿค– Automations

  • ha_list_automations - List all automations

  • ha_create_automation - Create new automation

  • ha_delete_automation - Delete automation

๐Ÿ“œ Scripts

  • ha_list_scripts - List all scripts

  • ha_create_script - Create new script

  • ha_delete_script - Delete script

๐Ÿ”„ System

  • ha_check_config - Check configuration validity

  • ha_reload_config - Reload configuration

  • ha_get_logs - Get agent logs

๐Ÿ’พ Backup

  • ha_git_commit - Commit changes to git

  • ha_git_history - View git history

  • ha_git_rollback - Rollback to previous version


๐Ÿ› Troubleshooting

"Invalid token" error

  1. Check your token is correct in mcp.json

  2. Make sure HA Cursor Agent is running

  3. Verify agent is accessible: curl http://homeassistant.local:8099/api/health

"Connection refused"

  1. Check HA Cursor Agent is started in Home Assistant

  2. Verify the URL in HA_AGENT_URL

  3. 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


๐Ÿค Related Projects


๐Ÿ“ License

MIT ยฉ Vladimir Eremeev


๐Ÿ™ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/AmazingFeature)

  3. Commit your changes (git commit -m 'Add some AmazingFeature')

  4. Push to the branch (git push origin feature/AmazingFeature)

  5. Open a Pull Request


๐Ÿ’ฌ Support


โญ Show your support

Give a โญ๏ธ if this project helped you control your smart home with AI!

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Coolver/mcp-home-assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server