MCP MQTT¶
This guide enables generic MQTT integration through the local Dockerized
mqtt-mcp server registered in .mcp.json.
Scope¶
Current implementation in this repository provides:
- Docker-only MCP transport
- Pinned immutable runtime image digest
- Generic MQTT publish/receive capabilities
- Default broker routing via environment variables
Runtime image: ghcr.io/ezhuk/mqtt-mcp:latest
1. Prepare credentials in Bitwarden¶
Expected Bitwarden item:
- Item name:
MQTT MCP - Field
MQTT_BROKER_URL: broker URL, for examplemqtt://host:1883 - Optional field
MQTT_USERNAME: broker username - Optional field
MQTT_PASSWORD: broker password - Optional field
MQTT_BASE_TOPIC: defaults tozigbee2mqttfor current ZigBee workflows
Hydrate local .env from vault fields:
2. Validate MCP wiring¶
Run from the hermetic Nix shell:
Expected summary includes:
mqtt MCP docker image: ghcr.io/ezhuk/mqtt-mcp@sha256:<digest>
3. Runtime mapping¶
The server uses these environment variables:
MQTT_MCP_MQTT__HOSTMQTT_MCP_MQTT__PORTMQTT_MCP_MQTT__USERNAMEMQTT_MCP_MQTT__PASSWORD
This repository maps them automatically from the hydrated .env values.
4. Example prompts¶
In your MCP-capable client, run prompts similar to:
Use the mqtt MCP server to receive one message from topic "devices/lamp/state" with a 20 second timeout.
Troubleshooting¶
- Connection failures: verify broker reachability and
MQTT_BROKER_URLvalue. - Authentication failures: verify
MQTT_USERNAMEandMQTT_PASSWORD, then re-runjust bw-mqtt-credentials-pull.