Repo of the Day
hivemq/mqtt-cli
Published: Jan 22, 2024
Open repository ↗MQTT CLI is a useful command line interface for connecting various MQTT clients supporting MQTT 5.0 and 3.1.1
Summary
mqtt-cli is a Java-based command line interface for MQTT brokers that supports both the MQTT 5.0 and 3.1.1 protocol versions. It bundles publish, subscribe, interactive shell, and broker-testing capabilities behind a single mqtt binary, so engineers can drive MQTT from the terminal without writing client code.
What it is useful for
Engineers working with IoT backends, MQTT brokers, or pub/sub messaging can use mqtt-cli to:
- Publish and subscribe to topics from the terminal, which is handy for debugging topic hierarchies, payload formats, or message flow during development.
- Probe a broker before integration with a real application, using the
testsubcommand to surface a broker's features and limitations. - Run multiple MQTT operations in a single session through the interactive shell (
mqtt sh). - Script MQTT traffic from CI or shell pipelines, since each capability is exposed as a discrete subcommand that can be invoked from scripts.
Because the tool is protocol-version aware (MQTT 5.0 and 3.1.1), it is also useful when verifying behavior differences between the two versions against a real broker.
How engineers can use it
The README does not include OS-specific install commands itself; it points to external documentation for installation and for building from source. Readers should follow the "Getting Started" link in the README for those steps.
The four subcommands documented in the README are:
- Publish:
mqtt pub -t your-topic -m "your message" -h your-mqtt-broker.com - Subscribe:
mqtt sub -t your-topic -h your-mqtt-broker.com - Shell:
mqtt sh(enters the interactive mqtt-cli shell mode) - Test:
mqtt test -h your-mqtt-broker.com(runs capability/limitation tests against the broker)
For the full flag set on each subcommand, including TLS, authentication, retained messages, and QoS options, the README links to dedicated documentation pages under hivemq.github.io/mqtt-cli/docs/. Those pages, rather than the README, are the source of truth for the complete command surface.
The project is licensed under Apache-2.0. Bug reports and feature requests go through GitHub Issues, and contributions follow the project's contributing guide.
Documented limitation: the README is a pointer to deeper docs rather than a self-contained quickstart, so the install steps and full option lists are not present on the GitHub page itself.