Skip to main content
Glama

Redis MCP

🚀 Redis MCP Server

🔧 一个功能强大的 Redis MCP (Model Context Protocol) 服务器,为 AI 编辑器提供完整的 Redis 数据库操作能力

✨ 特性

  • 🔌 即插即用: 支持所有主流 AI 编辑器 (Cursor, WindSurf, CodeBuddy 等)
  • 🛠️ 全功能覆盖: 支持 Redis 所有数据类型操作
  • 🔒 安全连接: 支持 TLS/SSL 加密连接
  • 📦 批量操作: 支持批量数据导入导出
  • 💾 备份恢复: 内置数据备份和恢复功能
  • 🎯 类型安全: 完整的 TypeScript 类型定义
  • 高性能: 基于官方 Redis 客户端优化

📋 支持的操作

🔤 字符串操作

  • 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~/.cursor/mcp_settings.json
WindSurf~/.windsurf/mcp_settings.json
CodeBuddy~/.codebuddy/mcp_settings.json
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json (macOS)%APPDATA%\Claude\claude_desktop_config.json (Windows)

🎮 使用示例

基础连接

// 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")

🔧 命令行参数

参数描述默认值必需
--hostRedis 服务器地址localhost
--portRedis 服务器端口6379
--passwordRedis 密码-
--usernameRedis 用户名-
--db数据库索引0
--tls启用 TLS 连接false

📚 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!

  1. Fork 本项目
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📄 许可证

本项目基于 MIT 许可证开源。

🔗 相关链接

📞 联系方式

如有问题或建议,欢迎联系:

微信: pickstar_loveXX


⭐ 如果这个项目对你有帮助,请给个 Star 支持一下!

Deploy Server
-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Enables AI assistants to perform comprehensive Redis database operations including managing strings, hashes, lists, sets, sorted sets, TTL management, and data backup/restore. Supports secure connections and provides batch operations for efficient Redis interaction through natural language.

  1. ✨ 特性
    1. 📋 支持的操作
      1. 🔤 字符串操作
      2. 🗂️ 哈希操作
      3. 📝 列表操作
      4. 🎯 集合操作
      5. 📊 有序集合操作
      6. 🔑 键管理
      7. 💾 数据库管理
    2. 🚀 快速开始
      1. 安装要求
      2. 在 AI 编辑器中使用
      3. 📍 配置文件位置
    3. 🎮 使用示例
      1. 基础连接
      2. 哈希操作
      3. 列表操作
    4. 🔧 命令行参数
      1. 📚 API 文档
        1. 连接管理
        2. 字符串操作
        3. 更多 API
      2. 🛠️ 开发
        1. 本地开发
        2. 项目结构
      3. 🤝 贡献
        1. 📄 许可证
          1. 🔗 相关链接
            1. 📞 联系方式

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                Allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.
                Last updated -
                841
                MIT License
                • Linux
                • Apple
              • -
                security
                A
                license
                -
                quality
                Provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
                Last updated -
                45
                29
                MIT License
                • Apple
                • Linux
              • A
                security
                F
                license
                A
                quality
                Enables AI models to perform MySQL database operations through a standardized interface, supporting secure connections, query execution, and comprehensive schema management.
                Last updated -
                7
                20
                27
              • -
                security
                A
                license
                -
                quality
                A server that provides Claude with Redis database access and operations through a set of tools for basic operations, lists, hashes, sets, and pub/sub functionality.
                Last updated -
                24
                MIT License

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/pickstar-2002/redis-mcp'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server