Token导航 LogoToken导航TokenDH.com
MCP Redis Server logo
数据服务stdio官方级别未说明来源级核验

MCP Redis Server

MCP Server

MCP Redis服务器是一个动态连接和交互式工具集,用于管理和操作Redis数据库,支持所有主要Redis操作。

工具数

11

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude数据分析Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

efeabio

提供方

efeabio

最后核验

2026/5/17 20:23

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m venv venv

详细介绍

MCP Redis服务器

用于与 Redis 交互的 MCP(模型上下文协议)服务器,具有动态和交互式连接系统。

特征

  • 动态连接无需预先配置连接
  • 工具交互需要时请求连接数据
  • 国家统计局: 执行操作前检查连接
  • 全面支持 Redis所有主要 Redis 操作

Como Usar

1. 启动服务器

./start-mcp.sh

2. 设置连接

重要的在使用任何 Redis 工具之前,您必须使用:

# Tool: redis_configure_connection
# Parâmetros:
# - host: Host do Redis (ex: localhost, 127.0.0.1)
# - port: Porta do Redis (padrão: 6379)
# - password: Senha do Redis (deixe vazio se não houver)
# - database: Database inicial (0-15, padrão: 0)

# Exemplo:
await redis_configure_connection(
    host="localhost",
    port=6379,
    password="",
    database=0
)

3. 检查连接状态

# Verificar se está conectado
await redis_check_connection()

# Obter status detalhado
await redis_get_connection_status()

4. 使用 Redis 工具

设置连接后,您可以使用所有可用的工具:

  • 服务器信息: redis_get_server_info()
  • 记忆体统计: redis_get_memory_stats()
  • Keyspace 信息: redis_get_keyspace_info()
  • 一般统计: redis_get_stats()
  • 客户信息: redis_get_clients_info()
  • 设置: redis_get_config()
  • 密钥管理: redis_list_keys(), redis_get_key_type()等等。
  • 数据库管理: redis_select_database(), redis_create_key()等等。

推荐使用流程

  1. 启动 MCP 服务器
  2. 配置连接 com redis_configure_connection()
  3. 检查状态 com redis_check_connection()
  4. 用作工具 根据需要
  5. 检查连接 必要时定期

错误处理

所有工具在运行前都会自动检查是否存在活动连接。如果没有连接,您将收到一个明确的错误,表明您应该使用 redis_configure_connection() 首先。

完整使用范例

# 1. Configurar conexão
connection_result = await redis_configure_connection(
    host="localhost",
    port=6379,
    password="",
    database=0
)

# 2. Verificar status
status = await redis_check_connection()

# 3. Usar tools
if status["connected"]:
    # Obter informações do servidor
    server_info = await redis_get_server_info()
    
    # Listar chaves
    keys = await redis_list_keys(pattern="*", limit=10)
    
    # Obter estatísticas
    stats = await redis_get_stats()

开发

项目结构

src/
├── tools/
│   ├── connection.py      # Tools de conexão
│   ├── server_info.py     # Informações do servidor
│   ├── memory.py          # Estatísticas de memória
│   ├── keyspace.py        # Informações do keyspace
│   ├── stats.py           # Estatísticas gerais
│   ├── clients.py         # Informações dos clientes
│   ├── config.py          # Configurações
│   ├── keys.py            # Gerenciamento de chaves
│   └── database.py        # Gerenciamento de databases
├── utils/
│   ├── redis_connector.py # Conector Redis principal
│   └── logger.py          # Sistema de logging
└── core/
    └── exceptions.py      # Exceções personalizadas

测试

# Executar testes unitários
pytest tests/unit/

# Com cobertura
pytest --cov=src tests/unit/

要求

  • Python 3.8+
  • Redis服务器
  • 依赖列在 requirements.txt

安装

# Criar ambiente virtual
python -m venv venv
source venv/bin/activate  # Linux/Mac
# ou
venv\Scripts\activate     # Windows

# Instalar dependências
pip install -r requirements.txt

# Para desenvolvimento
pip install -r requirements-dev.txt

编辑器设置

克劳德代码

  1. 添加 MCP 服务器 :
# Na pasta do projeto, adicionar o script de inicialização
claude mcp add /caminho/completo/para/o/projeto/redis/start-mcp.sh
  1. 检查是否已添加 :
claude mcp list
  1. 使用服务器 :

- O克劳德代码检测器自动为MCP服务 - Redis工具将在聊天中可用 - 直接使用工具,如 redis_configure_connection()

光标IDE

  1. 配置器MCP无光标:

- 打开光标设置( Cmd/Ctrl + ,) - 在设置中搜索“MCP” - 添加服务器配置 :

{
  "mcpServers": {
    "redis-mcp": {
      "command": "/caminho/completo/para/o/projeto/redis/start-mcp.sh"
    }
  }
}
  1. 使用服务器 :

- 光标将自动检测到 MCP 服务器 - 使用 @redis-mcp 在聊天中与工具进行交互 - 工具将出现在可用工具列表中

目录标签

目录标签

PythonClaude数据分析Redis管理本地部署动态连接数据库工具服务器信息键空间管理

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

11

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP