Home Assistant MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Allows to interact with Home Assistant devices, including getting device states, controlling device states (on/off), triggering automations, and listing available entities

家庭助理 MCP 服务器

用于与 Home Assistant 交互的模型上下文协议 (MCP) 服务器。此服务器提供一些工具,用于通过支持 MCP 的应用程序控制和监控您的 Home Assistant 设备。

该项目是人工智能模型上下文协议 (MCP) 生态系统的一部分。如需了解更多关于 MCP 工具的信息和文档,请访问www.aimcp.info

特征

  • 获取设备状态
  • 控制设备状态(开/关)
  • 触发自动化
  • 列出可用实体

安装

  1. 克隆此存储库:
git clone https://github.com/yourusername/homeassistant-server-mcp.git cd homeassistant-server-mcp
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build
  1. 通过将以下内容添加到您的 MCP 设置文件(对于 VSCode,通常位于~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json )来配置 MCP 服务器:
{ "mcpServers": { "homeassistant": { "command": "node", "args": ["/path/to/homeassistant-mcp/homeassistant-server/build/index.js"], "env": { "HA_URL": "http://your-homeassistant-url:8123", "HA_TOKEN": "your-long-lived-access-token" } } } }

用您的 Home Assistant 实例 URL 和访问令牌替换your-homeassistant-urlyour-long-lived-access-token token。

用法

该服务器提供以下工具:

1. 获取设备状态

// Example usage use_mcp_tool({ server_name: "homeassistant", tool_name: "get_state", arguments: { entity_id: "light.living_room" } });

2. 切换设备状态

// Example usage use_mcp_tool({ server_name: "homeassistant", tool_name: "toggle_entity", arguments: { entity_id: "switch.bedroom", state: "on" // or "off" } });

3. 触发自动化

// Example usage use_mcp_tool({ server_name: "homeassistant", tool_name: "trigger_automation", arguments: { automation_id: "automation.morning_routine" } });

4. 列出实体

// Example usage use_mcp_tool({ server_name: "homeassistant", tool_name: "list_entities", arguments: { domain: "light" // optional, filters by domain } });

贡献

欢迎贡献!您可以通过以下方式提供帮助:

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/amazing-feature
  3. 提交您的更改( git commit -m 'Add some amazing feature'
  4. 推送到分支( git push origin feature/amazing-feature
  5. 打开拉取请求

请确保适当更新测试并遵循现有的代码风格。

文档

有关 MCP 工具和生态系统的详细文档:

  • 访问www.aimcp.info
  • 检查网站上的 MCP 工具目录
  • 阅读集成指南和最佳实践

执照

该项目根据 MIT 许可证获得许可 - 详情见下文:

MIT License Copyright (c) 2024 homeassistant-mcp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

安全

要安全地使用此服务器:

  1. 始终对 Home Assistant 实例使用 HTTPS
  2. 确保访问令牌的安全,切勿将其提交到版本控制
  3. 定期轮换您的访问令牌
  4. 使用环境变量来获取敏感信息

支持

如果您遇到任何问题或有疑问,请:

  1. 检查存储库中现有的问题
  2. 如果您的问题尚未报告,请创建新问题
  3. 报告问题时提供尽可能多的背景信息
  4. 访问www.aimcp.info获取更多支持资源

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

通过模型上下文协议实现与家庭助理设备和自动化交互的服务器,允许用户监视设备状态、控制设备、触发自动化和列出实体。

  1. Features
    1. Installation
      1. Usage
        1. 1. Get Device State
        2. 2. Toggle Device State
        3. 3. Trigger Automation
        4. 4. List Entities
      2. Contributing
        1. Documentation
          1. License
            1. Security
              1. Support
                ID: io8m0yc5wq