
Home Assistant MCP Server

2025.04.21
0
自动化优化Home Assistant 工具开发效率
ha-mcp-server 是一个为 Home Assistant 设计的 Model Context Protocol (MCP) 服务器,提供基于 SSE(Server-Sent Events)的工具,用于检查和优化自动化、脚本、场景和助手。
View on GitHub
Overview
基本能力
产品定位
ha-mcp-server 是一个为 Home Assistant 设计的 MCP 服务器,旨在通过 SSE 协议提供工具来检查和优化自动化、脚本、场景和助手。
核心功能
- SSE 传输:支持 API-Key 认证。
- 工具:包括
get_automations
、get_scripts
、get_scenes
、get_helpers
和recommend_optimizations
。
适用场景
- 检查和优化 Home Assistant 的自动化、脚本、场景和助手。
- 提供简单的优化建议。
工具列表
- get_automations:列出所有自动化。
- get_scripts:列出所有脚本。
- get_scenes:列出所有场景。
- get_helpers:列出所有助手。
- recommend_optimizations:基于获取的数据提供简单的优化建议。
常见问题解答
- 服务器默认运行在
http://localhost:8080/sse
。 - 使用
X-API-Key
头进行认证。
使用教程
使用依赖
- 确保已安装 Node.js 和 npm。
安装教程
- 克隆仓库并进入目录:
bash git clone <repo-url> cd ha-mcp-server
- 复制
.env.example
为.env
并填写值:bash cp .env.example .env
- 安装依赖:
bash npm install
- 构建项目:
bash npm run build
- 启动服务器:
bash npm start
调试方式
- 确保服务器运行在
http://localhost:8080/sse
。 - 使用
X-API-Key
头进行认证。 - 使用提供的工具(如
get_automations
)进行检查和优化。