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
Provider
Redis
Release date
Mar 29, 2025
Language
Python
Stats
23 stars

The Redis MCP Server provides a natural language interface for AI agents to interact with Redis databases. It allows applications to manage and search data in Redis using conversational language, supporting operations like storing conversations, caching items, and performing vector searches.

Installation

To install the Redis MCP Server:

# Clone the repository
git clone https://github.com/redis/mcp-redis.git
cd mcp-redis

# Install dependencies using uv
uv venv
source .venv/bin/activate
uv sync

Configuration

The server can be configured using the following environment variables:

Name Description Default Value
REDIS_HOST Redis IP or hostname "127.0.0.1"
REDIS_PORT Redis port 6379
REDIS_USERNAME Default database username "default"
REDIS_PWD Default database password ""
REDIS_SSL Enables or disables SSL/TLS False
REDIS_CA_PATH CA certificate for verifying server None
REDIS_SSL_KEYFILE Client's private key file for client authentication None
REDIS_SSL_CERTFILE Client's certificate file for client authentication None
REDIS_CERT_REQS Whether the client should verify the server's certificate "required"
REDIS_CA_CERTS Path to the trusted CA certificates file None
REDIS_CLUSTER_MODE Enable Redis Cluster mode False

Available Tools

The MCP Server provides several tools for interacting with Redis:

  • String tools: Set and get strings with expiration for configurations, sessions, or caching
  • Hash tools: Store field-value pairs including vector embeddings for objects with multiple attributes
  • List tools: Perform operations like append and pop for queues or message brokers
  • Set tools: Track unique values and perform set operations
  • Sorted set tools: Manage leaderboards, priority queues, or time-based analytics
  • Pub/sub tools: Publish and subscribe to messages for real-time notifications
  • Stream tools: Add, read, and delete from data streams for event processing
  • JSON tools: Store and manipulate JSON documents for complex data structures
  • Query engine tools: Manage vector indexes and perform vector searches
  • Server management tool: Retrieve database information

Integration with OpenAI Agents SDK

To integrate with the OpenAI Agents SDK:

pip install openai-agents

Configure your OpenAI token:

export OPENAI_API_KEY="<openai_token>"

Run the example application:

python3.13 redis_assistant.py

You can monitor agent workflows using the OpenAI dashboard.

Integration with Claude Desktop

Via Smithery

To use the Redis MCP Server deployed by Smithery:

npx -y @smithery/cli install @redis/mcp-redis --client claude

Follow the prompts to configure the server and connect to Redis.

Manual Configuration

To manually configure Claude Desktop:

  1. Note your Redis credentials and TLS configuration
  2. Find your uv command path (e.g., using which uv)
  3. Edit the claude_desktop_config.json file (on macOS, located at ~/Library/Application\ Support/Claude/)
{
    "mcpServers": {
        "redis": {
            "command": "<full_path_uv_command>",
            "args": [
                "--directory",
                "<your_mcp_server_directory>",
                "run",
                "src/main.py"
            ],
            "env": {
                "REDIS_HOST": "<your_redis_database_hostname>",
                "REDIS_PORT": "<your_redis_database_port>",
                "REDIS_PWD": "<your_redis_database_password>",
                "REDIS_SSL": true,
                "REDIS_CA_PATH": "<your_redis_ca_path>",
                "REDIS_CLUSTER_MODE": false
            }
        }
    }
}

Using with Docker

You can use the Docker image for deployment:

  1. Build your own image or use the official Redis MCP Docker image:
docker build -t mcp-redis .
  1. Configure Claude Desktop by editing claude_desktop_config.json:
{
  "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"]
    }
  }
}

To use the official image, replace mcp-redis with mcp/redis.

Troubleshooting

Check the logs for any issues:

tail -f ~/Library/Logs/Claude/mcp-server-redis.log

Testing

Use the MCP Inspector for visual debugging:

npx @modelcontextprotocol/inspector uv run src/main.py

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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