Skip to main content
Glama
mcp-redis-allowlist

mcp-redis-allowlist

by TeaBambooNGU

mcp-redis-allowlist

Read-only Redis MCP server with a configurable command allowlist.

This project is a fixed local variant for production diagnostics. It keeps the small tool surface from @infoinlet/mcp-redis and adds an environment-driven allowlist for exact read-only diagnostic subcommands such as CLIENT LIST, SLOWLOG GET, and LATENCY LATEST.

Tools

  • redis_get: get a string key and TTL.

  • redis_scan: scan keys with SCAN.

  • redis_inspect: inspect type, TTL, size, and preview for string/hash/list/set/zset keys.

  • redis_command: run a Redis command if it passes the read-only guard.

  • redis_info: run INFO, optionally with a section.

Related MCP server: mcp-database

Security Model

By default, writes are blocked at the MCP layer.

  • REDIS_WRITE_ALLOWED=false keeps the read-only guard enabled.

  • REDIS_EXTRA_READONLY_COMMANDS appends exact read-only command specs.

  • REDIS_WRITE_ALLOWED=true bypasses the guard and should not be used for production diagnostics.

Extra command specs are comma or whitespace separated:

REDIS_EXTRA_READONLY_COMMANDS=client:list,slowlog:get,latency:latest

Redis ACL style syntax is also accepted:

REDIS_EXTRA_READONLY_COMMANDS='client|list slowlog|get latency|latest'

Known dangerous subcommands remain blocked unless REDIS_WRITE_ALLOWED=true, including:

  • CLIENT KILL

  • CLIENT PAUSE

  • CLIENT UNPAUSE

  • CLIENT UNBLOCK

  • CLIENT SETNAME

  • SLOWLOG RESET

  • LATENCY RESET

  • CONFIG SET

  • CONFIG RESETSTAT

  • CONFIG REWRITE

Use a Redis read-only or diagnostic ACL user as an additional safety boundary whenever possible.

Install

npm install
npm run build

Run

REDIS_URL='redis://localhost:6379' \
REDIS_WRITE_ALLOWED=false \
REDIS_EXTRA_READONLY_COMMANDS='client:list,slowlog:get,latency:latest' \
node dist/server.js

Codex MCP Config

[mcp_servers.redis_yesorno_prod]
command = "/Users/jason/.local/nodejs/current/bin/node"
args = ["/Users/jason/workspace/mcp-redis-allowlist/dist/server.js"]
startup_timeout_sec = 30.0

[mcp_servers.redis_yesorno_prod.env]
REDIS_URL = "redis://USER:PASSWORD@HOST:PORT/DB"
REDIS_WRITE_ALLOWED = "false"
REDIS_EXTRA_READONLY_COMMANDS = "client:list,slowlog:get,latency:latest"
PATH = "/Users/jason/.local/nodejs/current/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Do not commit real Redis URLs, passwords, or production hostnames.

Diagnostic Examples

Use redis_command with exact subcommands:

{ "command": "CLIENT", "args": ["LIST"] }
{ "command": "SLOWLOG", "args": ["GET", "128"] }
{ "command": "LATENCY", "args": ["LATEST"] }

Development

npm install
npm run build
npm test

The tests verify that the diagnostic commands above can be allowlisted while dangerous related subcommands remain blocked.

Attribution

This server is inspired by the read-only guard and tool shape from @infoinlet/mcp-redis, which is MIT licensed.

Available Tools

5 tools
redis_commandB

Run an arbitrary Redis command restricted to the read-only allowlist unless writes are enabled.

Inputs: command (required), args.

redis_getC

GET a string key and its TTL.

Inputs: key (required).

redis_infoB

Run Redis INFO, optionally scoped to a section.

Inputs: section.

redis_inspectB

Inspect type, TTL, size, and a small preview for a key.

Inputs: key (required).

redis_scanB

Cursor-safe key scan by glob pattern using SCAN.

Inputs: count, match.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 5 tools

    Disambiguation4/5

    Most tools have distinct purposes: redis_get is for string keys, redis_inspect is a general inspection tool, redis_scan is for scanning, redis_info is for server info, and redis_command is a generic command runner. There is slight overlap between redis_get and redis_inspect for string key retrieval, but redis_inspect also provides more metadata and works on any key type.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with 'redis_' prefix and an imperative verb (command, get, info, inspect, scan). No mixing of naming conventions.

    Tool Count4/5

    5 tools is within the typical range for a focused Redis server, covering common read-only operations and inspection. It's slightly minimal but reasonable.

    Completeness2/5

    The tool set is heavily read-only, missing write operations (SET, DEL, update) and support for non-string data structures. This creates significant gaps for typical Redis usage workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables exploring and diagnosing a Redis instance from MCP clients with read-only safety, using SCAN instead of KEYS for safe key enumeration.
      7
      280 npm
      2
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Read-only MySQL/MariaDB MCP server for running SELECT queries safely, with automatic read-only enforcement and query limits.
      3
      14 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Lightweight MCP server for Redis that allows running any Redis command and searching Redis documentation. Supports multiple named databases with HTTP/REST or TCP transport.
      127 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A safe, connection-efficient Redis MCP server that provides tools for reading and managing Redis data, with safeguards like confirmation requirements for destructive operations.
      47 npm
      ISC