Control your Govee smart lights from any MCP-compatible client using natural language.
A secure, production-ready MCP (Model Context Protocol) server that enables AI assistants to control your Govee lights through natural language commands. Compatible with Claude Desktop, Claude Code, and any MCP client. Built with TypeScript 6, Zod 4, and the MCP SDK.
- Natural Language Control - "Turn off the floor lamp", "Set bedroom lights to warm white at 30%"
- Security-First - Device allowlists, rate limiting, Zod input validation
- Command Coalescing - Batch operations with automatic deduplication
- Structured Logging - Pino-based JSON logging with request IDs
- Retry with Backoff - Automatic retry for transient API failures
- Cloud + LAN Architecture - Cloud adapter with LAN fallback pattern
- Dry Run Mode - Test safely without hitting real devices
Get your API key from the Govee Developer Portal.
git clone https://github.com/joeynyc/Govee-MCP.git
cd Govee-MCP
npm install
# Copy and configure environment
cp .env.example .env
# Edit .env and add your GOVEE_API_KEYnpm run build
npm startclaude mcp add govee node dist/server.js \
-e "GOVEE_API_KEY=your-api-key-here" \
-e "GOVEE_ALLOWLIST=your-device-ids"Add to your MCP server configuration:
{
"name": "govee",
"command": "node",
"args": ["path/to/dist/server.js"],
"env": {
"GOVEE_API_KEY": "your-api-key-here",
"GOVEE_ALLOWLIST": "your-device-ids"
}
}- Command:
node dist/server.js - Protocol:
stdio - Environment:
GOVEE_API_KEY(required),GOVEE_ALLOWLIST(recommended)
Restrict access to specific devices:
# In .env - replace with your actual device IDs
GOVEE_ALLOWLIST=CB:74:D1:35:33:33:02:47,21:70:DD:6E:03:46:5F:74Find your device IDs:
- Run the server with an empty allowlist
- Ask your MCP client: "List my Govee devices"
- Copy the device IDs you want to control
- Add them to
GOVEE_ALLOWLISTand restart
- API key isolation - Environment-based, never in code
- Rate limiting - Token bucket prevents API abuse (5 RPS default)
- Input validation - All parameters validated with Zod 4 schemas
- Error sanitization - No sensitive data in error messages
- Audit trail - All commands logged with request IDs
"Turn on the living room lights"
"Set bedroom lights to 50% brightness"
"Change the kitchen lights to blue"
"Set office lights to warm white at 3000K"
"Turn off all lights"
"List my Govee devices and their capabilities"
| Variable | Description | Default |
|---|---|---|
GOVEE_API_KEY |
Required - Your Govee API key | - |
GOVEE_ALLOWLIST |
Recommended - Comma-separated device IDs | All devices |
GOVEE_DRY_RUN |
Safe testing mode (logs only) | false |
GOVEE_RATE_RPS |
API requests per second limit | 5 |
GOVEE_BATCH_WINDOW_MS |
Command coalescing window (ms) | 120 |
GOVEE_LAN_ENABLED |
Enable LAN adapter | false |
| Tool | Description |
|---|---|
govee_list_devices |
List all your Govee devices |
govee_get_state |
Get device current state (power, brightness, color, temp) |
govee_set_power |
Turn devices on/off |
govee_set_brightness |
Set brightness (0-100%) |
govee_set_color |
Set RGB color (0-255 each) |
govee_set_color_temp |
Set color temperature in Kelvin |
govee_batch |
Execute multiple commands with automatic coalescing |
src/
├── server.ts # Main MCP server (7 tools)
├── adapters/
│ ├── types.ts # GoveeAdapter interface
│ ├── cloud.ts # Govee Cloud API (native fetch)
│ └── lan.ts # LAN adapter stub with cloud fallback
└── util/
├── types.ts # TypeScript type definitions
├── limiter.ts # Token bucket rate limiting
├── logger.ts # Pino structured logging
└── retry.ts # Retry with exponential backoff
tests/ # Unit and integration tests (vitest)
dashboard/ # Web dashboard (React + Express)
- Node.js 20+
- npm
npm install # Install dependencies
npm run build # Compile TypeScript
npm start # Run the server
npm test # Run tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report- TypeScript 6 - Type-safe development
- MCP SDK 1.29 - Model Context Protocol implementation
- Zod 4 - Schema validation
- Pino 10 - Structured logging
- Vitest 4 - Testing framework
- Node.js 20+ - Runtime (uses built-in fetch, no external HTTP client)
- 401/403 errors - Verify your
GOVEE_API_KEYis correct and active - 404 errors - Check
GOVEE_API_BASEURL
- "Device not allowed" - Add device ID to
GOVEE_ALLOWLIST - Commands ignored - Check device capabilities with
govee_list_devices - Some devices support color OR temperature (not both simultaneously)
- Rate limiting - Adjust
GOVEE_RATE_RPSif hitting limits - Use batch commands to send multiple operations efficiently
- Fork the repository
- Create a feature branch
- Add tests for new features
- Ensure
npm testpasses - Submit a pull request
MIT License - see LICENSE file for details.
- Built on the Model Context Protocol by Anthropic
- Uses the Govee Developer API
- Input validation powered by Zod
Requirements: Node.js 20+ | License: MIT | Security: Always use device allowlists in production