Govee MCP Server

Govee MCP Server

site icon
2025.02.17 0
PythonLED 设备控制智能家居娱乐功能
Govee MCP Server 是一个通过 Govee API 控制 Govee LED 设备的 MCP 服务器。它提供了多种工具来控制 LED 设备的开关、颜色和亮度,适用于需要通过程序化方式控制 Govee LED 设备的场景。
View on GitHub

Overview

基本能力

产品定位

Govee MCP Server 是一个通过 Govee API 控制 Govee LED 设备的 MCP 服务器。

核心功能

  • 控制 Govee LED 设备的开关
  • 设置 LED 设备的颜色(RGB 值)
  • 调整 LED 设备的亮度

适用场景

  • 需要通过程序化方式控制 Govee LED 设备的场景
  • 自动化灯光控制
  • 智能家居集成

工具列表

  • turn_on_off: 控制 LED 设备的开关
  • set_color: 设置 LED 设备的颜色(RGB 值)
  • set_brightness: 调整 LED 设备的亮度

常见问题解答

  1. 如何获取 API Key、设备 ID 和 SKU?
  2. API Key 可以从 Govee Developer Portal 获取
  3. 设备 ID 和 SKU 可以通过 Govee Home 应用查找

使用教程

使用依赖

  1. 创建 .env 文件并设置以下环境变量: bash GOVEE_API_KEY=your_api_key_here GOVEE_DEVICE_ID=your_device_id_here GOVEE_SKU=your_device_sku_here

安装教程

通过 Smithery 安装

npx -y @smithery/cli install @mathd/govee_mcp_server --client claude

手动安装

# 使用 pip 安装
pip install .

# 开发模式安装(包含测试依赖)
pip install -e ".[test]"

调试方式

运行测试

# 安装测试依赖
pip install -e ".[test]"

# 运行所有测试
pytest tests/

# 运行特定测试文件
pytest tests/test_server.py  # 服务器测试(模拟 API 调用)
pytest tests/test_cli.py    # CLI 测试(真实 API 调用)

# 运行测试并显示详细输出
pytest tests/ -v

命令行界面使用

# 开关设备
govee-cli power on
govee-cli power off

# 设置颜色(RGB 值 0-255)
govee-cli color 255 0 0  # 红色
govee-cli color 0 255 0  # 绿色
govee-cli color 0 0 255  # 蓝色

# 设置亮度(0-100)
govee-cli brightness 50

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。