GitHub - voska/hass-mcp: Home Assistant MCP Server (original) (raw)

Hass-MCP

A Model Context Protocol (MCP) server for Home Assistant integration with Claude and other LLMs.

Overview

Hass-MCP enables AI assistants like Claude to interact directly with your Home Assistant instance, allowing them to:

Screenshots

Screenshot 2025-03-16 at 15 48 01 Screenshot 2025-03-16 at 15 50 59 Screenshot 2025-03-16 at 15 49 26

Features

Installation

Prerequisites

Setting Up With Claude Desktop

  1. Pull the Docker image:
    docker pull voska/hass-mcp:latest
  2. Add the MCP server to Claude Desktop:
    a. Open Claude Desktop and go to Settings b. Navigate to Developer > Edit Config c. Add the following configuration to your claude_desktop_config.json file:
    {
    "mcpServers": {
    "hass-mcp": {
    "command": "docker",
    "args": [
    "run",
    "-i",
    "--rm",
    "-e",
    "HA_URL",
    "-e",
    "HA_TOKEN",
    "voska/hass-mcp"
    ],
    "env": {
    "HA_URL": "http://homeassistant.local:8123",
    "HA_TOKEN": "YOUR_LONG_LIVED_TOKEN"
    }
    }
    }
    }
    d. Replace YOUR_LONG_LIVED_TOKEN with your actual Home Assistant long-lived access token e. Update the HA_URL:
    • If running Home Assistant on the same machine: use http://host.docker.internal:8123 (Docker Desktop on Mac/Windows)
    • If running Home Assistant on another machine: use the actual IP or hostname
      f. Save the file and restart Claude Desktop
  3. The "Hass-MCP" tool should now appear in your Claude Desktop tools menu

Note: If you're running Home Assistant in Docker on the same machine, you may need to add --network host to the Docker args for the container to access Home Assistant. Alternatively, use the IP address of your machine instead of host.docker.internal.

Other MCP Clients

Cursor

  1. Go to Cursor Settings > MCP > Add New MCP Server
  2. Fill in the form:
    • Name: Hass-MCP
    • Type: command
    • Command:
    docker run -i --rm -e HA_URL=http://homeassistant.local:8123 -e HA_TOKEN=YOUR_LONG_LIVED_TOKEN voska/hass-mcp  
    • Replace YOUR_LONG_LIVED_TOKEN with your actual Home Assistant token
    • Update the HA_URL to match your Home Assistant instance address
  3. Click "Add" to save

Claude Code (CLI)

To use with Claude Code CLI, you can add the MCP server directly using the mcp add command:

Using Docker (recommended):

claude mcp add hass-mcp -e HA_URL=http://homeassistant.local:8123 -e HA_TOKEN=YOUR_LONG_LIVED_TOKEN -- docker run -i --rm -e HA_URL -e HA_TOKEN voska/hass-mcp

Replace YOUR_LONG_LIVED_TOKEN with your actual Home Assistant token and update the HA_URL to match your Home Assistant instance address.

Usage Examples

Here are some examples of prompts you can use with Claude once Hass-MCP is set up:

Available Tools

Hass-MCP provides several tools for interacting with Home Assistant:

Prompts for Guided Conversations

Hass-MCP includes several prompts for guided conversations:

Available Resources

Hass-MCP provides the following resource endpoints:

Development

Running Tests

License

MIT License