
Redis MCP Server (@gongrzhe/[email protected])

2025.03.12
23
JavaScriptRedis 交互键值存储管理数据库
Redis MCP Server 是一个基于 Redis 的模型上下文协议(MCP)服务器实现,用于与 Redis 数据库进行交互。该服务器使 LLMs(大型语言模型)能够通过一组标准化工具与 Redis 键值存储进行交互。
View on GitHub
Overview
基本能力
产品定位
Redis MCP Server 是一个专门为 Redis 数据库设计的 MCP 服务器,旨在通过标准化工具集实现 LLMs 与 Redis 的高效交互。
核心功能
- 键值操作:支持设置、获取、删除 Redis 键值对
- 模式匹配:支持基于模式的键列表查询
- 过期设置:支持为键值对设置过期时间
适用场景
- 需要 LLMs 与 Redis 数据库交互的应用
- 需要标准化接口访问 Redis 的项目
- 需要自动化 Redis 操作的场景
工具列表
- set:设置 Redis 键值对,可选设置过期时间
- 输入参数:
key
(键名)、value
(值)、expireSeconds
(可选过期时间) - get:获取指定键的值
- 输入参数:
key
(键名) - delete:删除一个或多个键
- 输入参数:
key
(键名或键名数组) - list:列出匹配模式的键
- 输入参数:
pattern
(可选匹配模式,默认为*)
常见问题解答
- 如何指定 Redis 连接地址?通过命令行参数指定 Redis URL
- 如何与 Claude Desktop 集成?通过修改
claude_desktop_config.json
配置文件 - Docker 环境下如何使用?使用
host.docker.internal
访问宿主机 Redis
使用教程
使用依赖
- Node.js 环境
- Redis 数据库
安装教程
通过 Smithery 安装
npx -y @smithery/cli install @gongrzhe/server-redis-mcp --client claude
手动安装
# 使用 npx 运行(推荐)
npx @gongrzhe/[email protected] redis://your-redis-host:port
# 全局安装
npm install -g @gongrzhe/[email protected]
@gongrzhe/server-redis-mcp redis://your-redis-host:port
Docker 使用
docker build -t mcp/redis .
docker run -i --rm mcp/redis redis://host.docker.internal:6379
调试方式
- 检查 Redis 连接是否正常
- 使用基本命令测试功能 ```bash # 设置键值 npx @gongrzhe/[email protected] redis://localhost:6379 set test_key test_value
# 获取键值 npx @gongrzhe/[email protected] redis://localhost:6379 get test_key
# 删除键 npx @gongrzhe/[email protected] redis://localhost:6379 delete test_key ``` 3. 检查日志输出是否有错误信息