这是一个 Redis 模型上下文协议 (MCP) 服务器实现,可与 Redis 数据库进行交互。借助一组标准化工具,该服务器能让大型语言模型 (LLMs) 与 Redis 键值存储实现交互。
本服务器可通过不同方式进行安装和使用,以下为您详细介绍。
若要通过 Smithery 自动为 Claude Desktop 安装 Redis MCP 服务器,可使用以下命令:
npx -y @smithery/cli install @gongrzhe/server-redis-mcp --client claude
npx @gongrzhe/server-redis-mcp@1.0.0 redis://your-redis-host:port
# 示例:
npx @gongrzhe/server-redis-mcp@1.0.0 redis://localhost:6379
# 全局安装指定版本
npm install -g @gongrzhe/server-redis-mcp@1.0.0
# 安装后运行
@gongrzhe/server-redis-mcp redis://your-redis-host:port
key
(字符串):Redis 键。value
(字符串):要存储的值。expireSeconds
(数字, 可选):过期时间(以秒为单位)。key
(字符串):要检索的 Redis 键。key
(字符串 | 字符串数组):键或键数组。pattern
(字符串, 可选):要匹配的键模式(默认: *)。若要在 Claude Desktop 应用中使用此服务器,需在 claude_desktop_config.json
文件的 "mcpServers" 部分添加以下配置:
{
"mcpServers": {
"redis": {
"command": "npx",
"args": [
"@gongrzhe/server-redis-mcp@1.0.0",
"redis://localhost:6379"
]
}
}
}
或者,如果您已安装该包,则可以直接使用 node 命令:
{
"mcpServers": {
"redis": {
"command": "node",
"args": [
"path/to/build/index.js",
"redis://10.1.210.223:6379"
]
}
}
}
使用 Docker 时:
host.docker.internal
。{
"mcpServers": {
"redis": {
"command": "docker",
"args": [
"run",
"--rm",
"-it",
"redis:alpine",
"redis-cli",
"redis://host.docker.internal:6379"
]
}
}
}
要构建项目,请运行以下命令:
npm run build
然后使用以下命令启动服务器:
node dist/index.js redis://localhost:6379
请查看项目的许可证文件以获取详细信息。