NATS CLI
$ nats Foundation Med RiskThe nats CLI manages NATS Core pub/sub, JetStream streams and consumers, KV buckets, Object Stores, and server diagnostics. Supports -j JSON output on inspection commands, named --context profiles, and clean non-interactive execution.
brew install nats-io/nats-tools/nats nats stream ls -j, nats kv get --raw, and nats server info -j expose JetStream and KV state cleanly in shell pipelines without MCP.
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
Supports -j (--json) across JetStream/server/account inspection, --raw on kv get, and named contexts.
- Supports
-jJSON output,--raw, andnats contextprofiles
Clean context separation and NKey/JWT creds support; destructive purge/rm commands prompt unless -f is passed.
- Confirmation prompts on destructive
purge/rmunless--forceis used
Single Go binary via Homebrew, go install, and GitHub Releases for macOS, Linux, and Windows.
- Static Go binary (
nats-io/natscli)
Swiss army knife for NATS pub/sub, JetStream streams, KV stores, object stores, and benchmarking.
- Covers Core NATS, JetStream, KV, Object Store, and RTT/bench
Official CNCF/Synadia nats-io/natscli repository under Apache-2.0.
- Official
nats-io/natsclirepository
Well-documented at docs.nats.io with rich --help output.
- Official docs at docs.nats.io/using-nats/nats-tools/nats_cli
Security, Auth & Guardrails
Connection contexts saved in ~/.config/nats/context/ (nats context), or supplied via NATS_URL and --creds.
100% free and Apache-2.0 open-source (CNCF project).
# NATS CLI Agent Rules - Always pass `-j` for `stream`, `consumer`, `kv`, and `server` inspection commands. - Pass `--count=1` (or `--wait`) to `nats sub` so subscriptions exit instead of streaming indefinitely. - NEVER run `nats stream purge`, `nats stream rm`, or `nats kv del` without confirmation.
Agent-Ready Command Recipes
Safe Read-Only Queries
nats stream ls -j
Outputs configured JetStream stream names and state as JSON.
nats kv get config app.settings --raw
Fetches the raw value of a KV entry without decorative formatting.
Controlled Writes & Previews
nats pub events.test '{"ok":true}' Publishes one structured payload to a test subject and exits immediately.
Strengths for Agents
- +
-jJSON output and--rawKV reads make automation effortless. - +
nats contextcleanly isolates dev, staging, and prod credentials. - + Single binary handles messaging, JetStream, KV, and Object Store.
Caveats & Pitfalls
- !
nats substreams forever unless bounded with--count=<n>. - ! Commands without
-joften render ASCII tables or interactive prompts.