VH

voska/hass-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

353 stars 56 forks 质量 88 趋势 14MIT

通过Claude及其他大型语言模型控制和查询Home Assistant——一款模型上下文协议(MCP)服务器。

概览

一款用于与 Claude 及其他大型语言模型集成的模型上下文协议(MCP)服务器。 Hass-MCP 使像 Claude 这样的 AI 助手能够直接与你的 Home Assistant 实例交互,从而实现: - 查询设备和传感器的状态 - 控制灯具、开关及其他实体 - 获取智能家居的摘要 - 排查自动化和实体问题 - 搜索特定实体 - 为常见任务创建引导对话 - : 获取状态、控制设备并搜索实体 - : 获取实体类型的高级信息 - : 列出和控制自动化 - : 使用提示处理常见任务,如创建自动化 - : 按名称、类型或状态查找实体 - : 精益 JSON 响应以最小化令牌使用 - 带有长寿命访问令牌的Home Assistant实例 - 以下之一:- Docker (推荐) - Python 3.13+ 和 uv 2. 将MCP服务器添加到Claude Desktop: a. 打开Claude桌面,进入设置 b.进入开发者>编辑配置 c.

概述(AI 翻译)

一款用于与 Claude 及其他大型语言模型集成的模型上下文协议(MCP)服务器。

概述

Hass-MCP 使像 Claude 这样的 AI 助手能够直接与你的 Home Assistant 实例交互,从而实现:

  • 查询设备和传感器的状态
  • 控制灯具、开关及其他实体
  • 获取智能家居的摘要
  • 排查自动化和实体问题
  • 搜索特定实体
  • 为常见任务创建引导对话

截图

特色

  • 实体管理:获取状态、控制设备并搜索实体
  • 域名摘要:获取实体类型的高级信息
  • 自动化支持:列表和控制自动化
  • 引导对话:使用提示处理常见任务,如创建自动化
  • 智能搜索:按名称、类型或状态查找实体
  • 实时仪表盘编辑:通过Home Assistant的WebSocket API读取和编辑Lovelace仪表盘(卡片和视图)——更改会在打开的浏览器中即时显示,自动备份并进行预演预览
  • 令牌效率:精益JSON响应以最小化令牌使用

安装

先决条件

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Hass-MCP

A Model Context Protocol (MCP) server for Home Assistant integration with Claude and other LLMs.

Overview

Hass-MCP enables AI assistants like Claude to interact directly with your Home Assistant instance, allowing them to:

  • Query the state of devices and sensors
  • Control lights, switches, and other entities
  • Get summaries of your smart home
  • Troubleshoot automations and entities
  • Search for specific entities
  • Create guided conversations for common tasks

Screenshots

Features

  • Entity Management: Get states, control devices, and search for entities
  • Domain Summaries: Get high-level information about entity types
  • Automation Support: List and control automations
  • Guided Conversations: Use prompts for common tasks like creating automations
  • Smart Search: Find entities by name, type, or state
  • Live Dashboard Editing: Read and edit Lovelace dashboards (cards and views) over Home Assistant’s WebSocket API — changes appear instantly in open browsers, with automatic backups and a dry-run preview
  • Token Efficiency: Lean JSON responses to minimize token usage

Installation

Prerequisites

  • Home Assistant instance with Long-Lived Access Token
  • One of the following:
    • Docker (recommended)
    • Python 3.13+ and uv

Setting Up With Claude Desktop

  1. Pull the Docker image:

    docker pull voska/hass-mcp:latest
    
  2. Add the MCP server to Claude Desktop:

    a. Open Claude Desktop and go to Settings b. Navigate to Developer > Edit Config c. Add the following configuration to your claude_desktop_config.json file:

    {
      "mcpServers": {
        "hass-mcp": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "HA_URL",
            "-e",
            "HA_TOKEN",
            "voska/hass-mcp"
          ],
          "env": {
            "HA_URL": "http://homeassistant.local:8123",
            "HA_TOKEN": "YOUR_LONG_LIVED_TOKEN"
          }
        }
      }
    }
    

    d. Replace YOUR_LONG_LIVED_TOKEN with your actual Home Assistant long-lived access token

在 GitHub 查看完整 README

安装

docker run -i --rm -e HA_URL -e HA_TOKEN voska/hass-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "hass-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "HA_URL", "-e", "HA_TOKEN", "voska/hass-mcp" ], "env": { "HA_URL": "http://homeassistant.local:8123", "HA_TOKEN": "YOUR_LONG_LIVED_TOKEN" } } } }