Skip to main content
Glama
lm203688

redis-mcp-server

README.md
# Redis MCP Server

> 让AI安全地查看和操作你的Redis

## ✨ 特性

- 🔒 **安全优先** — 默认只读模式,写操作需显式开启
- 🔍 **智能识别** — 自动识别键类型(string/list/set/hash/zset)
- 🇨🇳 **中文优先** — 文档和提示全部中文化
- 🔌 **即插即用** — 支持Claude Desktop、Cursor等MCP客户端
- 🛡️ **访问控制** — 键前缀过滤 + 黑名单模式
- 📊 **内存分析** — 查看键的内存占用

## 🚀 快速开始

### Claude Desktop配置

```json
{
  "mcpServers": {
    "redis": {
      "command": "python",
      "args": ["-m", "redis_mcp_server"],
      "env": {
        "REDIS_MCP_HOST": "localhost",
        "REDIS_MCP_PORT": "6379",
        "REDIS_MCP_PASSWORD": "",
        "REDIS_MCP_READ_ONLY": "true"
      }
    }
  }
}
```

## 🛠️ 工具列表

| 工具 | 功能 | 安全级别 |
|------|------|---------|
| `ping` | 测试连接 | 🟢 只读 |
| `server_info` | 服务器信息 | 🟢 只读 |
| `db_size` | 键数量 | 🟢 只读 |
| `scan_keys` | 扫描键 | 🟢 只读 |
| `get_key_type` | 键类型+TTL | 🟢 只读 |
| `get_key_value` | 自动读取值 | 🟢 只读 |
| `get_hash` | 哈希详情 | 🟢 只读 |
| `get_memory_usage` | 内存占用 | 🟢 只读 |
| `set_string` | 设置字符串 | 🔴 需关闭只读 |
| `delete_keys` | 删除键 | 🔴 需关闭只读 |
| `set_expire` | 设置过期 | 🔴 需关闭只读 |

## 📄 License

MIT License

TDQS

A3.5/5.0

Scored across 11 tools

Disambiguation5/5

Each tool has a clearly distinct purpose, such as pinging, scanning keys, retrieving specific data types, or managing server info. No overlapping functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern (e.g., get_key_type, set_string, scan_keys), making them predictable.

Tool Count5/5

11 tools cover essential Redis operations like connection checking, key management, memory/type info, and basic CRUD, without being excessive or sparse.

Completeness2/5

Missing write operations for non-string types (hash, list, set, zset) and no update/delete for those types. Only set_string and delete_keys exist, leaving significant gaps for typical Redis interaction.

Maintenance

ActivityInactive
ResponsivenessNo issues