Ambient Home Assistant MCP
OfficialAmbient Home Assistant MCP
Ambient Home Assistant MCP 是一个安全、语义化的桥梁,为 ChatGPT 和其他 MCP 客户端提供对 Home Assistant 的专用访问。它是未来面向用户的 Ambient Home Assistant 应用的服务器基础。
第二阶段状态: 本地/私有且只读。此版本增加了语义实体发现、当前状态、区域、楼层和域摘要。它无法控制设备或更改 Home Assistant。
它是什么——以及它不是什么
该桥梁是一个抽象和安全层。随着时间的推移,它可以在 Home Assistant REST、WebSocket 和原生 MCP/Assist 接口之间进行选择,同时向模型呈现小型语义工具。
它不是:
不是 Home Assistant 的替代品;
不是不受限制的 Home Assistant 管理员 API;
不是暴露给 LLM 的通用 API 包装器;或
不是 Home Assistant 的
/api/mcp端点的反向代理。
Related MCP server: homeassistant-gateway
架构
flowchart TD
C[ChatGPT or MCP client] -->|MCP| A[Ambient Home Assistant MCP]
A --> T[Semantic tools]
A --> P[Policy and security]
A --> N[Normalized data and diagnostics]
T --> H[Home Assistant client facade]
P --> H
N --> H
H --> R[REST state API]
H --> W[WebSocket registries]
H -. selective future use .-> M[HA MCP or Assist API]MCP 工具从不发出原始 HTTP 请求。它们依赖于 HomeAssistantClient,该客户端负责接口选择并立即规范化上游响应。请参阅架构决策记录。
能力
表面 | 用途 |
| 报告可达性和认证状态,而不暴露凭据。 |
| 仅返回版本、时区和单位系统元数据。 |
| 通过精确实体 ID 获取一个当前实体,并包含解析后的位置和安全属性。 |
| 按名称/ID 以及可组合的域、区域、楼层、状态和可用性过滤器搜索当前实体。 |
| 列出紧凑区域,或获取一个区域及其域计数和可选的有界实体列表。 |
| 列出楼层,或获取一个楼层及其区域和域聚合。 |
| 总结任何实体域的观察状态和可用性。 |
| 报告应用程序存活状态和单独的 Home Assistant 就绪状态。 |
未实现任何服务调用、状态更改或管理端点。
安全模型
Home Assistant 令牌仅来自运行时配置,并使用 Pydantic 秘密类型。
日志是结构化的,并编辑掉承载令牌和常见凭据字段。
原始
/api/config数据在到达工具结果之前被缩减为允许列表模型。详细的实体属性使用显式允许列表,并排除 URL、摄像头源、令牌、凭据、坐标和包含位置信息的元数据。
当前状态从不缓存。注册表元数据使用一个有界的 60 秒 TTL 缓存,以避免重复的 WebSocket 认证和注册表读取。
MCP 传输主机和来源允许列表可防止 DNS 重绑定。
策略引擎允许读取,并对每个控制类失败关闭。
容器在 Compose 中以非 root 用户身份运行,并使用只读文件系统。
切勿提交 .env、Home Assistant 令牌、凭据、私有 URL 或证书。在进行任何部署工作之前,请参阅安全。
快速开始
要求:Python 3.12+ 和 uv。
cp .env.example .env
# Edit .env and provide HOME_ASSISTANT_URL and HOME_ASSISTANT_TOKEN.
uv sync --all-extras
uv run ambient-ha-mcpStreamable HTTP MCP 端点为 http://127.0.0.1:8000/mcp;健康检查位于 http://127.0.0.1:8000/health。
在本地检查工具:
npx @modelcontextprotocol/inspector@latest然后将 Inspector 连接到 http://127.0.0.1:8000/mcp。
开发命令
uv sync --all-extras # install
uv run ambient-ha-mcp # run locally
uv run pytest # unit tests; real HA tests skip by default
uv run ruff check . # lint
uv run ruff format --check . # formatting check
uv run mypy # type check
docker build -t ambient-ha-mcp .
docker compose up --build在有意更改依赖项后重新生成依赖锁:
uv lockDocker Compose
将 .env.example 复制为 .env,提供两个必需的 Home Assistant 设置,然后运行 docker compose up --build。Compose 仅发布到主机回环地址。
Docker 健康探针测试应用程序存活状态。临时 Home Assistant 中断会将 /health 更改为 status: degraded,但保持 HTTP 状态 200,以便编排器不会循环重启健康的桥梁。
文档
许可证
MIT。请参阅 LICENSE。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.
Read-only MCP server exposing a user ORANO library to their own AI agent.
Read-only Google Analytics 4 MCP server for AI assistants.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA self-learning discovery tool + MCP server that turns your Home Assistant into knowledge an AI assistant can actually use.MIT
- AlicenseNot gradedqualityBmaintenanceEnables secure, auditable access to Home Assistant through MCP, with a read-only observer profile and an operator profile for controlled mutations.2MIT
- AlicenseNot gradedqualityCmaintenanceExposes a curated allowlist of Home Assistant entities to external clients over MCP with read-only list and get_state tools, using an isolated guest credential that cannot access other Home Assistant APIs.1Apache 2.0
- AlicenseAqualityDmaintenanceRead-only MCP server for Home Assistant that computes statistical summaries, trends, and session detection from recorded sensor history, returning compact tables instead of raw data so small local models can answer questions about energy usage, climate, and appliance activity without token-heavy arithmetic.107 npmApache 2.0