
OpenHAB 的 MCP 服务器
概览
一个MCP(模型上下文协议)服务器,与真实的openHAB实例交互。 该项目提供了一个通过其REST API连接到真实openHAB实例的MCP服务器实现。它使像Claude和Cline这样的AI助手能够与你的openHAB智能家居系统交互。 该服务器提供对 openHAB 核心组件的全面访问: - 列表、获取、创建、更新和删除项目- 更新项目状态 - 列出所有事物 - 获取、创建、更新和删除 - 更新配置 - 获取配置状态 - 设置启用/禁用状态 - 获取状态和固件信息 - 获取可用的固件更新 - 列出、获取、创建、更新和删除规则 - 更新规则脚本动作 - 按需运行规则 - 列表、获取、创建、更新和删除脚本 连接 VSCode 中的 Claude 或 Cline,您可以使用自然语言来控制和管理 openHAB 系统,使家庭自动化更加便捷和便捷。
概述(AI 翻译)
一个MCP(模型上下文协议)服务器,与真实的openHAB实例交互。
概述
该项目提供了一个通过其REST API连接到真实openHAB实例的MCP服务器实现。它使像Claude和Cline这样的AI助手能够与你的openHAB智能家居系统交互。
该服务器提供对 openHAB 核心组件的全面访问:
物品
- 列表、获取、创建、更新和删除项目
- 更新项目状态
事情
- 列出所有事物
- 获取、创建、更新和删除内容
- 更新配置
- 获取配置状态
- 设置启用/禁用状态
- 获取设备状态和固件信息
- 获取可用的固件更新
规则
- 列出、获取、创建、更新和删除规则
- 更新规则脚本动作
- 按需运行规则
剧本
- 列表、获取、创建、更新和删除脚本
连接 VSCode 中的 Claude 或 Cline,您可以使用自然语言来控制和管理 openHAB 系统,使家庭自动化更加便捷和便捷。
要求
- Python 3.7+
快速入门(预建图像)
官方镜像发布到GitHub容器注册表('ghcr.
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
OpenHAB MCP Server
A MCP (Model Context Protocol) server that interacts with a real openHAB instance.
Overview
This project provides an implementation of an MCP server that connects to a real openHAB instance via its REST API. It enables AI assistants like Claude and Cline to interact with your openHAB smart home system.
The server provides comprehensive access to openHAB’s core components:
Items
- List, get, create, update, and delete items
- Update item states
Things
- List all things
- Get, create, update, and delete things
- Update thing configurations
- Get thing configuration status
- Set thing enabled/disabled status
- Get thing status and firmware information
- Get available firmware updates
Rules
- List, get, create, update, and delete rules
- Update rule script actions
- Run rules on demand
Scripts
- List, get, create, update, and delete scripts
When connected to Claude or Cline in VSCode, you can use natural language to control and manage your openHAB system, making home automation more accessible and intuitive.
Requirements
- Python 3.7+
Quick Start (prebuilt image)
The official image is published to the GitHub Container Registry (ghcr.io/tdeckers/openhab-mcp). Pulling this image is the fastest way to get the MCP server running.
By default the server uses stdio for MCP. For remote HTTP clients, set MCP_MODE=remote to expose both Streamable HTTP at http://HOST:PORT/mcp and SSE at http://HOST:PORT/sse from the same container. The container examples below use remote mode; for stdio, omit MCP_MODE and the port mapping. Streamable HTTP supports session headers like Mcp-Session-Id for stateful clients.
-
(Optional for private registries) Authenticate with GHCR:
podman login ghcr.io # or: docker login ghcr.io -
Run the container with Podman (add
-e OPENHAB_USERNAME=...and-e OPENHAB_PASSWORD=...if your OpenHAB instance requires basic authentication):podman run -d --rm -p 8081:8000 \ -e MCP_MODE=remote \ -e OPENHAB_URL=http://your-openhab-host:8080 \ -e OPENHAB_API_TOKEN=your-api-token \ --name openhab-mcp \ ghcr.io/tdeckers/openhab-mcp:latestUsing Docker instead?
docker run -d --rm -p 8081:8000 \ -e MCP_MODE=remote \ -e OPENHAB_URL=http://your-openhab-host:8080 \ -e OPENHAB_API_TOKEN=your-api-token \ --name openhab-mcp \ ghcr.io/tdeckers/openhab-mcp:latest -
Stop the container when you are done:
podman stop openhab-mcp # or: docker stop openhab-mcp
When running with MCP_MODE=remote, the container listens on port 8000 internally, but the examples map it to port 8081 on the host to avoid conflicts with an existing OpenHAB installation. Streamable HTTP clients connect to http://HOST:PORT/mcp, while SSE clients connect to http://HOST:PORT/sse.
Optional: Build and run a custom image
安装
docker run -d --rm -p 8081:8000 \