mcp-server-redis
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Redis connection URL, e.g., redis://localhost:6379/0 | |
| REDIS_URL | No | Redis connection URL provided via environment variable, e.g., redis://localhost:6379/0 | |
| allow-write | No | Set to 'true' to enable write operations (SET, DEL, EXPIRE). Default is 'false'. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| redis_execute_commandA | 执行单行原生 Redis 命令或多命令管道批处理(核心命令网关)。 支持单行原生 Redis 语法与标准引号分词(如 'GET key', 'SET key "hello world"')。 支持通过 'commands' 传入命令列表执行管道批处理(上限 20 条),在单一网络往返中批量极速执行。 内置破坏性指令物理阻断(FLUSHALL/KEYS 等)、Fail-Close 阶梯写门禁与高危删除二次确认保护。 自动对阻塞式读取指令(BLPOP/BRPOP 等)的安全超时进行收敛改写,彻底杜绝服务假死。 针对 HGETALL/SMEMBERS/LRANGE/ZRANGE 等无界全量读取执行 O(1) 探查预检,防止 Redis 单线程锁死。 大集合返回结果自动安全切片截断(上限 100 项),防止客户端内存溢出与上下文爆炸。 提示:在生产环境中读取大型 Hash/Set/ZSet 数据时,推荐优先使用 HSCAN/SSCAN/ZSCAN 等渐进式切片命令, 避免使用 HGETALL/SMEMBERS 等全量 O(N) 命令阻塞 Redis 单线程主循环。 Args: command: 原生 Redis 命令行字符串(如 'GET user:1001',与 commands 二选一) commands: 原生 Redis 命令行列表(用于单往返管道批处理执行,上限 20 条) connection: 目标连接别名(可选,当前系统仅配置单连接 'default',缺省直接使用) db: 逻辑库编号(可选,0~15,集群模式下忽略并绑定 db=0) confirm: 是否确认执行高危删除操作(仅对 DEL/UNLINK 命令生效,未确认时返回待确认详情) Returns: dict[str, Any]: 统一信封结果字典,包含 command, result, data_type, is_truncated 等元数据 |
| redis_list_connectionsA | 查看当前所有可用的 Redis 连接别名、脱敏连接信息与默认连接。 |
| redis_scan_keysA | 使用非阻塞式聚合扫描器检索匹配的键名列表,自动处理底层游标分页。 支持传入上一页返回的 cursor 实现单机断点续翻(从 0 开始扫描)。 可选择传入 include_meta=True 一次性并发拉取各键的类型与 TTL 元数据,避免 N+1 往返。 Args: pattern: 键名匹配模式通配符(默认 '*') limit: 最大返回条数(默认 50,硬上限 200) cursor: 起始扫描游标(默认 0 从头扫描,可传入上一页返回的 cursor 实现单机断点续翻) type: 目标键类型过滤(支持 string/hash/list/set/zset/stream,可选) connection: 目标连接别名(可选,当前系统仅配置单连接 'default',缺省直接使用) db: 目标数据库编号(可选,0~15) include_meta: 是否在单次调用中并发附加 type 与 ttl 元数据(默认 False) |
| redis_inspect_keyB | 单键多维诊断工具:聚合获取类型、TTL、内存占用与编码结构。 Args: key: 待诊断的目标键名 connection: 目标连接别名(可选,当前系统仅配置单连接 'default',缺省直接使用) db: 目标数据库编号(可选,0~15) |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| redis_diagnose_memory | 标准化内存泄漏、碎片率及大 Key 排查诊断 SOP 模版 |
| redis_analyze_slowlog | 标准化慢查询日志抓取与高耗时指令优化分析 SOP 模版 |
| redis_troubleshoot_bigkeys | 标准化 BigKey 识别、基数探查、内存评估与渐进式切片优化 SOP 模版 |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| _resource_default_info | 默认 Redis 连接实例的综合健康与关键运行指标快照(JSON 格式) |
| _resource_default_slowlog | 默认 Redis 连接实例的最近 10 条慢查询日志快照(JSON 格式) |
| _resource_default_clients | 默认 Redis 连接实例的活跃客户端连接列表快照(IP 末段已脱敏,JSON 格式) |
TDQS
Scored across 4 tools
The four tools are largely distinct: redis_execute_command is a broad gateway, while redis_inspect_key and redis_scan_keys are specialized. Overlap exists because execute_command can perform SCAN/TYPE/TTL, but specialized tools offer clearer safety and aggregation semantics.
All tools use the redis_ prefix and snake_case verb_noun naming (execute_command, list_connections, inspect_key, scan_keys). Consistent and predictable.
Four tools is slightly lean but well-scoped; the generic execute_command handles most Redis operations, so extra tools would be redundant. Specialized tools add safety and convenience without bloating the surface.
The set covers command execution (any Redis command, pipelines), key discovery (scan), key diagnostics (inspect), and connection listing. No obvious gaps for a Redis command gateway; lifecycle operations like connection management are minimal but consistent with the single-connection design.