redis-mcp

redis-mcp

A safe, connection-efficient Redis MCP server that provides tools for reading and managing Redis data, with safeguards like confirmation requirements for destructive operations.

Category
访问服务器

README

redis-mcp

A safe, connection-efficient Redis MCP server.

Design goals

  • No accidental data loss. Destructive tools (redis_delete, redis_expire, redis_flushdb) refuse to run unless called with confirm=true — the tool description instructs the AI to ask the user first. redis_flushdb additionally requires the literal phrase confirm_phrase="FLUSH ALL DATA". redis_set refuses to overwrite an existing key unless overwrite=true.
  • Gentle on the Redis server.
    • One lazy, reused connection per MCP process (lazyConnect) — no connection churn, no pool needed since stdio MCP calls are sequential.
    • SCAN with cursor + result limits instead of KEYS (never blocks the server).
    • UNLINK instead of DEL and FLUSHDB ASYNC — deletes happen in a background thread on the Redis side.
    • Collection reads are truncated to 200 elements.

Tools

Tool Description Destructive?
redis_get Get a string key no
redis_scan List keys by pattern (SCAN, limited) no
redis_inspect Type + TTL + value for any key type no
redis_info Server INFO (memory, stats, keyspace, …) no
redis_set Set a string key (won't overwrite without overwrite=true) no
redis_delete Delete keys via UNLINK requires confirm=true
redis_expire Set a key's TTL requires confirm=true
redis_flushdb Wipe the current DB requires confirm=true + phrase

Requirements

  • Node.js ≥ 18
  • A reachable Redis server

Install

git clone <this-repo> redis-mcp
cd redis-mcp
npm install

Configuration is a single env var:

  • REDIS_URL — default redis://127.0.0.1:6379. Examples: redis://user:pass@host:6379/2, rediss://host:6380 (TLS).

Run manually to verify: REDIS_URL=redis://127.0.0.1:6379 node src/index.js (it prints [redis-mcp] ready on stderr).

In all snippets below, replace /absolute/path/to/redis-mcp with where you cloned it.

Claude Code

claude mcp add redis --env REDIS_URL=redis://127.0.0.1:6379 -- node /absolute/path/to/redis-mcp/src/index.js

Or add to .mcp.json in your project (or ~/.claude.json for global):

{
  "mcpServers": {
    "redis": {
      "command": "node",
      "args": ["/absolute/path/to/redis-mcp/src/index.js"],
      "env": { "REDIS_URL": "redis://127.0.0.1:6379" }
    }
  }
}

Claude Desktop

Add the same mcpServers block to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json).

Codex (OpenAI Codex CLI)

Add to ~/.codex/config.toml:

[mcp_servers.redis]
command = "node"
args = ["/absolute/path/to/redis-mcp/src/index.js"]
env = { REDIS_URL = "redis://127.0.0.1:6379" }

OpenCode

Add to opencode.json (project) or ~/.config/opencode/opencode.json (global):

{
  "mcp": {
    "redis": {
      "type": "local",
      "command": ["node", "/absolute/path/to/redis-mcp/src/index.js"],
      "environment": { "REDIS_URL": "redis://127.0.0.1:6379" },
      "enabled": true
    }
  }
}

Kilo Code

Settings → MCP Servers → Edit MCP Settings (mcp_settings.json), or .kilocode/mcp.json in your project:

{
  "mcpServers": {
    "redis": {
      "command": "node",
      "args": ["/absolute/path/to/redis-mcp/src/index.js"],
      "env": { "REDIS_URL": "redis://127.0.0.1:6379" }
    }
  }
}

Antigravity (Google)

Agent panel → MCP servers (⚙) → Manage MCP Servers → View raw config (mcp_config.json):

{
  "mcpServers": {
    "redis": {
      "command": "node",
      "args": ["/absolute/path/to/redis-mcp/src/index.js"],
      "env": { "REDIS_URL": "redis://127.0.0.1:6379" }
    }
  }
}

Safety model

  1. The AI calls a destructive tool without confirm → the server refuses and returns a message telling the AI to ask the user first, listing exactly what would be deleted.
  2. The user explicitly approves.
  3. The AI retries with confirm=true (and the confirm phrase for flush).

The gate lives in the server, so it holds even if the client/AI forgets to ask.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选