HA MCP Server

HA MCP Server

An MCP server that exposes Home Assistant's REST and WebSocket APIs as 182 tools, enabling clients like Claude Code to control lights, climate, media, automations, and more. It also provides a status dashboard and supports running as a Home Assistant app or container.

Category
访问服务器

README

HA MCP Server

An MCP server that exposes Home Assistant's REST and WebSocket APIs as 182 tools, so an MCP client — Claude Code among others — can drive an instance directly.

Lights, climate, covers, media, alarm and cameras; automations, scripts, scenes, helpers and dashboards; the area, floor, label, device and entity registries; add-ons, HACS, backups and system health; history, logbook, statistics and energy.

A status dashboard shows what the server sees and which tools have been called.

It can also delete things — automations, dashboards, helpers, users. Every tool was exercised against a live instance before release, but treat it as what it is: a broad, powerful interface to your home.

The status dashboard

The screenshot is generated by scripts/screenshots.py against a mock of the Home Assistant API, never against a real instance — the dashboard puts the location name in the page title.

Two ways to run it

As a Home Assistant app

The easiest route if you already run Home Assistant: the app reaches it through the Supervisor, so no long-lived token has to be created, and the dashboard is available in the sidebar through ingress.

Add the repository to Home Assistant

Repository: driin0/home-assistant-apps. That repository holds only the packaging — the code is here, and it ships the image published from this repository.

As a container

For a Home Assistant instance you do not control, or to run the server elsewhere:

git clone https://github.com/driin0/ha-mcp-server
cd ha-mcp-server
cp .env.sample .env      # fill in HA_URL, HA_TOKEN and MCP_SECRET
docker compose up -d

The image (ghcr.io/driin0/ha-mcp-server) is published multi-architecture (amd64, arm64), so nothing is built locally. To work on the code, replace image: with build: . in compose.yaml.

Variable Default Meaning
HA_URL — Home Assistant base URL, e.g. http://homeassistant.local:8123
HA_TOKEN — a long-lived access token
MCP_SECRET — bearer token clients must present
MCP_ALLOW_NO_AUTH false start without a secret — only on a trusted network
MCP_PORT / UI_PORT 47821 / 47822 ports on the host
HA_DEFAULT_LANGUAGE empty language for conversation tools
HA_ALEXA_KEYWORDS echo,alexa media players treated as Alexa devices
HA_REMOTE_PREFIXES empty entity prefixes routed as remotes

Connecting a client

{
  "mcpServers": {
    "homeassistant": {
      "type": "http",
      "url": "http://<host>:47821/mcp",
      "headers": { "Authorization": "Bearer <MCP_SECRET>" }
    }
  }
}

Development

pip install -r requirements.txt
HA_URL=… HA_TOKEN=… MCP_ALLOW_NO_AUTH=true python3 server.py

The tools live in tools/, one module per area, and register themselves through tools/_base.py. web.py serves the dashboard; stats.py keeps the call counters behind it.

A note on the base image

The image is built on python:3.13-alpine on purpose, and its Alpine and Python versions must stay aligned with the Home Assistant base image (ghcr.io/home-assistant/base-python:3.13-alpineX.Y). The Home Assistant app copies the compiled packages from this image rather than reinstalling them, and native extensions — pydantic_core, cryptography, rpds, websockets — only load if musl and the Python minor version match. The Dockerfile imports them at build time so a future mismatch fails there, not at first start.

Licence

Copyright (C) 2026 Riccardo Riina (driin0)

Distributed under the GNU Affero General Public License v3.0. See LICENSE.

Trademarks

Home Assistant and its logo are trademarks of the Open Home Foundation. The Model Context Protocol and its mark belong to Anthropic. This project is independent and is not affiliated with, nor endorsed by, either.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选