| name | mqtt-monitor-all |
| description | Subscribe to all MQTT topics (`#`) on the configured broker and stream payloads for observation. Use when the user wants to see every message flowing through their broker, sniff activity, or find which topic a device publishes to. Requires `/mqtt-setup` to have been run previously. |
Monitor all MQTT payloads
Subscribe to the wildcard topic # on the user's configured broker and stream incoming messages.
Load credentials
Before anything else, source the credentials file:
if [ ! -f ~/.claude/plugins-data/mqtt-observability/credentials.env ]; then
echo "No MQTT credentials found. Run /mqtt-setup first." >&2
exit 1
fi
set -a; . ~/.claude/plugins-data/mqtt-observability/credentials.env; set +a
Subscribe
Use mosquitto_sub with verbose mode so topic names are printed alongside payloads:
mosquitto_sub -h "$MQTT_HOST" -p "$MQTT_PORT" \
${MQTT_USERNAME:+-u "$MQTT_USERNAME"} \
${MQTT_PASSWORD:+-P "$MQTT_PASSWORD"} \
-t '#' -v
How to run it
Because this is a streaming command, run it with run_in_background: true and then use Monitor (or read the background output) to collect payloads. Ask the user how long to watch (default: 30 seconds) and then stop the background job.
If the user asks for a bounded capture, prefer timeout 30 mosquitto_sub ... so the command exits cleanly.
Output to the user
Summarise what was seen:
- Distinct topics observed
- Message rate per topic (approx)
- Any notable payloads (JSON decoded if possible)
Don't dump thousands of raw lines into the conversation — group and summarise.
Dependency
Requires mosquitto-clients. If missing, tell the user:
sudo apt install mosquitto-clients