Get the FREE Ultimate OpenClaw Setup Guide →

hass

A Home Assistant Custom Component that provides an MCP (Model Context Protocol) server using HTTP transport, allowing AI assistants like Claude to interact with your Home Assistant instance over HTTP

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ganhammar-hass-mcp-server python -m mcp_server_hass \
  --env HA_BASE_URL="https://your-home-assistant-url" \
  --env OIDC_CLIENT_ID="<your-oidc-client-id>" \
  --env OIDC_CLIENT_SECRET="<your-oidc-client-secret>" \
  --env OIDC_TOKEN_ENDPOINT="<token-endpoint-url>" \
  --env OIDC_AUTHORIZATION_ENDPOINT="<authorization-endpoint-url>"

How to use

This MCP server exposes a HTTP transport-based interface to interact with your Home Assistant instance via the Model Context Protocol. It leverages OAuth 2.0 for authentication, enabling remote access and integration with AI assistants like Claude directly from your browser. Once the MCP server is running, Claude can discover and interact with Home Assistant entities, states, and services through the MCP endpoints.

Available tools include get_state to fetch the current state of an entity, call_service to trigger Home Assistant services (for example turning lights on or off), and list_entities to enumerate entities with optional domain filtering. The server authenticates clients using OAuth 2.0, and Claude uses Dynamic Client Registration (DCR) to register itself automatically, simplifying setup. To use Claude in the browser, connect to your MCP server URL and authorize access when prompted, after Claude registers and obtains the necessary permissions.

How to install

Prerequisites:

  • Home Assistant installation with access to install custom components
  • hass-oidc-auth integration configured for OIDC
  • Internet access for OAuth and API calls

Installation (HACS - Recommended):

  1. Open HACS in Home Assistant
  2. Search for "MCP Server"
  3. Click "Download" to install
  4. Restart Home Assistant
  5. Configure the integration in Settings > Devices & Services

Manual Installation:

  1. Copy the custom component folder to your Home Assistant custom_components directory (e.g., custom_components/mcp_server)
  2. Restart Home Assistant
  3. Configure the integration via Settings > Devices & Services

Notes:

  • Ensure hass-oidc-auth is installed and properly configured for OIDC authentication
  • The MCP server relies on OAuth 2.0 for secure remote access; configure your OIDC endpoints and client credentials accordingly

Additional notes

Tips and common considerations:

  • Ensure OIDC is properly configured; misconfigurations can prevent OAuth flows from completing
  • Use the provided placeholder env vars to inject your Home Assistant base URL and OAuth endpoints
  • If Claude fails to connect, verify that the MCP server URL is reachable from Claude’s environment and that the OAuth client is registered
  • The HTTP transport is designed for remote access; ensure you expose only necessary endpoints and secure them behind OAuth
  • If you need to reconfigure, update the mcp_config and restart the MCP server integration in Home Assistant

Related MCP Servers

Sponsor this space

Reach thousands of developers