Home Assistant Model Context Protocol (MCP) Server logo

Home Assistant Model Context Protocol (MCP) Server

by jango-blockchained

A standardized protocol for AI assistants to interact with Home Assistant, providing a secure, typed, and extensible interface for controlling smart home devices. It acts as a bridge between AI models and Home Assistant, enabling AI assistants to execute commands, retrieve information, and stream responses.

View on GitHub

Last updated: N/A

What is Home Assistant Model Context Protocol (MCP) Server?

The Model Context Protocol (MCP) server is a bridge between AI models (like Claude, GPT, etc.) and Home Assistant, enabling AI assistants to control smart home devices in a secure and standardized way.

How to use Home Assistant Model Context Protocol (MCP) Server?

To use the MCP server, you need Node.js 16+ and a Home Assistant instance. Clone the repository, install dependencies using npm install, build the project using npm run build, and then start the server with either standard I/O (npm start -- --stdio) or HTTP transport (npm start -- --http). Configure the server using environment variables in a .env file.

Key features of Home Assistant Model Context Protocol (MCP) Server

  • Modular Architecture

  • Typed Interface (TypeScript)

  • Multiple Transports (Standard I/O, HTTP/REST API with SSE)

  • Middleware System (Validation, logging, timeout, error handling)

  • Built-in Tools (Light control, Climate control)

  • Extensible Plugin System

  • Streaming Responses

  • Parameter Validation (Zod schemas)

  • Claude & Cursor Integration

Use cases of Home Assistant Model Context Protocol (MCP) Server

  • Controlling lights, thermostats, and other smart home devices via AI assistants

  • Retrieving information about the smart home state using natural language

  • Automating complex tasks involving multiple devices and services

  • Integrating Home Assistant with AI models like Claude and Cursor

  • Building custom tools and capabilities for specific smart home scenarios

FAQ from Home Assistant Model Context Protocol (MCP) Server

What is the Model Context Protocol (MCP)?

MCP is a standardized protocol that allows AI assistants to interact with Home Assistant in a secure, typed, and extensible manner.

What are the prerequisites for using the MCP server?

You need Node.js 16+ and a Home Assistant instance. Bun runtime (v1.0.26+) is recommended.

How do I configure the MCP server?

Configure the server using environment variables in a .env file. You can also use environment-specific files like .env.dev or .env.prod.

How do I integrate the MCP server with Claude or Cursor?

The README provides specific configuration snippets for integrating with Claude Desktop and Cursor. Follow the instructions to add the server configuration to their respective config files.

What transport options are available for the MCP server?

The MCP server supports Standard I/O (stdin/stdout) for CLI integration and HTTP/REST API with Server-Sent Events (SSE) for streaming.