MCP Redis Server

MCP Redis Server

MCP server for Redis interaction with dynamic connection setup and management.

Category
Visit Server

README

MCP Redis Server

Servidor MCP (Model Context Protocol) para interação com Redis, com sistema de conexão dinâmica e interativa.

Características

  • Conexão Dinâmica: Não requer configuração prévia de conexão
  • Tools Interativas: Solicita dados de conexão quando necessário
  • Gerenciamento de Estado: Verifica conexão antes de executar operações
  • Suporte Completo ao Redis: Todas as operações principais do Redis

Como Usar

1. Iniciar o Servidor

./start-mcp.sh

2. Configurar Conexão

IMPORTANTE: Antes de usar qualquer tool do Redis, você DEVE configurar uma conexão usando:

# 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 Status da Conexão

# Verificar se está conectado
await redis_check_connection()

# Obter status detalhado
await redis_get_connection_status()

4. Usar as Tools do Redis

Após configurar a conexão, você pode usar todas as tools disponíveis:

  • Informações do Servidor: redis_get_server_info()
  • Estatísticas de Memória: redis_get_memory_stats()
  • Informações do Keyspace: redis_get_keyspace_info()
  • Estatísticas Gerais: redis_get_stats()
  • Informações dos Clientes: redis_get_clients_info()
  • Configurações: redis_get_config()
  • Gerenciamento de Chaves: redis_list_keys(), redis_get_key_type(), etc.
  • Gerenciamento de Databases: redis_select_database(), redis_create_key(), etc.

Fluxo de Uso Recomendado

  1. Iniciar o servidor MCP
  2. Configurar conexão com redis_configure_connection()
  3. Verificar status com redis_check_connection()
  4. Usar as tools conforme necessário
  5. Verificar conexão periodicamente se necessário

Tratamento de Erros

Todas as tools verificam automaticamente se há uma conexão ativa antes de executar. Se não houver conexão, você receberá um erro claro indicando que deve usar redis_configure_connection() primeiro.

Exemplo de Uso Completo

# 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()

Desenvolvimento

Estrutura do Projeto

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

Testes

# Executar testes unitários
pytest tests/unit/

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

Requisitos

  • Python 3.8+
  • Redis server
  • Dependências listadas em requirements.txt

Instalação

# 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

Configuração nos Editores

Claude Code

  1. Adicionar o servidor MCP:
# Na pasta do projeto, adicionar o script de inicialização
claude mcp add /caminho/completo/para/o/projeto/redis/start-mcp.sh
  1. Verificar se foi adicionado:
claude mcp list
  1. Usar o servidor:
    • O Claude Code detectará automaticamente o servidor MCP
    • As tools do Redis ficarão disponíveis no chat
    • Use as tools diretamente como redis_configure_connection()

Cursor IDE

  1. Configurar MCP no Cursor:
    • Abra as configurações do Cursor (Cmd/Ctrl + ,)
    • Procure por "MCP" nas configurações
    • Adicione a configuração do servidor:
{
  "mcpServers": {
    "redis-mcp": {
      "command": "/caminho/completo/para/o/projeto/redis/start-mcp.sh"
    }
  }
}
  1. Usar o servidor:
    • O Cursor detectará automaticamente o servidor MCP
    • Use @redis-mcp no chat para interagir com as tools
    • As tools aparecerão na lista de ferramentas disponíveis

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured