关于 Govee MCP Server
Govee MCP Server 通过 Govee API 让 MCP 客户端控制 Govee LED 设备,提供电源、RGB 颜色和亮度工具,也附带用于直接控制设备的命令行工具。
主要功能
- 01开启或关闭 LED 设备
- 02通过 RGB 值设置颜色
- 03调整亮度
- 04通过命令行直接控制设备
适用场景
- 01通过 MCP 客户端控制 Govee 灯具
- 02设置灯具的 RGB 颜色
- 03通过命令行调整设备亮度
MCP 相关
该 MCP 服务通过 Govee API 提供工具,用于开关 Govee LED 设备、设置 RGB 颜色和调整亮度。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Govee MCP 服务
用于通过 Govee API 控制 Govee LED 设备的 MCP 服务。
设置
环境变量
在根目录中创建 .env 文件,并添加以下变量:
GOVEE_API_KEY=your_api_key_here
GOVEE_DEVICE_ID=your_device_id_here
GOVEE_SKU=your_device_sku_here
获取这些值的方法:
- 从 Govee Developer Portal 获取 API 密钥
- 使用 Govee Home 应用查找设备 ID 和 SKU
安装
通过 Smithery 安装
通过 Smithery 自动为 Claude Desktop 安装 Govee MCP 服务:
npx -y @smithery/cli install @mathd/govee_mcp_server --client claude
手动安装
# Install with pip
pip install .
# For development (includes test dependencies)
pip install -e ".[test]"
使用方法
MCP 服务
此 MCP 服务通过 Model Context Protocol 提供用于控制 Govee 设备的工具。它可以与 Cline 或其他 MCP 客户端搭配使用。
可用工具:
turn_on_off:打开或关闭 LEDset_color:使用 RGB 值设置 LED 颜色set_brightness:设置 LED 亮度
命令行界面
提供了用于直接控制 Govee 设备的 CLI:
# Turn device on/off
govee-cli power on
govee-cli power off
# Set color using RGB values (0-255)
govee-cli color 255 0 0 # Red
govee-cli color 0 255 0 # Green
govee-cli color 0 0 255 # Blue
# Set brightness (0-100)
govee-cli brightness 50
运行 govee-cli --help 查看完整的命令文档。
开发
运行测试
运行测试套件:
# Install test dependencies
pip install -e ".[test]"
# Run all tests
pytest tests/
# Run specific test files
pytest tests/test_server.py # Server tests (mocked API calls)
pytest tests/test_cli.py # CLI tests (real API calls)
# Run tests with verbose output
pytest tests/ -v
注意:CLI 测试会对 Govee 设备进行真实 API 调用,并实际控制设备。运行这些测试前,请确保设备已通电并连接。
项目结构
.
├── src/govee_mcp_server/
│ ├── __init__.py
│ ├── server.py # MCP server implementation
│ └── cli.py # Command-line interface
├── tests/
│ ├── test_server.py # Server tests (with mocked API)
│ └── test_cli.py # CLI tests (real API calls)
└── pyproject.toml # Project configuration
测试覆盖范围
-
服务测试涵盖:
- 环境初始化
- Govee API 客户端方法
- 服务工具和实用程序
- 错误处理
-
CLI 测试通过执行实际 API 调用来控制 Govee 设备,进行真实场景集成测试。
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。