Redis MCP
Provides comprehensive Redis database operations including string, hash, list, set, and sorted set operations, along with key management, TTL control, pattern-based searching, and backup/restore functionality for caching, leaderboards, and message queues.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Redis MCP get the value for key 'user:session:abc123'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🚀 Redis MCP Server
🔧 一个功能强大的 Redis MCP (Model Context Protocol) 服务器,为 AI 编辑器提供完整的 Redis 数据库操作能力
✨ 特性
🔌 即插即用: 支持所有主流 AI 编辑器 (Cursor, WindSurf, CodeBuddy 等)
🛠️ 全功能覆盖: 支持 Redis 所有数据类型操作
🔒 安全连接: 支持 TLS/SSL 加密连接
📦 批量操作: 支持批量数据导入导出
💾 备份恢复: 内置数据备份和恢复功能
🎯 类型安全: 完整的 TypeScript 类型定义
⚡ 高性能: 基于官方 Redis 客户端优化
Related MCP server: Redis CRUD MCP Server
📋 支持的操作
🔤 字符串操作
string_set/string_get- 设置/获取字符串值string_incr/string_decr- 数值递增/递减string_mset/string_mget- 批量设置/获取
🗂️ 哈希操作
hash_set/hash_get- 设置/获取哈希字段hash_mset/hash_getall- 批量操作和获取所有字段hash_del- 删除哈希字段
📝 列表操作
list_lpush/list_rpush- 左/右侧推入list_lpop/list_rpop- 左/右侧弹出list_range- 获取列表范围
🎯 集合操作
set_add/set_remove- 添加/移除成员set_members- 获取所有成员
📊 有序集合操作
zset_add/zset_remove- 添加/移除成员zset_range- 获取范围数据
🔑 键管理
key_delete/key_expire/key_ttl- 键操作key_search/key_type/key_info- 键查询key_delete_pattern- 批量删除
💾 数据库管理
db_flush- 清空数据库backup_create/backup_restore- 备份恢复
🚀 快速开始
安装要求
Node.js >= 18.0.0
Redis 服务器 (本地或远程)
在 AI 编辑器中使用
🎯 推荐用法 (使用 @latest)
{
"mcpServers": {
"redis-mcp": {
"command": "npx",
"args": [
"@pickstar-2002/redis-mcp@latest",
"--host", "localhost",
"--port", "6379"
]
}
}
}🔧 完整配置示例
{
"mcpServers": {
"redis-mcp": {
"command": "npx",
"args": [
"@pickstar-2002/redis-mcp@latest",
"--host", "localhost",
"--port", "6379",
"--password", "your_password",
"--db", "0",
"--username", "your_username"
]
}
}
}🔒 TLS 连接配置
{
"mcpServers": {
"redis-mcp": {
"command": "npx",
"args": [
"@pickstar-2002/redis-mcp@latest",
"--host", "your-redis-host.com",
"--port", "6380",
"--password", "your_password",
"--tls", "true"
]
}
}
}📍 配置文件位置
不同 AI 编辑器的配置文件位置:
编辑器 | 配置文件路径 |
Cursor |
|
WindSurf |
|
CodeBuddy |
|
Claude Desktop |
|
🎮 使用示例
基础连接
// AI 编辑器中直接使用
// 连接到 Redis
await connectRedis("localhost", 6379, "password")
// 设置字符串
await stringSet("user:1001", "张三", 3600)
// 获取字符串
const value = await stringGet("user:1001")哈希操作
// 设置用户信息
await hashMset("user:profile:1001", [
{ field: "name", value: "张三" },
{ field: "age", value: "25" },
{ field: "city", value: "北京" }
])
// 获取所有字段
const profile = await hashGetall("user:profile:1001")列表操作
// 创建任务队列
await listLpush("tasks", ["任务1", "任务2", "任务3"])
// 处理任务
const task = await listRpop("tasks")🔧 命令行参数
参数 | 描述 | 默认值 | 必需 |
| Redis 服务器地址 |
| ❌ |
| Redis 服务器端口 |
| ❌ |
| Redis 密码 | - | ❌ |
| Redis 用户名 | - | ❌ |
| 数据库索引 |
| ❌ |
| 启用 TLS 连接 |
| ❌ |
📚 API 文档
连接管理
connect_redis
连接到 Redis 服务器
{
"host": "localhost",
"port": 6379,
"password": "optional_password",
"username": "optional_username",
"db": 0,
"tls": false
}disconnect_redis
断开 Redis 连接
字符串操作
string_set
设置字符串键值
{
"key": "mykey",
"value": "myvalue",
"expireSeconds": 3600
}string_get
获取字符串值
{
"key": "mykey"
}更多 API
详细的 API 文档请参考源码中的类型定义文件 src/types/index.ts。
🛠️ 开发
本地开发
# 克隆项目
git clone https://github.com/pickstar-2002/redis-mcp.git
cd redis-mcp
# 安装依赖
npm install
# 构建项目
npm run build
# 本地测试
npm start -- --host localhost --port 6379项目结构
redis-mcp/
├── src/
│ ├── index.ts # 入口文件
│ ├── services/
│ │ ├── redisService.ts # Redis 操作服务
│ │ ├── mcpService.ts # MCP 协议服务
│ │ └── backupService.ts # 备份恢复服务
│ └── types/
│ └── index.ts # 类型定义
├── package.json
├── tsconfig.json
└── README.md🤝 贡献
欢迎提交 Issue 和 Pull Request!
Fork 本项目
创建特性分支 (
git checkout -b feature/AmazingFeature)提交更改 (
git commit -m 'Add some AmazingFeature')推送到分支 (
git push origin feature/AmazingFeature)开启 Pull Request
📄 许可证
本项目基于 MIT 许可证开源。
🔗 相关链接
📞 联系方式
如有问题或建议,欢迎联系:
微信: pickstar_loveXX
⭐ 如果这个项目对你有帮助,请给个 Star 支持一下!
Available Tools
34 toolsbackup_createC
创建 Redis 数据备份
Inputs: filename, path, includePatterns, excludePatterns.
backup_restoreC
从备份恢复 Redis 数据
Inputs: filename (required), path, flushBeforeRestore.
connect_redisC
连接到 Redis 服务器
Inputs: host (required), port (required), username, password, +2 more.
db_flushB
清空当前数据库
Inputs: no named parameters.
disconnect_redisB
断开与 Redis 服务器的连接
Inputs: no named parameters.
hash_delC
删除哈希字段
Inputs: key (required), fields (required).
hash_getC
获取哈希字段
Inputs: key (required), field (required).
hash_getallC
获取所有哈希字段
Inputs: key (required).
hash_msetC
批量设置哈希字段
Inputs: key (required), fieldValues (required).
hash_setC
设置哈希字段
Inputs: key (required), field (required), value (required).
key_deleteC
删除键
Inputs: keys (required).
key_delete_patternC
批量删除匹配的键
Inputs: pattern (required).
key_expireC
设置键过期时间
Inputs: key (required), seconds (required).
key_infoC
获取键信息
Inputs: key (required).
key_searchC
查找匹配的键
Inputs: pattern (required).
key_ttlC
获取键过期时间
Inputs: key (required).
key_typeC
获取键类型
Inputs: key (required).
list_lpopC
左侧弹出列表
Inputs: key (required), count.
list_lpushC
左侧推入列表
Inputs: key (required), values (required).
list_rangeD
获取列表范围
Inputs: key (required), start (required), stop (required).
list_rpopC
右侧弹出列表
Inputs: key (required), count.
list_rpushC
右侧推入列表
Inputs: key (required), values (required).
set_addC
添加集合成员
Inputs: key (required), members (required).
set_membersC
获取集合所有成员
Inputs: key (required).
set_removeC
移除集合成员
Inputs: key (required), members (required).
string_decrC
递减数值
Inputs: key (required), decrement.
string_getC
获取字符串值
Inputs: key (required).
string_incrC
递增数值
Inputs: key (required), increment.
string_mgetC
批量获取键值
Inputs: keys (required).
string_msetC
批量设置键值
Inputs: keyValues (required).
string_setC
设置字符串键值
Inputs: key (required), value (required), expireSeconds.
zset_addC
添加有序集合成员
Inputs: key (required), members (required).
zset_rangeC
获取有序集合范围
Inputs: key (required), start (required), stop (required), withScores.
zset_removeC
移除有序集合成员
Inputs: key (required), members (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 34 tools
Each tool has a clearly distinct purpose with no ambiguity, as they are organized by Redis data types (hash, list, set, string, zset) and operations (get, set, delete, etc.), plus connection and backup utilities. The naming explicitly indicates the target resource and action, making misselection unlikely.
The tool names follow a highly consistent verb_noun pattern throughout, such as hash_get, list_lpush, string_set, and backup_create. All tools use snake_case with no deviations, making the naming predictable and easy to understand.
With 34 tools, the count is borderline high for a Redis server, as it includes comprehensive coverage of data types and operations but may feel heavy compared to typical MCP servers (usually 3-15 tools). However, it is reasonable given Redis's feature-rich nature.
The tool set provides complete CRUD/lifecycle coverage for Redis operations, including connection management, data manipulation for all major types (hash, list, set, string, zset), key operations, and backup/restore. There are no obvious gaps, ensuring agents can handle full workflows without dead ends.
Maintenance
Related MCP Connectors
Manage, check, investigate and automate server, database and storage backups from your AI assistant.
Persistent agent memory via ACMI — Profile/Signals/Timeline. 16 tools on Upstash Redis.
Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.
Database backups and an AI agent safety net: restore points, health, audited changes as you.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceProvides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.179 npm30MIT
- AlicenseBqualityDmaintenanceProvides comprehensive Redis database operations supporting all major data types (strings, lists, sets, hashes, sorted sets) with full CRUD functionality through natural language commands.96 npmMIT
- AlicenseAqualityDmaintenanceEnables AI to safely view and operate Redis databases with read-only mode by default and support for key operations.11MIT
- AlicenseAqualityDmaintenanceEnables AI agents to manage and search data in Redis using natural language. Supports hashes, lists, sets, sorted sets, streams, JSON, and vector search.44MIT