/ Verzeichnis / Playground / Redis
● Offiziell redis 🔑 Eigener Schlüssel nötig

Redis

von redis · redis/mcp-redis

Talk to Redis in English — inspect keys, manage caches, tune expirations, and debug pub/sub without memorizing every Redis command.

Redis's official MCP exposes the full Redis command surface through typed tools: strings, hashes, lists, sets, sorted sets, streams, pub/sub, and key management. Defaults to a single Redis URL; works with OSS Redis, Redis Stack, Redis Cloud, and ElastiCache/MemoryDB.

Warum nutzen

Hauptfunktionen

Live-Demo

In der Praxis

redis.replay ▶ bereit
0/0

Installieren

Wählen Sie Ihren Client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "redis": {
      "command": "uvx",
      "args": [
        "mcp-redis"
      ]
    }
  }
}

Öffne Claude Desktop → Settings → Developer → Edit Config. Nach dem Speichern neu starten.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "redis": {
      "command": "uvx",
      "args": [
        "mcp-redis"
      ]
    }
  }
}

Cursor nutzt das gleiche mcpServers-Schema wie Claude Desktop. Projektkonfiguration schlägt die globale.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "redis": {
      "command": "uvx",
      "args": [
        "mcp-redis"
      ]
    }
  }
}

Klicken Sie auf das MCP-Servers-Symbol in der Cline-Seitenleiste, dann "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "redis": {
      "command": "uvx",
      "args": [
        "mcp-redis"
      ]
    }
  }
}

Gleiche Struktur wie Claude Desktop. Windsurf neu starten zum Übernehmen.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "redis",
      "command": "uvx",
      "args": [
        "mcp-redis"
      ]
    }
  ]
}

Continue nutzt ein Array von Serverobjekten statt einer Map.

~/.config/zed/settings.json
{
  "context_servers": {
    "redis": {
      "command": {
        "path": "uvx",
        "args": [
          "mcp-redis"
        ]
      }
    }
  }
}

In context_servers hinzufügen. Zed lädt beim Speichern neu.

claude mcp add redis -- uvx mcp-redis

Einzeiler. Prüfen mit claude mcp list. Entfernen mit claude mcp remove.

Anwendungsfälle

Praxisnahe Nutzung: Redis

Investigate why a cached value is stale or missing

👤 Backend engineers debugging cache bugs ⏱ ~10 min beginner

Wann einsetzen: A user says 'I updated my profile but it's still showing the old name' — likely a cache invalidation issue.

Voraussetzungen
  • Redis URL with at least read accessREDIS_URL=redis://:pw@host:6379/0
Ablauf
  1. Find the right key
    Scan keys matching user:profile:42* — show each with its type and TTL.✓ Kopiert
    → Matching keys list
  2. Inspect the stored value and expiry
    For user:profile:42, GET the value and show the TTL. Is it stale vs expected?✓ Kopiert
    → Value + TTL + verdict
  3. Bust it deliberately
    Delete that key (and any related list/set keys) so the app repopulates on next read. Confirm deletion.✓ Kopiert
    → DEL returned 1 or more

Ergebnis: A confirmed-fixed cache with a trail of what was stale and why.

Fallstricke
  • KEYS * on a big instance stalls the server — Always use SCAN (the server translates scan tools to non-blocking cursors); never KEYS

Audit rate-limit counters for abuse patterns

👤 Platform / abuse team ⏱ ~15 min intermediate

Wann einsetzen: You suspect a client is bursting against your rate limiter; you want to see live counters and TTLs.

Ablauf
  1. List active counters
    Scan for keys matching ratelimit:* and group by prefix. Show count per group.✓ Kopiert
    → Prefix histogram
  2. Find top consumers
    For ratelimit:api:*, return the 20 keys with the highest integer value.✓ Kopiert
    → Top-20 offenders
  3. Block or reset
    For abusive key ratelimit:api:client_abc, DELETE it so the next call fails open — and add client_abc to blocklist set abuse:blocked with EXPIRE 86400.✓ Kopiert
    → Key deleted + blocklist updated

Ergebnis: Live evidence of abuse plus targeted mitigation, all in a few Redis ops.

Fallstricke
  • Deleting a rate-limit key lets the client burst again immediately — Add to a blocklist set first, then delete the counter — not the other way around
Kombinieren mit: sentry

Find and purge orphan session keys consuming memory

👤 SREs responding to a Redis memory alert ⏱ ~20 min intermediate

Wann einsetzen: Redis is at 85% maxmemory and you need to know what's filling it before it evicts important keys.

Ablauf
  1. Sample big keys
    Find the 50 largest keys by memory (use MEMORY USAGE per sampled key across a SCAN pass).✓ Kopiert
    → Largest keys list with sizes
  2. Group by prefix and sum
    From that sample, group keys by the first colon-segment. Sum sizes per group to find the worst prefix.✓ Kopiert
    → Prefix → total bytes
  3. Prune with TTL fix
    For prefix session: keys without TTL (persistent), set EXPIRE to 86400 seconds. Count how many got updated.✓ Kopiert
    → Number of keys given a TTL

Ergebnis: Memory relief plus a root-cause (missing EXPIRE on session writes) to fix in app code.

Fallstricke
  • MEMORY USAGE is expensive on big hashes/zsets — Sample 5–10k keys via SCAN, not the full keyspace
Kombinieren mit: sentry

Inspect a Redis Stream for stuck consumer-group entries

