Redis MCP server

Provides a natural language interface to Redis databases, enabling operations on various data structures with tools for vector similarity search, pub/sub messaging, and server management.
Back to servers
Setup instructions
Provider
Redis
Release date
Mar 29, 2025
Language
Python
Stats
338 stars

The Redis MCP Server provides a natural language interface that allows AI agents to interact with Redis databases. It supports various data types and operations through the Model Context Protocol (MCP).

Installation Options

Using PyPI (Recommended)

Configure your MCP client with this JSON configuration:

{
  "mcpServers": {
    "RedisMCPServer": {
      "command": "uvx",
      "args": [
        "--from",
        "redis-mcp-server@latest",
        "redis-mcp-server",
        "--url",
        "\"redis://localhost:6379/0\""
      ]
    }
  }
}

Manual Installation

Install directly with pip:

pip install redis-mcp-server

Then run with:

uv python install 3.14
uv sync
uv run redis-mcp-server --url redis://localhost:6379/0

From GitHub

Run a specific version directly from GitHub:

uvx --from git+https://github.com/redis/[email protected] redis-mcp-server --url redis://localhost:6379/0

Using Docker

Use the official Docker image:

{
  "mcpServers": {
    "redis": {
      "command": "docker",
      "args": ["run",
                "--rm",
                "--name",
                "redis-mcp-server",
                "-i",
                "-e", "REDIS_HOST=<redis_hostname>",
                "-e", "REDIS_PORT=<redis_port>",
                "-e", "REDIS_USERNAME=<redis_username>",
                "-e", "REDIS_PWD=<redis_password>",
                "mcp/redis"]
    }
  }
}

URL Format

The connection URL follows standard Redis URI format:

redis://user:secret@localhost:6379/0?foo=bar&qux=baz

For secure connections, use the rediss:// scheme:

rediss://user:secret@hostname:port?ssl_cert_reqs=required&ssl_ca_certs=path_to_the_certificate

Configuration

Command Line Options

# Basic Redis connection
uvx --from redis-mcp-server@latest redis-mcp-server \
  --host localhost \
  --port 6379 \
  --password mypassword

# Using Redis URI (simpler)
uvx --from redis-mcp-server@latest redis-mcp-server \
  --url redis://user:pass@localhost:6379/0

Environment Variables

Name Description Default Value
REDIS_HOST Redis IP or hostname "127.0.0.1"
REDIS_PORT Redis port 6379
REDIS_DB Database 0
REDIS_USERNAME Default database username "default"
REDIS_PWD Default database password ""
REDIS_SSL Enables or disables SSL/TLS False
REDIS_SSL_CA_PATH CA certificate path None
REDIS_CLUSTER_MODE Enable Redis Cluster mode False

EntraID Authentication for Azure

For Azure Managed Redis with EntraID:

# Service Principal Authentication
export REDIS_ENTRAID_AUTH_FLOW=service_principal
export REDIS_ENTRAID_CLIENT_ID=your-client-id
export REDIS_ENTRAID_CLIENT_SECRET=your-client-secret
export REDIS_ENTRAID_TENANT_ID=your-tenant-id

# Managed Identity Authentication
export REDIS_ENTRAID_AUTH_FLOW=managed_identity
export REDIS_ENTRAID_IDENTITY_TYPE=system_assigned

# Default Azure Credential
export REDIS_ENTRAID_AUTH_FLOW=default_credential
export REDIS_ENTRAID_SCOPES=https://redis.azure.com/.default

Logging

Control logging level with the MCP_REDIS_LOG_LEVEL environment variable:

# Show information messages
MCP_REDIS_LOG_LEVEL=INFO uv run src/main.py

# Detailed debug information
MCP_REDIS_LOG_LEVEL=DEBUG uvx --from redis-mcp-server@latest redis-mcp-server --url redis://localhost:6379/0

Client Integrations

OpenAI Agents SDK

pip install openai-agents
export OPENAI_API_KEY="<openai_token>"
python3.14 redis_assistant.py

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "redis-mcp-server": {
        "type": "stdio",
        "command": "/path/to/uvx",
        "args": [
            "--from", "redis-mcp-server@latest",
            "redis-mcp-server",
            "--url", "redis://localhost:6379/0"
        ]
    }
  }
}

VS Code with GitHub Copilot

Enable agent mode in your VS Code settings:

{
  "chat.agent.enabled": true
}

Add to your mcp.json:

"servers": {
  "redis": {
    "type": "stdio",
    "command": "uvx",
    "args": [
      "-qq",
      "--from", "redis-mcp-server@latest",
      "redis-mcp-server",
      "--url", "redis://localhost:6379/0"
    ]
  }
}

Supported Redis Features

The MCP Server provides tools for:

  • String operations (get/set with expiration)
  • Hash operations (field-value pairs, including vector storage)
  • List operations (append/pop items)
  • Set operations (add/remove/list members)
  • Sorted set operations (score-based ordering)
  • Pub/sub functionality
  • Stream operations (append/read/delete)
  • JSON document handling
  • Vector search and indexing
  • Server management

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "redis" '{"command":"uv","args":["--directory","<your_mcp_server_directory>","run","src/main.py"],"env":{"REDIS_HOST":"<your_redis_database_hostname>","REDIS_PORT":"<your_redis_database_port>","REDIS_USERNAME":"<your_redis_database_username>","REDIS_PWD":"<your_redis_database_password>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "redis": {
            "command": "uv",
            "args": [
                "--directory",
                "<your_mcp_server_directory>",
                "run",
                "src/main.py"
            ],
            "env": {
                "REDIS_HOST": "<your_redis_database_hostname>",
                "REDIS_PORT": "<your_redis_database_port>",
                "REDIS_USERNAME": "<your_redis_database_username>",
                "REDIS_PWD": "<your_redis_database_password>"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "redis": {
            "command": "uv",
            "args": [
                "--directory",
                "<your_mcp_server_directory>",
                "run",
                "src/main.py"
            ],
            "env": {
                "REDIS_HOST": "<your_redis_database_hostname>",
                "REDIS_PORT": "<your_redis_database_port>",
                "REDIS_USERNAME": "<your_redis_database_username>",
                "REDIS_PWD": "<your_redis_database_password>"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later