Bridge the gap between AI assistants and your smart home π
A powerful, secure, and extensible Model Context Protocol (MCP) server that enables AI assistants like Claude, GPT, and Cursor to seamlessly interact with Home Assistant. Control your lights, climate, automations, and more through natural language commands.
- Natural Language Processing: Turn "dim the living room lights to 50%" into actual device commands
- Multi-Assistant Support: Works with Claude, GPT-4, Cursor, and other MCP-compatible assistants
- Intelligent Context: Remembers device states, relationships, and user preferences
- Smithery Integration: One-click installation and deployment via Smithery.ai
- Rate Limiting: Protects against abuse with configurable request limits
- Input Sanitization: Prevents XSS and injection attacks
- JWT Authentication: Secure token-based access control
- Security Headers: Comprehensive protection against web vulnerabilities
- Bun Runtime: 4x faster than Node.js with built-in TypeScript support
- Streaming Responses: Real-time updates for long-running operations
- Modular Design: Clean separation of concerns with extensible plugin system
- Multiple Transports: HTTP REST API, WebSocket, and Standard I/O support
- Lighting Control: Brightness, color temperature, RGB colors, and effects
- Climate Management: Thermostats, HVAC modes, fan control, and scheduling
- Automation & Scenes: Trigger automations, activate scenes, and manage routines
- Device Discovery: Intelligent device listing with filtering and search
- Notification System: Send alerts through Home Assistant's notification channels
- Smart Maintenance: Find orphaned devices, analyze usage patterns, energy monitoring
- Intelligent Scenarios: Auto-detect and manage nobody-home, window/heating conflicts, energy waste
Get up and running in minutes:
# Clone and install
git clone https://github.com/jango-blockchained/advanced-homeassistant-mcp.git
cd advanced-homeassistant-mcp
bun install
# Configure environment
cp .env.example .env
# Edit .env with your Home Assistant details
# Start the server
bun run start:stdioThat's it! Your AI assistant can now control your smart home. π€β¨
- π Bun (v1.0.26+) - Recommended
- π Home Assistant instance
Smithery is a registry for MCP servers that makes installation incredibly easy:
# Install to Claude Desktop
npx @smithery/cli install @jango-blockchained/homeassistant-mcp --client claude
# Install to Cursor
npx @smithery/cli install @jango-blockchained/homeassistant-mcp --client cursor
# Install to VS Code
npx @smithery/cli install @jango-blockchained/homeassistant-mcp --client vscodeYou'll be prompted to configure:
- Home Assistant URL
- Long-lived access token
- Optional settings (port, debug mode)
See SMITHERY_DEPLOYMENT.md for detailed deployment guide.
npx @jango-blockchained/homeassistant-mcp@latestIf you can't login to npm, use Bunx to run directly from GitHub:
# Install Bun first if you don't have it
curl -fsSL https://bun.sh/install | bash
# Then run from GitHub
bunx github:jango-blockchained/advanced-homeassistant-mcpAlternatively, install directly from Git:
bun add git+https://github.com/jango-blockchained/advanced-homeassistant-mcp.git
homeassistant-mcpRun the MCP server in a Docker container:
# Pull the latest image
docker pull ghcr.io/jango-blockchained/advanced-homeassistant-mcp:latest
# Run with environment variables
docker run -d \
-e HOME_ASSISTANT_URL=http://your-ha-instance:8123 \
-e HOME_ASSISTANT_TOKEN=your_long_lived_access_token \
-p 4000:4000 \
--name homeassistant-mcp \
ghcr.io/jango-blockchained/advanced-homeassistant-mcp:latest
# Or use docker-compose (see docker/ directory for examples)Available Docker tags:
latest- Latest stable release1.0.x- Specific versiondev- Latest development build from main branch
# Install globally
bun add -g @jango-blockchained/homeassistant-mcp
# Or locally
bun add homeassistant-mcp
# Run
homeassistant-mcpgit clone https://github.com/jango-blockchained/advanced-homeassistant-mcp.git
cd advanced-homeassistant-mcp
bun install
bun run build
bun run start:stdioAdd to your claude_desktop_config.json:
{
"mcpServers": {
"homeassistant-mcp": {
"command": "bunx",
"args": ["github:jango-blockchained/advanced-homeassistant-mcp"]
}
}
}Or use npx:
{
"mcpServers": {
"homeassistant-mcp": {
"command": "npx",
"args": ["@jango-blockchained/homeassistant-mcp@latest"]
}
}
}The .vscode/settings.json is pre-configured for immediate use.
Add to .cursor/config/config.json:
{
"mcpServers": {
"homeassistant-mcp": {
"command": "bunx",
"args": ["github:jango-blockchained/advanced-homeassistant-mcp"]
}
}
}Or with npx:
{
"mcpServers": {
"homeassistant-mcp": {
"command": "npx",
"args": ["@jango-blockchained/homeassistant-mcp@latest"]
}
}
}Start the HTTP server:
bun run start -- --httpAvailable endpoints:
POST /api/tools/call- Execute toolsGET /api/resources/list- List resourcesGET /api/health- Health checkWebSocket /api/ws- Real-time updates
Create a .env file:
# Home Assistant
HASS_HOST=http://your-ha-instance:8123
HASS_TOKEN=your_long_lived_access_token
# Server
PORT=3000
NODE_ENV=production
# Security
JWT_SECRET=your-secret-key
RATE_LIMIT_WINDOW=15
RATE_LIMIT_MAX=50βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β AI Assistant βββββΊβ MCP Server βββββΊβ Home Assistant β
β (Claude/GPT) β β β β β
βββββββββββββββββββ β βββββββββββββββ β βββββββββββββββββββ
β β Transport β β
β β Layer β β
β βββββββββββββββ β
β βββββββββββββββ β
β β Middleware β β
β β Layer β β
β βββββββββββββββ β
β βββββββββββββββ β
β β Tools β β
β β Layer β β
βββββββββββββββββββ
- Transport Layer: HTTP, WebSocket, Stdio
- Middleware Layer: Security, validation, logging
- Tools Layer: Device control, automation, notifications
- Resource Manager: State management and caching
- π΅ Audio Analysis: Extract BPM, beats, mood, frequency data
- π Device Scanning: Find Aurora-compatible lights
- π Device Profiling: Measure latency & capabilities for sync
- π¬ Timeline Rendering: Generate pre-rendered light shows
βΆοΈ Playback Control: Play/pause/stop/seek timelines- π Timeline Management: List, export, import timelines
- π Status Monitoring: System status and statistics
- π― Smart Synchronization: Device-specific timing compensation
- π Capability-Aware: RGB, tunable white, brightness-only support
- πΆ Beat Detection: Lights pulse in sync with music
π¨ Aurora is a complete sound-to-light synchronization system that transforms your Home Assistant lights into a professional light show synchronized to music!
- π¦ Lights Control: Brightness, color temp, RGB, effects
- π‘οΈ Climate Control: HVAC modes, temperature, fan control
- πΊ Media Players: Playback, volume, sources, sound modes
- πͺ Covers: Blinds, curtains, garage doors, position control
- π Locks: Lock/unlock with code support
- π¨ Fans: Speed, oscillation, direction, presets
- π€ Vacuums: Cleaning, docking, spot clean, fan speed
- π¨ Alarm Control: Arm/disarm modes, security management
- ποΈ Generic Control: Universal device control interface
- π¬ Scenes: Activate predefined scenes
- βοΈ Automations: List, toggle, trigger automations
- π§ Automation Config: Create/update/delete complex automations
- π Device Discovery: List and filter devices by domain/area
- π± Notifications: Multi-channel alert system
- π History: Query historical state data
- π¦ Add-on Management: Install, configure, control add-ons
- π¦ Package Management: HACS integration and custom components
- π Event Subscription: Real-time SSE event streaming
-
π§ Maintenance Tool: Spook-like maintenance features
- Find orphaned/unavailable devices
- Analyze light usage patterns by room
- Monitor energy consumption
- Device health checks with battery warnings
- Entity cleanup recommendations
-
π§ Smart Scenarios: Intelligent automation detection
- Nobody home: Auto turn off lights, reduce climate
- Window/heating conflicts: Auto disable heating
- Energy saving: Detect daytime lights, standby power
- Generate automation configs
π See Complete Tools Reference for detailed documentation
-
π Prompts: Pre-defined prompt templates for common home automation tasks
- Morning/evening routines
- Energy saving suggestions
- Security setup
- Climate optimization
- Media control
- Troubleshooting helpers
-
π Resources: Direct access to Home Assistant states and configurations
- Device lists by type (lights, climate, sensors, etc.)
- Area/room configurations
- Automation and scene listings
- Dashboard summaries with current home status
-
π οΈ 24 Comprehensive Tools: Full device control and smart automation
- See Complete Tools Reference for all available tools
- Device control, automation, system management, and smart features
- Natural language to Home Assistant API translation
Once integrated, your AI assistant can understand commands like:
Device Control:
"Turn off all lights in the bedroom"
"Set the thermostat to 72Β°F"
"Play music on the living room speaker"
"Open the garage door"
"Lock all doors"
"Start the robot vacuum"
"Set the bedroom fan to 50%"
Automation & Scenes:
"Activate the movie scene"
"Trigger the morning routine automation"
"Show me all my automations"
Information & Monitoring:
"What's the current temperature in the living room?"
"Show me all unavailable devices"
"Which lights are currently on?"
Notifications:
"Notify everyone that dinner is ready"
"Send an alert to my phone"
Smart Maintenance:
"Check my Home Assistant health"
"Find orphaned or unavailable devices"
"Analyze my light usage patterns"
"Show me my energy consumption"
"Which devices have low battery?"
Aurora Sound-to-Light: β¨ NEW!
"Analyze this music file and sync my lights"
"Scan for lights that can do Aurora effects"
"Profile my living room lights for synchronization"
"Create a light show for this song"
"Play the timeline I just created"
"Pause the light show"
"Show me Aurora status"
Smart Scenarios:
"I'm leaving home, activate away mode"
"Are any windows open with heating on?"
"Check for energy-wasting issues"
"Turn off everything, I'm going on vacation"
"What can I do to save energy?"
You can also use prompts for guided assistance:
"Help me set up a morning routine"
"Show me energy saving tips"
"How do I control my media players?"
We welcome contributions! Here's how to get involved:
- π΄ Fork the repository
- πΏ Create a feature branch
- π» Make your changes
- π§ͺ Add tests if applicable
- π Update documentation
- π Submit a pull request
bun install
bun run build
bun test- TypeScript with strict mode
- ESLint for code quality
- Prettier for formatting
- Husky for pre-commit hooks
This project uses automated releases to GitHub, npm, and Docker. See AUTOMATED_RELEASES.md for details.
Quick Release:
- Go to Actions β Version Bump and Release
- Click Run workflow
- Select version bump type (patch/minor/major)
- The system automatically:
- π¦ Creates a GitHub release
- π€ Publishes to npm
- π³ Builds and pushes Docker image
MIT License - see LICENSE for details.
Built with β€οΈ using:
- Bun - The fast JavaScript runtime
- Home Assistant - The open-source home automation platform
- Model Context Protocol - The AI integration standard
Transform your smart home into an AI-powered experience