Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Mosquitto CLI

$ mosquitto_pub Foundation Low Risk
Eclipse Foundation · Database & Data · EPL-2.0 OR EDL-1.0 · macos / linux / windows

mosquitto_pub is the reference C command-line MQTT 3.1/3.1.1/5.0 publisher from Eclipse Mosquitto (paired with mosquitto_sub for subscribing). Supports QoS levels (-q 0|1|2), retained messages (-r), TLS certs (--cafile), and single-shot publish-and-exit execution.

FCRS-1.0 Score
72 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
brew install mosquitto
CLI vs MCP Decision CLI Only

mosquitto_pub executes sub-10ms single-shot MQTT publishes with -m or -s (stdin) and has no MCP equivalent.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 16 / 25

Single-shot mosquitto_pub exits cleanly with clear exit codes, though it has no JSON diagnostic wrapper and companion mosquitto_sub hangs unless -C/-W are passed.

  • Non-interactive single-shot publish via -m or -s
  • No JSON output envelope
Trust & Safety 20 / 25

Supports TLS mTLS flags (--cafile, --cert, --key) and explicit -r retain flag, though -P on CLI can leak in process lists and no --dry-run exists.

  • Full TLS/mTLS support; lacks --dry-run
Setup & Portability 13 / 15

Tiny native C binary available in virtually every Linux distro repo (apt, apk), Homebrew, and Windows installers.

  • Ubiquitous package availability via brew install mosquitto and OS repos
Utility & Efficiency 10 / 15

Focused single-purpose MQTT publisher; needs companion mosquitto_sub for reading and lacks benchmarking or payload formatting.

  • Publish-only binary (mosquitto_sub is separate)
Maintenance & Lineage 7 / 10

Maintained by the Eclipse Foundation (eclipse-mosquitto/mosquitto) under EPL-2.0 / EDL-1.0.

  • Official Eclipse Foundation project
Docs & Verifiability 6 / 10

Classic Unix manpage (mosquitto_pub(1)) covers every flag accurately, though terse for quick examples.

  • Official manpage at mosquitto.org/man/mosquitto_pub-1.html

Security, Auth & Guardrails

Auth Modes
No Auth Env API Key Config File
Credential Storage

Reads defaults from ~/.config/mosquitto_pub (if configured) or receives -u/-P credentials and --cafile/--cert/--key TLS flags per invocation.

Side Effects
Remote Write
Cost & Quotas

Dual-licensed EPL-2.0 / EDL-1.0 open-source by the Eclipse Foundation; free to use.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Mosquitto CLI Agent Rules
- Always bound companion `mosquitto_sub` calls with `-C <count>` and `-W <timeout_sec>` so reads exit cleanly.
- Never pass `-r` (retained) or `-n` (clear retained) on shared topics without explicit user approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

Sample one retained or live MQTT message via mosquitto_sub
mosquitto_sub -h localhost -t 'sensors/+/temp' -C 1 -W 5 -v

Uses companion mosquitto_sub with -C 1 and -W 5 timeout to safely read at most 1 message without hanging.

Controlled Writes & Previews

Publish a QoS 1 JSON message to an MQTT topic
mosquitto_pub -h localhost -t 'sensors/room1/cmd' -q 1 -m '{"state":"ping"}'

Publishes a single message with QoS 1 delivery acknowledgment and exits.

Strengths for Agents

  • + Instant startup C binary available on nearly every OS and container image.
  • + Clean single-shot publish semantics (-h, -t, -m, -q) with MQTT 5.0 support (-V 5).
  • + Supports stdin piping (-s) and TLS mutual authentication.

Caveats & Pitfalls

  • ! Publish-only binary—reading messages requires companion mosquitto_sub with -C/-W bounds.
  • ! Passing -P <password> on the command line exposes credentials in ps output.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI