/ Diretório / Playground / Redis
● Oficial redis 🔑 Requer sua chave

Redis

por 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.

Por que usar

Principais recursos

Demo ao vivo

Como fica na prática

redis.replay ▶ pronto
0/0

Instalar

Escolha seu cliente

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

Abra Claude Desktop → Settings → Developer → Edit Config. Reinicie após salvar.

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

Cursor usa o mesmo esquema mcpServers que o Claude Desktop. Config de projeto vence a global.

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

Clique no ícone MCP Servers na barra lateral do Cline, depois "Edit Configuration".

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

Mesmo formato do Claude Desktop. Reinicie o Windsurf para aplicar.

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

O Continue usa um array de objetos de servidor em vez de um map.

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

Adicione em context_servers. Zed recarrega automaticamente ao salvar.

claude mcp add redis -- uvx mcp-redis

Uma linha só. Verifique com claude mcp list. Remova com claude mcp remove.

Casos de uso

Usos do mundo real: Redis

Investigate why a cached value is stale or missing

👤 Backend engineers debugging cache bugs ⏱ ~10 min beginner

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

Pré-requisitos
  • Redis URL with at least read accessREDIS_URL=redis://:pw@host:6379/0
Fluxo
  1. Find the right key
    Scan keys matching user:profile:42* — show each with its type and TTL.✓ Copiado
    → 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?✓ Copiado
    → 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.✓ Copiado
    → DEL returned 1 or more

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

Armadilhas
  • 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

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

Fluxo
  1. List active counters
    Scan for keys matching ratelimit:* and group by prefix. Show count per group.✓ Copiado
    → Prefix histogram
  2. Find top consumers
    For ratelimit:api:*, return the 20 keys with the highest integer value.✓ Copiado
    → 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.✓ Copiado
    → Key deleted + blocklist updated

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

Armadilhas
  • 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
Combine com: sentry

Find and purge orphan session keys consuming memory

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

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

Fluxo
  1. Sample big keys
    Find the 50 largest keys by memory (use MEMORY USAGE per sampled key across a SCAN pass).✓ Copiado
    → 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.✓ Copiado
    → 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.✓ Copiado
    → Number of keys given a TTL

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

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

Inspect a Redis Stream for stuck consumer-group entries

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

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

Fluxo
  1. Check the stream and groups
    For stream jobs, show XLEN, consumer groups, and pending count per group.✓ Copiado
    → Backlog numbers
  2. Look at pending entries
    For group workers, list the top 20 PEL entries (XPENDING) — show idle time and consumer.✓ Copiado
    → 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.✓ Copiado
    → Reclaim/ack summary

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

Armadilhas
  • 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

Quando usar: A flag isn't behaving as expected for a subset of users.

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

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

Armadilhas
  • 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
Combine com: sentry

Combinações

Combine com outros MCPs para 10× de alavancagem

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.✓ Copiado
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.✓ Copiado
redis + filesystem

Export a snapshot of keys for offline analysis

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

Ferramentas

O que este MCP expõe

FerramentaEntradasQuando chamarCusto
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

Custo e limites

O que custa rodar

Cota de API
Bounded by Redis command-per-second limits (your instance, not the MCP)
Tokens por chamada
Most commands <200 tokens; HGETALL/LRANGE scale with data size
Monetário
Free against your existing Redis. Redis Cloud free tier 30MB.
Dica
Always pass a realistic count to SCAN (default 10 is slow at scale; 1000 is a good batch).

Segurança

Permissões, segredos, alcance

Escopos mínimos: ACL user with `~pattern` and `+@read` for read-only work
Armazenamento de credenciais: REDIS_URL (includes password) in env; prefer TLS with rediss://
Saída de dados: Direct TCP to your Redis endpoint; no third-party proxy
Nunca conceda: FLUSHALL FLUSHDB CONFIG SET SHUTDOWN

Solução de problemas

Erros comuns e correções

NOAUTH Authentication required

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

Verificar: 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.

Verificar: 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.

Verificar: redis-cli INFO memory

Alternativas

Redis vs. outros

AlternativaQuando usarTroca
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

Mais

Recursos

📖 Leia o README oficial no GitHub

🐙 Ver issues abertas

🔍 Ver todos os 400+ servidores MCP e Skills