Philips Hue MCP Server

by ThomasRohde

Integrations

  • Provides comprehensive control over Philips Hue smart lighting systems, including turning lights on/off, adjusting brightness, changing colors, managing groups, applying scenes, using activity presets, and creating lighting effects.

飞利浦 Hue MCP 服务器

用于控制飞利浦 Hue 智能照明系统的强大的模型上下文协议 (MCP) 接口。

目录

概述

该服务器利用模型上下文协议 (MCP),实现 Claude 等 AI 助手与您的飞利浦 Hue 照明系统之间的无缝集成。借助它,您可以使用自然语言控制智能灯,访问详细的照明信息,并通过标准化的 AI 友好界面创建高级照明设置。

特征

  • 完整的灯光控制:打开/关闭、调节亮度、改变颜色、设置色温
  • 综合组管理:同时控制多个灯,创建自定义组
  • 场景处理:应用现有场景,创建快速自定义照明场景
  • 基于活动的预设:用于阅读、放松、集中注意力等的现成设置
  • 特殊效果:访问动态灯光效果,如颜色循环
  • 自然语言控制:通过对话进行照明控制的专门提示
  • 安全本地集成:直接连接到本地网络上的 Hue 桥

快速入门

# Install dependencies pip install phue mcp # Run the server python hue_server.py # Install in Claude Desktop mcp install hue_server.py --name "My Hue Lights"

然后在 Claude 中,首先说:“我想控制我的飞利浦 Hue 灯。你能告诉我有哪些可用的灯吗?”

设置

先决条件

  • Python 3.9+
  • 本地网络上的飞利浦 Hue 桥接器
  • 飞利浦 Hue 灯与您的桥梁配对

安装

  1. 克隆此存储库或下载hue_server.py文件
  2. 安装所需的依赖项:
pip install phue mcp

首次运行

  1. 运行服务器:
python hue_server.py
  1. 出现提示时,按下 Hue 桥上的链接按钮以授权连接
  2. 您的连接详细信息将保存在~/.hue-mcp/config.json中以供将来使用

与 Claude 一起使用

选项 1:在 Claude Desktop 中安装

如果您已安装 Claude Desktop:

mcp install hue_server.py --name "Philips Hue Controller"

选项 2:使用 MCP 检查器进行测试

对于开发和测试:

mcp dev hue_server.py

API 参考

资源

资源描述
hue://lights有关所有灯光的信息
hue://lights/{light_id}有关特定灯光的详细信息
hue://groups所有灯组信息
hue://groups/{group_id}有关特定群体的信息
hue://scenes所有场景信息

工具

工具描述
get_all_lights获取所有灯光的信息
get_light获取特定灯光的详细信息
get_all_groups获取所有灯光组的信息
get_group获取有关特定组的信息
get_all_scenes获取所有场景的信息
turn_on_light打开特定的灯
turn_off_light关闭特定的灯
set_brightness调节灯光亮度(0-254)
set_color_rgb使用 RGB 值设置灯光颜色
set_color_temperature设置灯光色温(2000-6500K)
turn_on_group打开一组中的所有灯
turn_off_group关闭一组中的所有灯
set_group_brightness调整组亮度(0-254)
set_group_color_rgb设置组内所有灯光的颜色
set_scene将场景应用到组
find_light_by_name按名称搜索灯光
create_group创建新的灯光组
quick_scene应用自定义设置来创建场景
refresh_lights更新灯光信息缓存
set_color_preset将颜色预设应用于灯光
set_group_color_preset将颜色预设应用于组
alert_light让灯光短暂闪烁
set_light_effect设置颜色循环等动态效果

提示

迅速的描述
control_lights自然语言灯光控制
create_mood为活动设置情绪照明
light_schedule了解调度选项

示例

控制单盏灯

# Turn on a light turn_on_light(1) # Set a light to 50% brightness set_brightness(1, 127) # Change a light color to purple set_color_rgb(1, 128, 0, 128) # Set reading mode set_color_preset(1, "reading")

