advanced-homeassistant-mcp

jango-blockchained/advanced-homeassistant-mcp

3.5

If you are the rightful owner of advanced-homeassistant-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A standardized protocol for AI assistants to interact with Home Assistant, providing a secure, typed, and extensible interface for controlling smart home devices.

๐Ÿ  Home Assistant MCP

Bun TypeScript smithery badge

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.


โœจ Feature Overview

๐Ÿค– AI-Powered Smart Home Control

  • 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

๐Ÿ›ก๏ธ Enterprise-Grade Security

  • 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

โšก High-Performance Architecture

  • 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

๐Ÿ  Comprehensive Device Control

  • 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

๐ŸŽ™๏ธ Voice & AI Integration

  • Speech-to-Text: Whisper model integration for voice commands
  • Wake Word Detection: Always-listening capabilities with custom wake words
  • NLP Processing: Advanced intent recognition and entity extraction
  • Context Awareness: Learns from usage patterns and user behavior

๐Ÿš€ Quick Start

Get up and running in minutes:

# Clone and install
git clone https://github.com/jango-blockchained/homeassistant-mcp.git
cd homeassistant-mcp
bun install

# Configure environment
cp .env.example .env
# Edit .env with your Home Assistant details

# Start the server
bun run start:stdio

That's it! Your AI assistant can now control your smart home. ๐Ÿค–โœจ


๐Ÿ“ฆ Installation

Prerequisites

  • ๐Ÿš€ Bun (v1.0.26+) - Recommended
  • ๐Ÿ  Home Assistant instance
  • ๐Ÿณ Docker (optional, for speech features)

Option 1: NPX (Easiest)

npx @jango-blockchained/homeassistant-mcp@latest

Option 2: Bunx with GitHub (No NPM Login Required)

If 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/homeassistant-mcp

Alternatively, install directly from Git:

bun add git+https://github.com/jango-blockchained/homeassistant-mcp.git
homeassistant-mcp

Option 3: Local Installation

# Install globally
bun add -g @jango-blockchained/homeassistant-mcp

# Or locally
bun add homeassistant-mcp

# Run
homeassistant-mcp

Option 4: From Source (Most Flexible)

git clone https://github.com/jango-blockchained/homeassistant-mcp.git
cd homeassistant-mcp
bun install
bun run build
bun run start:stdio

๐Ÿ› ๏ธ Usage

AI Assistant Integration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "homeassistant-mcp": {
      "command": "npx",
      "args": ["@jango-blockchained/homeassistant-mcp@latest"]
    }
  }
}

Or if you can't login to npm, use bunx:

{
  "mcpServers": {
    "homeassistant-mcp": {
      "command": "bunx",
      "args": ["github:jango-blockchained/homeassistant-mcp"]
    }
  }
}
VS Code + Claude Extension

The .vscode/settings.json is pre-configured for immediate use.

Cursor

Add to .cursor/config/config.json:

{
  "mcpServers": {
    "homeassistant-mcp": {
      "command": "npx",
      "args": ["@jango-blockchained/homeassistant-mcp@latest"]
    }
  }
}

Or with bunx:

{
  "mcpServers": {
    "homeassistant-mcp": {
      "command": "bunx",
      "args": ["github:jango-blockchained/homeassistant-mcp"]
    }
  }
}

API Usage

Start the HTTP server:

bun run start -- --http

Available endpoints:

  • POST /api/tools/call - Execute tools
  • GET /api/resources/list - List resources
  • GET /api/health - Health check
  • WebSocket /api/ws - Real-time updates

Configuration

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

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   AI Assistant  โ”‚โ—„โ”€โ”€โ–บโ”‚   MCP Server    โ”‚โ—„โ”€โ”€โ–บโ”‚ Home Assistant  โ”‚
โ”‚  (Claude/GPT)   โ”‚    โ”‚                 โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚ โ”‚  Transport  โ”‚ โ”‚
                       โ”‚ โ”‚   Layer     โ”‚ โ”‚
                       โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
                       โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
                       โ”‚ โ”‚ Middleware  โ”‚ โ”‚
                       โ”‚ โ”‚   Layer     โ”‚ โ”‚
                       โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
                       โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
                       โ”‚ โ”‚   Tools     โ”‚ โ”‚
                       โ”‚ โ”‚   Layer     โ”‚ โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Components

  • Transport Layer: HTTP, WebSocket, Stdio
  • Middleware Layer: Security, validation, logging
  • Tools Layer: Device control, automation, notifications
  • Resource Manager: State management and caching

Built-in Tools

  • ๐Ÿ”ฆ Lights Control: Full spectrum lighting management
  • ๐ŸŒก๏ธ Climate Control: HVAC and thermostat operations
  • โš™๏ธ Automation: Scene and automation triggers
  • ๐Ÿ“ฑ Notifications: Multi-channel alert system
  • ๐Ÿ“‹ Device Management: Discovery and organization

๐ŸŽฏ Example Commands

Once integrated, your AI assistant can understand commands like:

"Turn off all lights in the bedroom" "Set the thermostat to 72ยฐF" "Activate the movie scene" "What's the current temperature in the living room?" "Notify everyone that dinner is ready"


๐Ÿค Contributing

We welcome contributions! Here's how to get involved:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch
  3. ๐Ÿ’ป Make your changes
  4. ๐Ÿงช Add tests if applicable
  5. ๐Ÿ“ Update documentation
  6. ๐Ÿ”„ Submit a pull request

Development Setup

bun install
bun run build
bun test

Code Style

  • TypeScript with strict mode
  • ESLint for code quality
  • Prettier for formatting
  • Husky for pre-commit hooks

๐Ÿ“„ License

MIT License - see for details.


๐Ÿ™ Acknowledgments

Built with โค๏ธ using:


Transform your smart home into an AI-powered experience