A safe, connection-efficient Redis MCP server.
- No accidental data loss. Destructive tools (
redis_delete,redis_expire,redis_flushdb) refuse to run unless called withconfirm=true— the tool description instructs the AI to ask the user first.redis_flushdbadditionally requires the literal phraseconfirm_phrase="FLUSH ALL DATA".redis_setrefuses to overwrite an existing key unlessoverwrite=true. - Gentle on the Redis server.
- One lazy, reused connection per MCP process (
lazyConnect) — no connection churn, no pool needed since stdio MCP calls are sequential. SCANwith cursor + result limits instead ofKEYS(never blocks the server).UNLINKinstead ofDELandFLUSHDB ASYNC— deletes happen in a background thread on the Redis side.- Collection reads are truncated to 200 elements.
- One lazy, reused connection per MCP process (
| Tool | Description | Destructive? |
|---|---|---|
redis_get |
Get a string key | no |
redis_scan |
List keys by pattern (SCAN, limited) | no |
redis_inspect |
Type + TTL + value for any key type | no |
redis_info |
Server INFO (memory, stats, keyspace, …) | no |
redis_set |
Set a string key (won't overwrite without overwrite=true) |
no |
redis_delete |
Delete keys via UNLINK | requires confirm=true |
redis_expire |
Set a key's TTL | requires confirm=true |
redis_flushdb |
Wipe the current DB | requires confirm=true + phrase |
- Node.js ≥ 18
- A reachable Redis server
git clone <this-repo> redis-mcp
cd redis-mcp
npm installConfiguration is a single env var:
REDIS_URL— defaultredis://127.0.0.1:6379. Examples:redis://user:pass@host:6379/2,rediss://host:6380(TLS).
Run manually to verify: REDIS_URL=redis://127.0.0.1:6379 node src/index.js (it prints [redis-mcp] ready on stderr).
In all snippets below, replace /absolute/path/to/redis-mcp with where you cloned it.
claude mcp add redis --env REDIS_URL=redis://127.0.0.1:6379 -- node /absolute/path/to/redis-mcp/src/index.jsOr add to .mcp.json in your project (or ~/.claude.json for global):
{
"mcpServers": {
"redis": {
"command": "node",
"args": ["/absolute/path/to/redis-mcp/src/index.js"],
"env": { "REDIS_URL": "redis://127.0.0.1:6379" }
}
}
}Add the same mcpServers block to claude_desktop_config.json
(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json).
Add to ~/.codex/config.toml:
[mcp_servers.redis]
command = "node"
args = ["/absolute/path/to/redis-mcp/src/index.js"]
env = { REDIS_URL = "redis://127.0.0.1:6379" }Add to opencode.json (project) or ~/.config/opencode/opencode.json (global):
{
"mcp": {
"redis": {
"type": "local",
"command": ["node", "/absolute/path/to/redis-mcp/src/index.js"],
"environment": { "REDIS_URL": "redis://127.0.0.1:6379" },
"enabled": true
}
}
}Settings → MCP Servers → Edit MCP Settings (mcp_settings.json), or .kilocode/mcp.json in your project:
{
"mcpServers": {
"redis": {
"command": "node",
"args": ["/absolute/path/to/redis-mcp/src/index.js"],
"env": { "REDIS_URL": "redis://127.0.0.1:6379" }
}
}
}Agent panel → MCP servers (⚙) → Manage MCP Servers → View raw config (mcp_config.json):
{
"mcpServers": {
"redis": {
"command": "node",
"args": ["/absolute/path/to/redis-mcp/src/index.js"],
"env": { "REDIS_URL": "redis://127.0.0.1:6379" }
}
}
}- The AI calls a destructive tool without
confirm→ the server refuses and returns a message telling the AI to ask the user first, listing exactly what would be deleted. - The user explicitly approves.
- The AI retries with
confirm=true(and the confirm phrase for flush).
The gate lives in the server, so it holds even if the client/AI forgets to ask.
MIT