
paulomac1000/ha-mcp-readonly 是从 https://github.com/paulomac1000/ha-mcp-readonly. 导入的 MCP 服务器候选
概览
paulomac1000/ha-mcp-readonly 是从 https://github.com/paulomac1000/ha-mcp-readonly. 导入的 MCP 服务器候选
概述(AI 翻译)
Home Assistant 的只读 MCP(模型上下文协议)服务器。为 AI 助手(Claude Desktop、LibreChat、Cline)提供对智能家居的完整可观察性——实体状态、自动化、脚本、设备、日志、诊断——无需写入权限。还能为 RAG 系统、ChatGPT 项目、Qwen 及其他接受自定义知识文件的工具生成静态 AI 上下文快照。内置于 Python,运行于任何地方——本地、Docker 或作为 MCP 集成。
要求
- Python 3.11+(本地使用)或 Docker
- 具有长寿命访问令牌的 Home Assistant 实例
- 在您的 HA 配置文件中创建一个:设置 → 安全→长效访问令牌
- 访问您的 Home Assistant 配置文件目录(用于文件系统工具)
快速启动
1.配置环境
编辑 .env 并填写你的资历:
重要提示: .env 文件包含你的访问令牌。它被 gitignoror,绝不能提交。
2.运行于Docker
首先,配置你的凭证。要么使用.env文件(推荐)或直接传递变量。
选项A — 使用.env文件和docker compose:
包含了’docker-compose。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
HA-MCP-Readonly
Read-only MCP (Model Context Protocol) server for Home Assistant. Gives AI assistants (Claude Desktop, LibreChat, Cline) full observability into your smart home — entity states, automations, scripts, devices, logs, diagnostics — without any write access. Also generates static AI context snapshots for RAG systems, ChatGPT Projects, Qwen, and other tools that accept custom knowledge files. Built in Python, runs anywhere — locally, in Docker, or as an MCP integration.
Requirements
- Python 3.11+ (for local use) or Docker
- A Home Assistant instance with a long-lived access token
- Create one in your HA profile: Settings → Security → Long-Lived Access Tokens
- Access to your Home Assistant config directory (for filesystem tools)
Quick Start
1. Configure environment
cp .env.example .env
Edit .env with your credentials:
HA_URL=http://your-ha-ip:8123
HA_TOKEN=your_long_lived_access_token_here
# HA_CONFIG_PATH=/config # optional, default shown
# MCP_DEV_TOOLS_ENABLED=1 # optional, default shown
# HEALTH_CHECK_PORT=9091 # optional, default shown
# MCP_PORT=9092 # Streamable HTTP port when enabled
# REST_API_PORT=9093 # optional, default shown
# RUN_TESTS_ON_STARTUP=0 # optional, default shown
# OUTPUT_PATH=/app/output/ha-ai-context.md # optional, default shown
IMPORTANT: The .env file contains your access token. It is gitignored and must never be committed.
2. Run with Docker
First, configure your credentials. Either use a .env file (recommended) or pass variables directly.
Option A — with .env file and docker compose:
cp .env.example .env
# edit .env with your HA_URL and HA_TOKEN
docker compose up -d
The included docker-compose.yml pulls the image from GitHub Container Registry and mounts your HA config read-only:
services:
ha-mcp-readonly:
image: ghcr.io/paulomac1000/ha-mcp-readonly:latest
container_name: ha-mcp-readonly
env_file: .env
environment:
MCP_TRANSPORT: http
MCP_BIND_HOST: 0.0.0.0
MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN:?Set a strong MCP_AUTH_TOKEN}
ports:
- "127.0.0.1:9091:9091" # health
- "127.0.0.1:9092:9092" # authenticated Streamable HTTP MCP
volumes:
安装
docker run -d \配置
{
"mcpServers": {
"ha-mcp-readonly": {
"command": "ha-mcp-readonly",
"env": {
"HA_URL": "http://homeassistant.local:8123",
"HA_TOKEN": "replace-with-a-long-lived-access-token",
"HA_CONFIG_PATH": "/path/to/home-assistant/config"
}
}
}
}