Home Assistant MCP Server

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides tools for controlling various Home Assistant domains including lights (on/off, brightness), climate systems (temperature, HVAC modes), locks (lock/unlock), alarm control panels (arm/disarm), and humidifiers (humidity control).

🤝 家庭助理 MCP 服务器

一个与 Home Assistant 集成以提供智能家居控制功能的模型上下文协议 (MCP) 服务器项目。

提示

服务器为每个域的工具集提供提示。

工具

该服务器实现了对各种 Home Assistant 域的控制。目前支持:

  • 💡 灯光:打开/关闭,亮度控制
  • 🌡️ 气候:温度控制、HVAC 模式
  • 🔒 锁:锁定/解锁功能
  • 🚨 报警控制面板:布防/撤防安全系统
  • 💧 加湿器:湿度控制

示例工具包括:

light-turn_on() climate-turn_off() alarm_control_panel-disarm() lock-lock() humidifier-turn_off()

配置

环境变量

使用以下命令在根目录中创建.env文件:

HOMEASSISTANT_TOKEN=your_long_lived_access_token_here # get it from your Home Assistant instance after onboarding HOMEASSISTANT_BASE_URL=your_home_assistant_url_here # e.g. http://homeassistant.local:8123

快速入门

安装

按照有关如何安装 Home Assistant 并获取长期访问令牌的说明进行操作。

克劳德桌面

在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

发展

构建和发布

准备分发包:

  1. 同步依赖项并更新锁文件:
uv sync
  1. 构建软件包分发版:
uv build

这将在dist/目录中创建源和轮子分布。

  1. 发布到 PyPI:
uv publish

注意:您需要通过环境变量或命令标志设置 PyPI 凭据:

  • 令牌: --tokenUV_PUBLISH_TOKEN
  • 或用户名/密码: --username / UV_PUBLISH_USERNAME--password / UV_PUBLISH_PASSWORD

调试

由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector

您可以使用以下命令通过npm启动 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /Users/miguel/Documents/home-assistant-server/home-assistant-server run home-assistant-server

启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。

贡献

感谢您有兴趣为这个项目做出贡献!

请参阅CONTRIBUTING.md了解指南。

执照

MIT 许可证 - 详情请参阅许可证

-
security - not tested
A
license - permissive license
-
quality - not tested

与 Home Assistant 集成的模型上下文协议服务器,通过自然语言提供智能家居控制功能,支持灯光、气候系统、锁、警报器和加湿器等设备。

  1. Prompts
    1. Tools
      1. Configuration
        1. Environment Variables
      2. Quickstart
        1. Install
      3. Development
        1. Building and Publishing
        2. Debugging
      4. Contributing
        1. License
          ID: 5tbc27x654