Redis CLI
$ redis-cli Official High Riskredis-cli connects to Redis and Redis-compatible servers (like Valkey) to execute commands, inspect server metrics (INFO), scan keys safely (--scan), and benchmark latency. Runs non-interactively whenever a command is passed as arguments, though it outputs raw RESP/text rather than JSON.
brew install redis redis-cli --scan --pattern ... and redis-cli INFO give fast direct cache diagnostics without an MCP server.
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
Non-interactive when command arguments are passed, supports --raw, --csv, --scan, and REDISCLI_AUTH, though lacks --json.
- Supports
REDISCLI_AUTH,--raw,--csv, and--scan; no--json
--scan avoids server stalls, but redis-cli has no client-side read-only flag and FLUSHALL/KEYS * are easy footguns.
- No client-side
--readonlyguard; dangerous commands rely on server ACLs
Available via Homebrew and OS packages (redis-tools) across macOS, Linux, and Windows (WSL).
- Fast C binary via
brew install redisorredis-tools
Essential, ultra-fast diagnostic tool for Redis/Valkey key inspection, TTL checks, and latency monitoring.
- Direct RESP client with
--latency,--bigkeys, and--scan
Official Redis client maintained in redis/redis (with BSD-licensed Valkey fork alternative).
- Official
redis/redisrepository
Well-documented CLI guide at redis.io/docs/latest/develop/tools/cli/.
- Official docs at redis.io
Security, Auth & Guardrails
Password via REDISCLI_AUTH env var (recommended over -a argv flag) or URI in -u.
Free for local and self-hosted use; Redis 7.4+ moved to dual RSALv2/SSPLv1 (Valkey retains BSD-3-Clause).
# redis-cli Agent Rules - Always pass the Redis command as CLI arguments (never launch interactive `redis-cli` prompt). - Use `--scan --pattern ... | head` instead of `KEYS *`, and `REDISCLI_AUTH` instead of `-a`. - NEVER run `FLUSHALL`, `FLUSHDB`, `CONFIG SET`, or `SHUTDOWN`.
Agent-Ready Command Recipes
Safe Read-Only Queries
redis-cli -u "$REDIS_URL" INFO memory
Reads memory utilization and eviction counters safely.
redis-cli -u "$REDIS_URL" --scan --pattern 'session:*' | head -n 50
Uses non-blocking SCAN cursor iteration instead of dangerous KEYS *.
Strengths for Agents
- +
--scanand--bigkeysprovide production-safe diagnostics without blocking the Redis event loop. - +
REDISCLI_AUTHavoids leaking passwords on the process command line. - + Zero runtime overhead and sub-millisecond execution.
Caveats & Pitfalls
- ! No
--jsonoutput mode (only raw/line/CSV). - ! Running
KEYS *orFLUSHALLon production instances can cause severe outages.