ha-mcp Docker & Self-Hosted Deployment

GitHub

The Unofficial and Awesome Home Assistant MCP Server

3,162 stars Python Python 1 file ยท ~40,346 tokens
RAW Compose
1. Pull Image (DOCKERHUB) docker pull homeassistant-ai/ha-mcp
2. Docker Run (1-Click Launch) docker run -d --name ha-mcp --restart always homeassistant-ai/ha-mcp:latest
3. Podman Run podman run -d --name ha-mcp --restart always homeassistant-ai/ha-mcp:latest
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://docker.io/homeassistant-ai/ha-mcp:latest
5. ORAS Pull (OCI Artifact) oras pull homeassistant-ai/ha-mcp:latest
6. Compose Deployment docker compose up -d
docker-compose.screenshot.yml
Download .yml
# Example: dashboard-screenshot engine sidecar for Docker / Container installs
# (the deployments without a Supervisor, so the HA OS add-on path is N/A).
#
# Pairs with the opt-in "dashboard screenshot" beta feature: enable
# HAMCP_ENABLE_DASHBOARD_SCREENSHOT on the ha-mcp service AND run this engine
# as a sidecar, then point ha-mcp at it via HAMCP_DASHBOARD_SCREENSHOT_ENGINE_URL.
# Merge these two services into your existing docker-compose.yml.
#
# The engine performs NO inbound authentication on its HTTP listener, so keep
# it on an internal Docker network only โ€” do NOT publish port 10000 to an
# untrusted LAN/internet (anyone who can reach it could pull authenticated
# dashboard renders). It is reached by service name over the compose network.

services:
  ha-mcp:
    build:
      context: .
      dockerfile: Dockerfile
    image: homeassistant-ai/ha-mcp:latest
    container_name: ha-mcp-server
    # No `volumes:` here on purpose. Compose merges service volumes by their
    # container path, so a mount at /home/mcpuser/.ha-mcp in this overlay would
    # REPLACE whatever the base file mounts there โ€” silently redirecting the
    # settings of anyone using a custom host path. Persistence belongs to the
    # base docker-compose.yml, which mounts ha-mcp-data at that path.
    environment:
      - HOMEASSISTANT_URL=http://homeassistant:8123
      - HOMEASSISTANT_TOKEN=${HA_TOKEN}
      # Opt into the beta feature (the master beta gate must also be on).
      - HAMCP_ENABLE_DASHBOARD_SCREENSHOT=true
      # Reach the engine sidecar by its compose service name (internal only).
      - HAMCP_DASHBOARD_SCREENSHOT_ENGINE_URL=http://ha-mcp-screenshot:10000
    restart: unless-stopped

  # Headless-Chromium screenshot engine โ€” balloob's Puppet (ha-puppet).
  # Renders a Lovelace dashboard to a PNG that ha-mcp fetches over the internal
  # network. ha-mcp does not vendor it and balloob publishes no image, so build
  # it from balloob's repository:
  #   git clone https://github.com/balloob/home-assistant-addons
  # then point the build context at its `puppet/` directory (below).
  ha-mcp-screenshot:
    build:
      context: ./home-assistant-addons/puppet
      dockerfile: Dockerfile
    image: ha-mcp-screenshot:latest
    container_name: ha-mcp-screenshot
    environment:
      # Puppet authenticates to Home Assistant with this token. Prefer a
      # long-lived token from a dedicated, low-privilege HA user. ha-puppet
      # reads it from /data/options.json in add-on mode; in plain Docker mount
      # an options file (see balloob's puppet/ha-puppet/options-dev.json.sample).
      - HA_TOKEN=${HA_TOKEN}
    # NOTE: intentionally NO `ports:` mapping โ€” the engine is unauthenticated
    # and must stay reachable only on the internal compose network.
    restart: unless-stopped

# Usage:
# 1. Create .env file: HA_TOKEN=your_long_lived_access_token
# 2. Merge both services into your docker-compose.yml (same network as HA).
# 3. Run: docker-compose -f docker-compose.yml -f docker-compose.screenshot.yml up -d
# 4. In ha-mcp, the master beta toggle must also be enabled.