# Redis MCP Server [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/YawLabs/redis-mcp  
**GitHub Stars:** 2  
**npm Downloads (last month):** 1627  
**Views:** 7  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/redis-mcp-server

## Description
Read-first Redis MCP: SCAN key explorer, keyspace/TTL/memory/slowlog stats, DBA advisor

## Tools
Capabilities this server exposes over MCP:

- **redis_scan** — Enumerate keys with cursor-based SCAN -- NEVER the O(N) KEYS command, so this is safe to run against a production instance with millions of keys (SCAN yields the event loop between batches). Returns up to REDIS_MAX_KEYS keys (default 1000) matching an optional glob `match` pattern (e.g. `user:*`, `session:??`). When more keys remain, `truncated` is true and `cursor` is non-'0' -- pass that `cursor` back to continue from where you left off. Optionally filter by value `type` (string/list/set/zset/hash/stream). Within one call duplicate keys are removed; across a resumed scan a key may reappear (SCAN's guarantee is no key present for the whole scan is missed, not that none repeats).
- **redis_key_info** — Inspect a single key without reading its (possibly huge) value: type, TTL (seconds and ms, -1 = no expiry, -2 = key missing), internal encoding (`listpack`, `hashtable`, `intset`, ...), serialized memory footprint in bytes (MEMORY USAGE), and idle time. Use this before `redis_get` on an unfamiliar key to avoid pulling a multi-megabyte value into context, and to spot big keys / missing TTLs.
- **redis_get** — Read a key's value, dispatching by type so you get the right shape without knowing the type in advance: string -> the value (byte-windowed at REDIS_MAX_VALUE_BYTES, default 256 KiB, with `truncated` + full `length` when capped); hash -> field/value object; list -> array (LRANGE windowed by `limit`); set -> member array; zset -> [member, score] pairs (ZRANGE WITHSCORES, windowed); stream -> recent entries (XREVRANGE, windowed). Collection reads are capped at `limit` (default REDIS_MAX_KEYS) so a million-element list can't blow out context. The size and `truncated` fields come before the payload, so a host that caps tool results below REDIS_MAX_VALUE_BYTES (Yaw MCP: 100,000 bytes by default) cuts payload, not them. Always read-only.
- **redis_command** — Run a single Redis command through the safety gate. Read-only commands (GET, HGETALL, LRANGE, TYPE, TTL, INFO, ...) always run. Mutating commands (SET, DEL, EXPIRE, HSET, ...) require ALLOW_WRITES=1. KEYS is blocked (use redis_scan). Arbitrary-execution commands (EVAL, FUNCTION, SCRIPT, MULTI, MONITOR, SHUTDOWN, CLUSTER, ...) are never exposed, even with ALLOW_WRITES=1 -- the gate is a curated allowlist, not a blanket 'anything when writes are on'. Use this for commands without a dedicated tool; prefer the typed tools (redis_get, redis_scan, redis_key_info) where they exist.
- **redis_health** — One-call health snapshot rolled up from INFO + DBSIZE + recent SLOWLOG: server version and mode, uptime, memory used vs maxmemory + eviction policy, connected clients + blocked clients, ops/sec, keyspace hit/miss ratio, total keys per database (and how many lack a TTL), persistence (RDB/AOF) status, replication role, and the most recent slow commands. Use as a connection sanity check and the first stop in 'why is Redis slow / using so much memory?' triage.
- **redis_slowlog** — Recent entries from the Redis slow log -- commands that took longer than `slowlog-log-slower-than` microseconds (default 10000 = 10ms). Each entry has the command, execution time in microseconds, a unix timestamp, and the client address/name (Redis 4+). The fastest way to find which specific commands are slow. Read-only (SLOWLOG GET); SLOWLOG RESET would need ALLOW_WRITES and is intentionally not exposed here.
- **redis_advisor** — Rolled-up Redis health lint pass -- one call returns four categories of findings, each with a severity and an actionable fix:
- big_keys: sampled keys whose memory footprint or element count is large enough to make operations O(N) and risk blocking the event loop on delete/expire.
- missing_ttls: share of sampled keys with no expiry -- the classic 'cache fills up and OOMs' setup.
- eviction_pressure: used/maxmemory ratio, active evictions, and the dangerous `noeviction` + no-TTL combination that turns a full instance into failed writes.
- fork_latency_risk: long last-fork time, large dataset + active persistence, and failed background saves -- the causes of periodic latency spikes and durability gaps.
Keys are sampled via SCAN (never KEYS), so it is safe on a large production instance; the big-key / missing-TTL findings are over the SAMPLE, not the whole keyspace.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "redis-mcp-server": {
    "command": "npx",
    "args": ["-y","@yawlabs/redis-mcp@latest"],
    "env": {
      "REDIS_URL": ""
    }
  }
}
```

**Requires environment variables:** `REDIS_URL` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Redis MCP Server does

Redis MCP Server exposes Redis and Valkey inspection tools through the Model Context Protocol. It is designed for investigating what is stored in an instance, checking operational health, and identifying common database risks. The default posture is read-only, making it suitable for asking an agent about a production Redis instance without granting unrestricted command access.

Key enumeration uses cursor-based SCAN rather than KEYS. Results are bounded, can be filtered by glob pattern or Redis value type, and can be resumed with a returned cursor. The advisor also samples keys with SCAN when looking for large values and missing expirations.

## How it works

The server connects using a Redis URL supplied through its environment. `redis_get` determines a key's type before returning a suitable representation: strings, hashes, lists, sets, sorted sets, and streams are handled differently. Collection reads are limited, and large string values are byte-windowed. Responses include size and truncation information so a client can tell when it received only part of a value.

`redis_key_info` provides type, expiration, encoding, serialized memory usage, and idle time without loading the value. This makes it a useful first check for unfamiliar or potentially large keys. Health reporting combines Redis INFO data, database sizes, and recent slow-log entries into one snapshot. The advisor reports findings for sampled big keys, missing TTLs, eviction pressure, and fork-latency risk, with severity and a suggested fix.

Commands sent through `redis_command` pass through a curated safety gate. Read commands are allowed by default. Mutating commands require `ALLOW_WRITES=1`; commands for arbitrary execution, transactions, monitoring, shutdown, cluster administration, and similar high-risk operations remain unavailable.

## Setup and configuration

A standard stdio configuration can run the package through `npx`:

```json
{
  "mcpServers": {
    "redis": {
      "command": "npx",
      "args": ["-y", "@yawlabs/redis-mcp@latest"],
      "env": {
        "REDIS_URL": "redis://:password@host:6379/0"
      }
    }
  }
}
```

`REDIS_URL` is required. It can use a regular Redis connection string or `rediss://` for TLS. On Windows, the configuration wraps `npx` with `cmd /c`.

