Get the FREE Ultimate OpenClaw Setup Guide →

mcp -home-assistant

A Model Context Protocol Server for Home Assistant

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio allenporter-mcp-server-home-assistant uv --directory /Users/allen/Development/mcp-server-home-assistant run mcp-server-home-assistant -v -v \
  --env HOME_ASSISTANT_API_TOKEN="<your-token-here>" \
  --env HOME_ASSISTANT_WEB_SOCKET_URL="http://localhost:8123/api/websocket"

How to use

This MCP server provides a Model Context Protocol interface for Home Assistant, allowing Claude-based tools to query and interact with Home Assistant through a standardized context protocol. The server is started via the uv tool, pointing it at the local repository of the mcp-server-home-assistant project. Once running, Claude Desktop can engage with Home Assistant using the configured web socket and API token. When using Claude’s Home Assistant integration, ensure your Home Assistant instance is accessible at the provided websocket URL and that you’ve generated a Long-Lived Access Token for authentication. The included environment variables supply the required connection details so Claude can request context, push actions, and retrieve updates from Home Assistant.

How to install

Prerequisites:

  • Python 3.x installed on your system
  • Git for cloning the repository
  • The uv tool (as shown in the README usage) installed and available in your PATH
  • A running Home Assistant instance with a Long-Lived Access Token

Installation steps:

  1. Install Python and Git if not already installed.

  2. Clone the MCP server repository to your desired path:

    git clone https://github.com/allenporter/mcp-server-home-assistant.git cd mcp-server-home-assistant

  3. Install the uv tool if you don’t already have it (depends on your environment; example with pipx):

    python3 -m pip install --user pipx python3 -m pipx ensurepath pipx install uvx # or the specific uv package used by your setup

  4. Ensure you have a running Home Assistant instance and generate a Long-Lived Access Token from your user profile.

  5. Create or modify the Claude Desktop configuration to reference the Home Assistant MCP server, using the example in the README (adjust paths and tokens as needed).

  6. Run Claude Desktop and verify logs for connection success. Logs can help diagnose authentication or connectivity issues.

Additional notes

Tips and common issues:

  • Ensure the Home Assistant websocket URL and API token are correct and have the necessary permissions.
  • If you change the repository path, update the --directory value in the mcp_config accordingly.
  • The verbose flags (-v -v) in the example help with troubleshooting by increasing log output from the MCP server.
  • Check Claude’s logs (as mentioned in the README) for connection problems or token authentication failures.
  • If you encounter SSL or certificate issues connecting to Home Assistant, ensure network access and proper TLS configuration are in place.
  • If you’re deploying in a different environment (e.g., Docker or a virtual environment), adapt the command and environment variables to fit that setup.

Related MCP Servers

Sponsor this space

Reach thousands of developers