kcat
$ kcat Community Med Riskkcat (formerly kafkacat) is a lightweight C/librdkafka CLI for inspecting Kafka brokers, consuming messages, and producing test events without Java overhead. Supports -L -J for JSON cluster metadata, -C -e -c <n> -J for bounded message reads, and SASL/TLS configs.
brew install kcat kcat -L -J and kcat -C -e -c 10 -J inspect Kafka topics and offsets in milliseconds without spinning up a JVM.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
-J JSON envelope output, -L metadata inspection, -e exit-at-EOF, and -c <n> count bounds fit automated pipelines well.
- Supports
-J,-L,-e, and-cbounded reads
Does not perform topic deletion or cluster admin mutations; consumer mode requires -e/-c to avoid infinite tailing.
- Read/produce client only; no admin DDL commands
Fast native C binary via Homebrew and Linux distros, though Windows usually uses Docker/WSL.
- Lightweight native binary via
brew install kcatand apt/apk
Replaces slow JVM kafka-console-consumer scripts with instant librdkafka inspection.
- Zero-JVM Kafka metadata and payload sampling
Built on librdkafka by Magnus Edenhill (edenhill/kcat), widely trusted in Kafka operations.
- Established
edenhill/kcatproject
Concise README examples and -h usage text.
- README examples and
-hhelp
Security, Auth & Guardrails
Broker auth and TLS/SASL settings read from ~/.config/kcat.conf (KAFKACAT_CONFIG) or -X properties.
100% free and BSD-2-Clause open-source.
# kcat Agent Rules - Always pass `-e` and `-c <count>` in consumer mode (`-C`) so `kcat` exits instead of tailing forever. - Always pass `-J` on `-L` metadata and `-C` reads for clean JSON parsing. - Use `-F ~/.config/kcat.conf` for SASL secrets instead of inline `-X sasl.password=...`.
Agent-Ready Command Recipes
Safe Read-Only Queries
kcat -b localhost:9092 -L -J
Lists brokers, topics, and partition leaders in structured JSON and exits immediately.
kcat -b localhost:9092 -t events -C -o -10 -c 10 -e -J
Reads at most 10 messages (-c 10), exits at end of partition (-e), and wraps payloads in JSON (-J).
Controlled Writes & Previews
printf '{"event":"ping"}
' | kcat -b localhost:9092 -t events -P Publishes a single bounded line to a Kafka topic and exits.
Strengths for Agents
- +
-Joutputs structured JSON envelopes with topic, partition, offset, key, and payload. - +
-e -c <n>guarantees consumer calls terminate cleanly. - + Zero JVM startup delay compared to official Apache Kafka shell scripts.
Caveats & Pitfalls
- ! Running
-Cwithout-eor-cblocks indefinitely waiting for new messages. - ! Protobuf or Avro Schema Registry decoding requires extra flags (
-s value=avro -r ...).