👤 Engineers using Redis Streams for work queues ⏱ ~20 min advanced

Wann einsetzen: A consumer group is lagging; messages aren't being ack'd; throughput has tanked.

Ablauf
  1. Check the stream and groups
    For stream jobs, show XLEN, consumer groups, and pending count per group.✓ Kopiert
    → Backlog numbers
  2. Look at pending entries
    For group workers, list the top 20 PEL entries (XPENDING) — show idle time and consumer.✓ Kopiert
    → Stuck message ids
  3. Reclaim or drop
    XCLAIM idle>300000 the stuck entries to a fresh consumer; or XACK them if they're safe to drop. Confirm with me which before running.✓ Kopiert
    → Reclaim/ack summary

Ergebnis: Stream unblocked with a documented action (claim vs ack) per batch.

Fallstricke
  • XACK without inspecting the message can silently drop work — Always fetch the message body (XRANGE) and confirm it's safe to drop before XACK

Debug feature-flag rollout stored in Redis hashes

👤 Platform teams using Redis-backed flags ⏱ ~10 min beginner

Wann einsetzen: A flag isn't behaving as expected for a subset of users.

Ablauf
  1. Inspect the flag hash
    HGETALL flags:new-checkout. Show every field and value.✓ Kopiert
    → Flag definition
  2. Check override set
    SMEMBERS flags:new-checkout:allowlist and flags:new-checkout:blocklist. Is user 42 in either?✓ Kopiert
    → Membership answers
  3. Fix and verify
    SADD user 42 to the allowlist. Re-read HGETALL to confirm flag state is otherwise unchanged.✓ Kopiert
    → Allowlist updated; other fields identical

Ergebnis: The flag matches intended state, with a verified change record.

Fallstricke
  • Writing to flag keys without coordination breaks another admin's ongoing test — Announce in #platform before any write; better, use an admin UI that logs changes
Kombinieren mit: sentry

Kombinationen

Mit anderen MCPs für 10-fache Wirkung

redis + sentry

Correlate a cache key with the Sentry error that referenced it

Sentry event mentions cache key user:profile:42 as missing. GET the key, check its TTL, and confirm whether it was evicted or never populated.✓ Kopiert
redis + postgres

Compare cached counts to source-of-truth in Postgres

GET stats:active_users:today from Redis. Run SELECT COUNT(*) FROM users WHERE last_seen > ... in Postgres. Report drift.✓ Kopiert
redis + filesystem

Export a snapshot of keys for offline analysis

SCAN every key matching session:*, dump key+TTL+size to /tmp/session-audit.jsonl.✓ Kopiert

Werkzeuge

Was dieses MCP bereitstellt

WerkzeugEingabenWann aufrufenKosten
scan pattern: str, count?: int Discover keys by pattern (always, never use KEYS) free
type key: str Before any data-type-specific op on an unknown key free
get / set / del key, value?, ex? String ops — caches, counters, locks free
hgetall / hset / hdel key, field?, value? Structured records stored as hashes free
sadd / smembers / sismember / srem key, member(s) Blocklists, allowlists, memberships free
zadd / zrange / zrangebyscore key, score+member(s) Leaderboards, priority queues free
xadd / xrange / xread / xpending / xclaim / xack stream ops Work queues on Redis Streams free
ttl / expire / persist key, seconds? Check or set expirations free
info / memory_usage section? / key Capacity and perf inspection free

Kosten & Limits

Was der Betrieb kostet

API-Kontingent
Bounded by Redis command-per-second limits (your instance, not the MCP)
Tokens pro Aufruf
Most commands <200 tokens; HGETALL/LRANGE scale with data size
Kosten in €
Free against your existing Redis. Redis Cloud free tier 30MB.
Tipp
Always pass a realistic count to SCAN (default 10 is slow at scale; 1000 is a good batch).

Sicherheit

Rechte, Secrets, Reichweite

Minimale Scopes: ACL user with `~pattern` and `+@read` for read-only work
Credential-Speicherung: REDIS_URL (includes password) in env; prefer TLS with rediss://
Datenabfluss: Direct TCP to your Redis endpoint; no third-party proxy
Niemals gewähren: FLUSHALL FLUSHDB CONFIG SET SHUTDOWN

Fehlerbehebung

Häufige Fehler und Lösungen

NOAUTH Authentication required

Password missing from REDIS_URL. Use redis://:password@host:6379.

Prüfen: redis-cli -u $REDIS_URL PING
MOVED 1234 other-host:6379 (Redis Cluster)

Plain MCP uses standalone client. Point at a cluster-aware proxy or use a non-cluster Redis endpoint.

ERR unknown command 'JSON.GET'

That's Redis Stack only. Either upgrade to Redis Stack / Redis Cloud, or store as hashes.

Prüfen: redis-cli MODULE LIST
OOM command not allowed when used memory > 'maxmemory'

Redis is full. Check MEMORY STATS, evict or grow the instance, and set TTLs on future writes.

Prüfen: redis-cli INFO memory

Alternativen

Redis vs. andere

AlternativeWann stattdessenKompromiss
Memcached MCPYou have plain KV cache needs, no data structuresMuch smaller surface; no lists/sets/streams
DragonflyDB MCPRedis-compatible but multi-threadedNewer; not every module works

Mehr

Ressourcen

📖 Offizielle README auf GitHub lesen

🐙 Offene Issues ansehen

🔍 Alle 400+ MCP-Server und Skills durchsuchen