MCP server that controls a Philips Hue light over Zigbee via zigbee2mqtt (no Hue Bridge, no Home Assistant).
Project description
hue-go-mcp
An MCP server that controls a Philips Hue light over Zigbee via zigbee2mqtt for setups with no Hue Bridge or Home Assistant available (such as for travel and conference scenarios). It speaks MQTT, so any MCP client can read and drive the lamp.
Tools
| Tool | What it does |
|---|---|
set_power(on) |
Turn the lamp on/off |
set_brightness(level) |
Brightness, 0.0–1.0 |
set_color_rgb(r, g, b) |
Color from RGB, each 0.0–1.0 (zigbee2mqtt does the gamut conversion) |
set_color_name(name) |
Color by name: red, green, blue, yellow, cyan, magenta, orange, purple, pink, white, warm, cool |
set_color_temp(mired) |
White color temperature, 150 (cool) – 500 (warm) |
get_state() |
Read back {power, brightness, rgb, model, color_temp_mired, available, link_quality} |
pulse(count, period, min_level, max_level, color) |
Smooth "breathe" fade; restores brightness + power when done |
How it works
MCP client → hue-go-mcp → MQTT broker → zigbee2mqtt → Zigbee coordinator → Hue lamp
Prerequisites
- A Zigbee coordinator (any zigbee2mqtt-supported USB stick) with your Hue light paired into zigbee2mqtt.
- An MQTT broker zigbee2mqtt publishes to (e.g. Mosquitto).
- Python ≥ 3.10.
Setting up the coordinator + zigbee2mqtt + broker is standard zigbee2mqtt territory — see zigbee2mqtt.io. setup-zigbee2mqtt.md has a concrete walkthrough for a SONOFF Dongle Plus MG24 on Windows.
Install
pip install hue-go-mcp # from PyPI
Or run it without installing, straight from PyPI, with uv: uvx hue-go-mcp. For local development from a checkout: pip install -e . (or just pip install "mcp[cli]" aiomqtt and run hue_go_mcp.py directly).
Configure
Set environment variables (only Z2M_DEVICE is required):
| Var | Default | Notes |
|---|---|---|
Z2M_DEVICE |
— | The lamp's zigbee2mqtt friendly name. Find it with python z2m_list_lights.py |
MQTT_BROKER |
localhost |
MQTT broker host |
MQTT_PORT |
1883 |
MQTT broker port |
MQTT_USERNAME / MQTT_PASSWORD |
— | Only if your broker requires auth |
Z2M_BASE_TOPIC |
zigbee2mqtt |
zigbee2mqtt base topic |
HUE_MODEL |
7602031U7 |
Reported in get_state().model |
MCP_TRANSPORT |
stdio |
stdio / http (streamable-http at /mcp) |
Run
Z2M_DEVICE=hue_go python hue_go_mcp.py # stdio
Z2M_DEVICE=hue_go MCP_TRANSPORT=http python hue_go_mcp.py # serves /mcp
On Windows (PowerShell): $env:Z2M_DEVICE="hue_go"; python hue_go_mcp.py.
Smoke-test with the MCP Inspector: mcp dev hue_go_mcp.py, then call set_power(true), set_color_name("red"), pulse(count=2) and watch the lamp.
Use from an MCP client
The server talks stdio and can run anywhere that can reach the broker; the lamp only needs to be in Zigbee range of the coordinator. It only functions while your MQTT broker and zigbee2mqtt are running (see Prerequisites) — otherwise the tools load but every call fails to reach the lamp.
Claude Code
claude mcp add hue-go --env MQTT_BROKER=localhost --env Z2M_DEVICE=hue_go -- uvx hue-go-mcp
Claude Desktop
Add to claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"hue-go": {
"command": "uvx",
"args": ["hue-go-mcp"],
"env": { "MQTT_BROKER": "localhost", "Z2M_DEVICE": "hue_go" }
}
}
}
Any MCP client
Same shape as above: run uvx hue-go-mcp (or python /absolute/path/to/hue_go_mcp.py from a checkout) with MQTT_BROKER and Z2M_DEVICE in the environment. uvx requires uv; if you installed with pip install hue-go-mcp instead, use the hue-go-mcp console script it puts on your PATH as the command.
Tests
pip install -e ".[test]" && pytest
Tests inject a fake MQTT client and assert the exact /set payloads and state parsing — no broker or hardware required.
Files
hue_go_mcp.py— the MCP server (FastMCP).hue_mqtt.py— zigbee2mqtt transport (MqttLamp) over MQTT.z2m_list_lights.py— list zigbee2mqtt devices to findZ2M_DEVICE.setup-zigbee2mqtt.md— coordinator + broker + pairing walkthrough (Windows / SONOFF MG24).zigbee-plan.md— design rationale.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hue_go_mcp-0.3.1.tar.gz.
File metadata
- Download URL: hue_go_mcp-0.3.1.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07b880b04b020080be2901171701e90a915b9e64b54f72cd0b2ee45d944a4aa9
|
|
| MD5 |
0b077d1b99bb1213db2083091e312f4c
|
|
| BLAKE2b-256 |
c4ae768159ca0dafeaae5e95c3abde214995d9f92360652d64471ba887725c02
|
File details
Details for the file hue_go_mcp-0.3.1-py3-none-any.whl.
File metadata
- Download URL: hue_go_mcp-0.3.1-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1d6c22fdb6d2a5283d612693313386e0e5e4736fa3adaa10a02f581a6c675fe
|
|
| MD5 |
71f20783dde4655fc1083dfb876fb8fa
|
|
| BLAKE2b-256 |
cd9d3560a420fe9cc862e1f8e9e13fb898cfd8ecb4add30f0800c1c1ec063bf3
|