与团体合作

# Turn off all lights in living room (group 2) turn_off_group(2) # Create a new group create_group("Bedroom", [3, 4, 5]) # Set all kitchen lights to energizing mode set_group_color_preset(3, "energize")

创建场景

# Apply an existing scene set_scene(2, "abc123") # Group 2, scene ID abc123 # Create a quick relaxing scene for the living room quick_scene("Evening Relaxation", group_id=2, rgb=[255, 147, 41], brightness=120)

高级选项

使用自定义设置运行服务器:

python hue_server.py --host 0.0.0.0 --port 8888 --log-level debug

故障排除

  • 未找到桥接器:如果自动发现不起作用,您有两个选择:
    1. 使用网桥的 IP 地址手动编辑脚本中的BRIDGE_IP变量
    2. 手动创建配置文件:
      # Create the config directory mkdir -p ~/.hue-mcp # Create a config.json file with your bridge IP echo '{"bridge_ip": "192.168.1.x"}' > ~/.hue-mcp/config.json
      将“192.168.1.x”替换为您的实际 Hue 桥接器 IP 地址
  • 连接问题:删除~/.hue-mcp/config.json并重新启动服务器以重新进行身份验证
  • 灯光控制不工作:使用refresh_lights工具更新灯光信息缓存
  • 群组或场景未显示:重新启动网桥和服务器以同步所有数据

工作原理

该服务器使用phue Python 库连接到您的飞利浦 Hue 桥接器,并通过模型上下文协议 (MCP) 公开功能。当像 Claude 这样的 AI 连接时:

  1. 服务器使用存储的凭证与您的网桥进行身份验证
  2. 它提供描述您的照明设置的资源
  3. 它展示了克劳德可以用来控制灯光的工具
  4. 它提供提示,帮助 Claude 了解如何与灯光互动

为了确保安全和隐私,与 Hue 系统的所有通信都在您的网络内本地进行。

贡献

欢迎贡献!请随意:

  • 在问题跟踪器中报告错误并建议功能
  • 提交带有改进的拉取请求
  • 分享您如何在智能家居设置中使用它的示例

执照

该项目在 MIT 许可下可用。

-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

模型上下文协议接口,使 Claude 等 AI 助手能够通过自然语言命令控制飞利浦 Hue 智能照明系统。

  1. 目录
    1. 概述
      1. 特征
        1. 快速入门
          1. 设置
            1. 先决条件
            2. 安装
            3. 首次运行
          2. 与 Claude 一起使用
            1. 选项 1:在 Claude Desktop 中安装
            2. 选项 2:使用 MCP 检查器进行测试
          3. API 参考
            1. 资源
            2. 工具
            3. 提示
          4. 示例
            1. 控制单盏灯
            2. 与团体合作
            3. 创建场景
          5. 高级选项
            1. 故障排除
              1. 工作原理
                1. 贡献
                  1. 执照

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      An enhanced Model Context Protocol server that enables AI assistants to interact with ClickUp workspaces, supporting task relationships, comments, checklists, and workspace management through natural language.
                      Last updated -
                      40
                      376
                      TypeScript
                      MIT License
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that integrates with Home Assistant to provide smart home control capabilities through natural language, supporting devices like lights, climate systems, locks, alarms, and humidifiers.
                      Last updated -
                      Python
                      MIT License
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol (MCP) integration that allows AI assistants to control Home Assistant devices by searching for entities and controlling devices through natural language commands.
                      Last updated -
                      10
                      Python
                      MIT License
                      • Linux
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that enables AI assistants like Claude to interact directly with Home Assistant, allowing them to query device states, control smart home entities, and perform automation tasks.
                      Last updated -
                      15
                      Python
                      MIT License
                      • Apple
                      • Linux

                    View all related MCP servers

                    ID: qjq6xe8p1x