Back to MCP directory
publicPublicdnsLocal runtime

ha-mcp-server

Home Assistant的MCP服务器,提供基于SSE的工具来检查和优化自动化、脚本、场景和助手。

article

README

🚀 家庭助手 MCP 服务器

家庭助手 MCP 服务器提供了基于 SSE 的工具,可用于检查和优化您的自动化、脚本、情景和辅助工具,为家庭自动化管理带来便利。

🚀 快速开始

按照以下步骤安装并启动家庭助手 MCP 服务器:

  1. 克隆仓库并进入该目录。
  2. 复制 .env.example.env 并填写值。
  3. 执行 npm install
  4. 执行 npm run build
  5. 执行 npm start

服务器将在 http://localhost:${PORT}/sse(默认 8080)运行。使用 X-API-Key 标头进行身份验证。

✨ 主要特性

  • SSE 运输:带有 API 密钥身份验证。
  • 丰富工具:提供 get_automations, get_scripts, get_scenes, get_helpers 等工具。
  • 优化功能:通过 recommend_optimizations 进行优化,可基于获取的数据提供简单推荐。

📦 安装指南

  1. 克隆仓库并进入该目录。
  2. 复制 .env.example.env 并填写值。
  3. 执行 npm install
  4. 执行 npm run build
  5. 执行 npm start

服务器将在 http://localhost:${PORT}/sse(默认 8080)运行。使用 X-API-Key 标头进行身份验证。

💻 使用示例

基础用法

以下是使用各个工具的示例代码:

# 列出所有自动化
get_automations()

# 列出所有脚本
get_scripts()

# 列出所有情景
get_scenes()

# 列出所有辅助工具
get_helpers()

# 基于获取的数据提供简单推荐
recommend_optimizations()

📚 详细文档

工具说明

  • get_automations:列出所有自动化。
  • get_scripts:列出所有脚本。
  • get_scenes:列出所有情景。
  • get_helpers:列出所有辅助工具。
  • recommend_optimizations:基于获取的数据提供简单推荐。

📄 许可证

本项目采用 MIT License。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client