The server starts in read-only mode. Set `ALLOW_WRITES=1` or `true` to permit the curated mutating commands accepted by `redis_command`; this does not enable blocked arbitrary-execution commands. The package also supports limits for key and value results, including `REDIS_MAX_KEYS` and `REDIS_MAX_VALUE_BYTES`, which bound returned data.

For stronger access control, use a least-privileged Redis ACL user in the connection URL. After changing a stored connection value in Yaw MCP, deactivate the connection or start a new session so the new value is loaded.

## Tools and capabilities

- `redis_scan`: Enumerate keys with resumable, bounded SCAN operations, optional glob matching, and type filtering.
- `redis_key_info`: Inspect TTL, type, encoding, memory footprint, and idle time without reading the value.
- `redis_get`: Read supported Redis value types with collection limits and string byte windows.
- `redis_command`: Run commands through read and write allowlists.
- `redis_health`: Review memory, eviction, clients, throughput, hit/miss ratio, persistence, replication, key counts, TTL coverage, and recent slow commands.
- `redis_slowlog`: Retrieve recent slow commands with execution time, timestamp, and client details.
- `redis_advisor`: Review sampled findings for big keys, missing TTLs, eviction pressure, and fork latency.

## Limitations and notes

This is an explorer and diagnostician, not a general Redis administration console. Pub/sub, MONITOR, cluster management, replication control, scripting, and other high-risk operations are intentionally excluded. Use `redis-cli` for those tasks.

Advisor findings about large keys and missing TTLs apply to the sampled portion of the keyspace, not necessarily every key. SCAN can return a key again across resumed scans, although keys present for the entire scan are not missed. Some health fields become `null` when the connected Redis server does not expose them through INFO.

_Full upstream README: https://allmcps.com/mcp/redis-mcp-server/readme_

