Skip to main content
Glama
Redis MCP Server

Redis MCP Server

Official
by redis

Redis MCP Server

Integration PyPI - Version Python Version MIT licensed Docker Image Version codecov

Discord Twitch YouTube Twitter Stack Exchange questions

Overview

The Redis MCP Server is a natural language interface designed for agentic applications to efficiently manage and search data in Redis. It integrates seamlessly with MCP (Model Content Protocol) clients, enabling AI-driven workflows to interact with structured and unstructured data in Redis. Using this MCP Server, you can ask questions like:

  • "Store the entire conversation in a stream"

  • "Cache this item"

  • "Store the session with an expiration time"

  • "Index and search this vector"

Related MCP server: mcp-redis-server

Table of Contents

Features

  • Natural Language Queries: Enables AI agents to query and update Redis using natural language.

  • Seamless MCP Integration: Works with any MCP client for smooth communication.

  • Full Redis Support: Handles hashes, lists, sets, sorted sets, streams, and more.

  • Search & Filtering: Supports efficient data retrieval and searching in Redis.

  • Scalable & Lightweight: Designed for high-performance data operations.

  • EntraID Authentication: Native support for Azure Active Directory authentication with Azure Managed Redis.

  • The Redis MCP Server supports the stdio transport. Support to the stremable-http transport will be added in the future.

Tools

This MCP Server provides tools to manage the data stored in Redis.

  • string tools to set, get strings with expiration. Useful for storing simple configuration values, session data, or caching responses.

  • hash tools to store field-value pairs within a single key. The hash can store vector embeddings. Useful for representing objects with multiple attributes, user profiles, or product information where fields can be accessed individually.

  • list tools with common operations to append and pop items. Useful for queues, message brokers, or maintaining a list of most recent actions.

  • set tools to add, remove and list set members. Useful for tracking unique values like user IDs or tags, and for performing set operations like intersection.

  • sorted set tools to manage data for e.g. leaderboards, priority queues, or time-based analytics with score-based ordering.

  • pub/sub functionality to publish messages, create stateful channel or pattern subscriptions, and read queued messages using returned subscription handles. Useful for real-time notifications, chat applications, or distributing updates to multiple clients.

  • streams tools to add, read, delete, create and destroy consumer groups, and acknowledge processed entries in data streams. Useful for event sourcing, activity feeds, and worker-based event processing with Redis Streams consumer groups.

  • JSON tools to store, retrieve, and manipulate JSON documents in Redis. Useful for complex nested data structures, document databases, or configuration management with path-based access.

Additional tools.

  • docs tool to search Redis documentation, tutorials, and best practices using natural language questions (backed by the MCP_DOCS_SEARCH_URL HTTP API).

  • query engine tools to manage vector indexes and perform vector search

  • server management tool to retrieve information about the database

Installation

The Redis MCP Server is available as a PyPI package and as direct installation from the GitHub repository.

Configuring the latest Redis MCP Server version from PyPI, as an example, can be done importing the following JSON configuration in the desired framework or tool. The uvx command will download the server on the fly (if not cached already), create a temporary environment, and then run it.

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

URL specification

The format to specify the --url argument follows the redis and rediss schemes:

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

As an example, you can easily connect to a localhost server with:

redis://localhost:6379/0

Where 0 is the logical database you'd like to connect to.

For an encrypted connection to the database (e.g., connecting to a Redis Cloud database), you'd use the rediss scheme.

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

To verify the server's identity, specify ssl_ca_certs.

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

For an unverified connection, set ssl_cert_reqs to none

rediss://user:secret@hostname:port?ssl_cert_reqs=none

Configure your connection using the available options in the section "Available CLI Options".

Testing the PyPI package

You can install the package as follows:

pip install redis-mcp-server

And start it using uv the package in your environment.

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

However, starting the MCP Server is most useful when delegate to the framework or tool where this MCP Server is configured.

From GitHub

You can configure the desired Redis MCP Server version with uvx, which allows you to run it directly from GitHub (from a branch, or use a tagged release).

It is recommended to use a tagged release, the main branch is under active development and may contain breaking changes.

As an example, you can execute the following command to run the 0.2.0 release:

uvx --from git+https://github.com/redis/mcp-redis.git@0.2.0 redis-mcp-server --url redis://localhost:6379/0

Check the release notes for the latest version in the Releases section. Additional examples are provided below.

# Run with Redis URI
uvx --from git+https://github.com/redis/mcp-redis.git redis-mcp-server --url redis://localhost:6379/0

# Run with Redis URI and SSL
uvx --from git+https://github.com/redis/mcp-redis.git redis-mcp-server --url "rediss://<USERNAME>:<PASSWORD>@<HOST>:<PORT>?ssl_cert_reqs=required&ssl_ca_certs=<PATH_TO_CERT>"

# Run with individual parameters
uvx --from git+https://github.com/redis/mcp-redis.git redis-mcp-server --host localhost --port 6379 --password mypassword

# See all options
uvx --from git+https://github.com/redis/mcp-redis.git redis-mcp-server --help

Development Installation

For development or if you prefer to clone the repository:

# 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

# Run with CLI interface
uv run redis-mcp-server --help

# Or run the main file directly (uses environment variables)
uv run src/main.py

Once you cloned the repository, installed the dependencies and verified you can run the server, you can configure Claude Desktop or any other MCP Client to use this MCP Server running the main file directly (it uses environment variables). This is usually preferred for development. The following example is for Claude Desktop, but the same applies to any other MCP Client.

  1. Specify your Redis credentials and TLS configuration

  2. Retrieve your uv command full path (e.g. which uv)

  3. Edit the claude_desktop_config.json configuration file

    • on a MacOS, 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|False,
                "REDIS_SSL_CA_PATH": "<your_redis_ca_path>",
                "REDIS_CLUSTER_MODE": True|False
            }
        }
    }
}

You can troubleshoot problems by tailing the log file.

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

With Docker

You can use a dockerized deployment of this server. You can either build your own image or use the official Redis MCP Docker image.

If you'd like to build your own image, the Redis MCP Server provides a Dockerfile. Build this server's image with:

docker build -t mcp-redis .

Finally, configure the client to create the container at start-up. An example for Claude Desktop is provided below. Edit the claude_desktop_config.json and add:

{
  "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 Redis MCP Docker image, just replace your image name (mcp-redis in the example above) with mcp/redis.

Configuration

The Redis MCP Server can be configured in two ways: via command line arguments or via environment variables. The precedence is: command line arguments > environment variables > default values.

Redis ACL

You can configure Redis ACL to restrict the access to the Redis database. For example, to create a read-only user:

127.0.0.1:6379> ACL SETUSER readonlyuser on >mypassword ~* +@read -@write

Configure the user via command line arguments or environment variables.

Configuration via command line arguments

When using the CLI interface, you can configure the server with command line arguments:

# 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

# SSL connection
uvx --from redis-mcp-server@latest redis-mcp-server \
  --url rediss://user:pass@redis.example.com:6379/0

# See all available options
uvx --from redis-mcp-server@latest redis-mcp-server --help

Available CLI Options:

  • --url - Redis connection URI (redis://user:pass@host:port/db)

  • --host - Redis hostname (default: 127.0.0.1)

  • --port - Redis port (default: 6379)

  • --db - Redis database number (default: 0)

  • --username - Redis username

  • --password - Redis password

  • --ssl - Enable SSL connection

  • --ssl-ca-path - Path to CA certificate file

  • --ssl-keyfile - Path to SSL key file

  • --ssl-certfile - Path to SSL certificate file

  • --ssl-cert-reqs - SSL certificate requirements (default: required)

  • --ssl-ca-certs - Path to CA certificates file

  • --cluster-mode - Enable Redis cluster mode

Configuration via Environment Variables

If desired, you can use environment variables. Defaults are provided for all 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 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_SSL_CERT_REQS

Whether the client should verify the server's certificate

"required"

REDIS_SSL_CA_CERTS

Path to the trusted CA certificates file

None

REDIS_CLUSTER_MODE

Enable Redis Cluster mode

False

EntraID Authentication for Azure Managed Redis

The Redis MCP Server supports EntraID (Azure Active Directory) authentication for Azure Managed Redis, enabling OAuth-based authentication with automatic token management.

Authentication Providers

Service Principal Authentication - Application-based authentication using client credentials:

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 - For Azure-hosted applications:

# System-assigned managed identity
export REDIS_ENTRAID_AUTH_FLOW=managed_identity
export REDIS_ENTRAID_IDENTITY_TYPE=system_assigned

# User-assigned managed identity
export REDIS_ENTRAID_AUTH_FLOW=managed_identity
export REDIS_ENTRAID_IDENTITY_TYPE=user_assigned
export REDIS_ENTRAID_USER_ASSIGNED_CLIENT_ID=your-identity-client-id

Default Azure Credential - Automatic credential discovery (recommended for development):

export REDIS_ENTRAID_AUTH_FLOW=default_credential
export REDIS_ENTRAID_SCOPES=https://redis.azure.com/.default

EntraID Configuration Variables

Name

Description

Default Value

REDIS_ENTRAID_AUTH_FLOW

Authentication flow type

None (EntraID disabled)

REDIS_ENTRAID_CLIENT_ID

Service Principal client ID

None

REDIS_ENTRAID_CLIENT_SECRET

Service Principal client secret

None

REDIS_ENTRAID_TENANT_ID

Azure tenant ID

None

REDIS_ENTRAID_IDENTITY_TYPE

Managed identity type

"system_assigned"

REDIS_ENTRAID_USER_ASSIGNED_CLIENT_ID

User-assigned managed identity client ID

None

REDIS_ENTRAID_SCOPES

OAuth scopes for Default Azure Credential

"https://redis.azure.com/.default"

REDIS_ENTRAID_RESOURCE

Azure Redis resource identifier

"https://redis.azure.com/"

Key Features

  • Automatic token renewal - Background token refresh with no manual intervention

  • Graceful fallback - Falls back to standard Redis authentication when EntraID not configured

  • Multiple auth flows - Supports Service Principal, Managed Identity, and Default Azure Credential

  • Enterprise ready - Designed for Azure Managed Redis with centralized identity management

Example Configuration

For local development with Azure CLI:

# Login with Azure CLI
az login

# Configure MCP server
export REDIS_ENTRAID_AUTH_FLOW=default_credential
export REDIS_URL=redis://your-azure-redis.redis.cache.windows.net:6379

For production with Service Principal:

export REDIS_ENTRAID_AUTH_FLOW=service_principal
export REDIS_ENTRAID_CLIENT_ID=your-app-client-id
export REDIS_ENTRAID_CLIENT_SECRET=your-app-secret
export REDIS_ENTRAID_TENANT_ID=your-tenant-id
export REDIS_URL=redis://your-azure-redis.redis.cache.windows.net:6379

For Azure-hosted applications with Managed Identity:

export REDIS_ENTRAID_AUTH_FLOW=managed_identity
export REDIS_ENTRAID_IDENTITY_TYPE=system_assigned
export REDIS_URL=redis://your-azure-redis.redis.cache.windows.net:6379

There are several ways to set environment variables:

  1. Using a .env File: Place a .env file in your project directory with key-value pairs for each environment variable. Tools like python-dotenv, pipenv, and uv can automatically load these variables when running your application. This is a convenient and secure way to manage configuration, as it keeps sensitive data out of your shell history and version control (if .env is in .gitignore). For example, create a .env file with the following content from the .env.example file provided in the repository:

cp .env.example .env

Then edit the .env file to set your Redis configuration:

OR,

  1. Setting Variables in the Shell: You can export environment variables directly in your shell before running your application. For example:

export REDIS_HOST=your_redis_host
export REDIS_PORT=6379
# Other variables will be set similarly...

This method is useful for temporary overrides or quick testing.

Logging

The server uses Python's standard logging and is configured at startup. By default it logs at WARNING and above. You can change verbosity with the MCP_REDIS_LOG_LEVEL environment variable.

  • Accepted values (case-insensitive): DEBUG, INFO, WARNING, ERROR, CRITICAL, NOTSET

  • Aliases supported: WARN → WARNING, FATAL → CRITICAL

  • Numeric values are also accepted, including signed (e.g., "10", "+20")

  • Default when unset or unrecognized: WARNING

Handler behavior

  • If the host (e.g., uv, VS Code, pytest) already installed console handlers, the server will NOT add its own; it only lowers overly-restrictive handler thresholds so your chosen level is not filtered out. It will never raise a handler's threshold.

  • If no handlers are present, the server adds a single stderr StreamHandler with a simple format.

Examples

# See normal lifecycle messages
MCP_REDIS_LOG_LEVEL=INFO uv run src/main.py

# Very verbose for debugging
MCP_REDIS_LOG_LEVEL=DEBUG uvx --from redis-mcp-server@latest redis-mcp-server --url redis://localhost:6379/0

In MCP client configs that support env, add it alongside your Redis settings. For example:

{
  "mcpServers": {
    "redis": {
      "command": "uvx",
      "args": ["--from", "redis-mcp-server@latest", "redis-mcp-server", "--url", "redis://localhost:6379/0"],
      "env": {
        "REDIS_HOST": "localhost",
        "REDIS_PORT": "6379",
        "MCP_REDIS_LOG_LEVEL": "INFO"
      }
    }
  }
}

Integrations

Integrating this MCP Server to development frameworks like OpenAI Agents SDK, or with tools like Claude Desktop, VS Code, or Augment is described in the following sections.

OpenAI Agents SDK

Integrate this MCP Server with the OpenAI Agents SDK. Read the documents to learn more about the integration of the SDK with MCP.

Install the Python SDK.

pip install openai-agents

Configure the OpenAI token:

export OPENAI_API_KEY="<openai_token>"

And run the application.

python3.14 redis_assistant.py

You can troubleshoot your agent workflows using the OpenAI dashboard.

Augment

The preferred way of configuring the Redis MCP Server in Augment is to use the Easy MCP feature.

You can also configure the Redis MCP Server in Augment manually by importing the server via JSON:

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

Claude Desktop

The simplest way to configure MCP clients is using uvx. Add the following JSON to your claude_desktop_config.json, remember to provide the full path to uvx.

Basic Redis connection:

{
  "mcpServers": {
    "redis-mcp-server": {
        "type": "stdio",
        "command": "/Users/mortensi/.local/bin/uvx",
        "args": [
            "--from", "redis-mcp-server@latest",
            "redis-mcp-server",
            "--url", "redis://localhost:6379/0"
        ]
    }
  }
}

Azure Managed Redis with EntraID authentication:

{
  "mcpServers": {
    "redis-mcp-server": {
        "type": "stdio",
        "command": "/Users/mortensi/.local/bin/uvx",
        "args": [
            "--from", "redis-mcp-server@latest",
            "redis-mcp-server",
            "--url", "redis://your-azure-redis.redis.cache.windows.net:6379"
        ],
        "env": {
            "REDIS_ENTRAID_AUTH_FLOW": "default_credential",
            "REDIS_ENTRAID_SCOPES": "https://redis.azure.com/.default"
        }
    }
  }
}

VS Code with GitHub Copilot

To use the Redis MCP Server with VS Code, you must nable the agent mode tools. Add the following to your settings.json:

{
  "chat.agent.enabled": true
}

You can start the GitHub desired version of the Redis MCP server using uvx by adding the following JSON to your mcp.json file:

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

Suppressing uvx Installation Messages

If you want to suppress uvx installation messages that may appear as warnings in MCP client logs, use the -qq flag:

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

The -qq flag enables silent mode, which suppresses "Installed X packages" messages that uvx writes to stderr during package installation.

Alternatively, you can start the server using uv and configure your mcp.json. This is usually desired for development.

// mcp.json
{
  "servers": {
    "redis": {
      "type": "stdio",
      "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_USERNAME": "<your_redis_database_username>",
        "REDIS_PWD": "<your_redis_database_password>",
      }
    }
  }
}

For more information, see the VS Code documentation.

Tip: You can prompt Copilot chat to use the Redis MCP tools by including #redis in your message.

Note: Starting with VS Code v1.102, MCP servers are now stored in a dedicated mcp.json file instead of settings.json.

Testing

You can use the MCP Inspector for visual debugging of this MCP Server.

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

Example Use Cases

  • AI Assistants: Enable LLMs to fetch, store, and process data in Redis.

  • Chatbots & Virtual Agents: Retrieve session data, manage queues, and personalize responses.

  • Data Search & Analytics: Query Redis for real-time insights and fast lookups.

  • Event Processing: Manage event streams with Redis Streams.

Contributing

  1. Fork the repo

  2. Create a new branch (feature-branch)

  3. Commit your changes

  4. Push to your branch and submit a PR!

License

This project is licensed under the MIT License.

Badges

Contact

For questions or support, reach out via GitHub Issues.

Alternatively, you can join the Redis Discord server and ask in the #redis-mcp-server channel.

Available Tools

53 tools
client_listA

Get a list of connected clients to the Redis server.

Inputs: no named parameters.

create_vector_index_hashB

Create a Redis 8 vector similarity index using HNSW on a Redis hash.

This function sets up a Redis index for approximate nearest neighbor (ANN) search using the HNSW algorithm and float32 vector embeddings.

Args: index_name: The name of the Redis index to create. Unless specifically required, use the default name for the index. prefix: The key prefix used to identify documents to index (e.g., 'doc:'). Unless specifically required, use the default prefix. vector_field: The name of the vector field to be indexed for similarity search. Unless specifically required, use the default field name dim: The dimensionality of the vectors stored under the vector_field. distance_metric: The distance function to use (e.g., 'COSINE', 'L2', 'IP').

Returns: A string indicating whether the index was created successfully or an error message.

Inputs: dim, prefix, index_name, vector_field, +1 more. Returns: result

dbsizeA

Get the number of keys stored in the Redis database

Inputs: no named parameters. Returns: result

deleteC

Delete a Redis key.

Args: key (str): The key to delete.

Returns: str: Confirmation message or an error message.

Inputs: key (required). Returns: result

expireA

Set an expiration time for a Redis key.

Args: name: The Redis key. expire_seconds: Time in seconds after which the key should expire.

Returns: A success message or an error message.

Inputs: name (required), expire_seconds (required). Returns: result

getB

Get a Redis string value.

Args: key (str): The key to retrieve.

Returns: str, bytes: The stored value or an error message.

Inputs: key (required). Returns: result

get_indexed_keys_numberA

Retrieve the number of indexed keys by the index

Args: index_name (str): The name of the index to retrieve information about.

Returns: str: Number of indexed keys as a string

Inputs: index_name (required). Returns: result

get_indexesA

List of indexes in the Redis database

Returns: str: A JSON string containing the list of indexes or an error message.

Inputs: no named parameters. Returns: result

get_index_infoA

Retrieve schema and information about a specific Redis index using FT.INFO.

Args: index_name (str): The name of the index to retrieve information about.

Returns: str: Information about the specified index or an error message.

Inputs: index_name (required). Returns: result

get_vector_from_hashA

Retrieve a vector from a Redis hash and convert it back from binary blob.

Args: name: The Redis hash key. vector_field: The field name inside the hash. Unless specifically required, use the default field name

Returns: The vector as a list of floats, or an error message if retrieval fails.

Inputs: name (required), vector_field.

hdelA

Delete a field from a Redis hash.

Args: name: The Redis hash key. key: The field name inside the hash.

Returns: A success message or an error message.

Inputs: key (required), name (required). Returns: result

hexistsA

Check if a field exists in a Redis hash.

Args: name: The Redis hash key. key: The field name inside the hash.

Returns: True if the field exists, False otherwise.

Inputs: key (required), name (required). Returns: result

hgetA

Get the value of a field in a Redis hash.

Args: name: The Redis hash key. key: The field name inside the hash.

Returns: The field value or an error message.

Inputs: key (required), name (required). Returns: result

hgetallA

Get all fields and values from a Redis hash.

Args: name: The Redis hash key.

Returns: A dictionary of field-value pairs or an error message.

Inputs: name (required).

hsetA

Set a field in a hash stored at key with an optional expiration time.

Args: name: The Redis hash key. key: The field name inside the hash. value: The value to set. expire_seconds: Optional; time in seconds after which the key should expire.

Returns: A success message or an error message.

Inputs: key (required), name (required), value (required), expire_seconds. Returns: result

infoA

Get Redis server information and statistics.

Args: section: The section of the info command (default, memory, cpu, etc.).

Returns: A dictionary of server information or an error message.

Inputs: section.

json_delA

Delete a JSON value from Redis at a given path.

Args: name: The Redis key where the JSON document is stored. path: The JSON path to delete (default: root '$').

Returns: A success message or an error message.

Inputs: name (required), path. Returns: result

json_getA

Retrieve a JSON value from Redis at a given path.

Args: name: The Redis key where the JSON document is stored. path: The JSON path to retrieve (default: root '$').

Returns: The retrieved JSON value or an error message.

Inputs: name (required), path. Returns: result

json_setA

Set a JSON value in Redis at a given path with an optional expiration time.

Args: name: The Redis key where the JSON document is stored. path: The JSON path where the value should be set. value: The JSON value to store (as JSON string, or will be auto-converted). expire_seconds: Optional; time in seconds after which the key should expire.

Returns: A success message or an error message.

Inputs: name (required), path (required), value (required), expire_seconds. Returns: result

llenB

Get the length of a Redis list.

Inputs: name (required). Returns: result

lpopB

Remove and return the first element from a Redis list.

Inputs: name (required). Returns: result

lpushB

Push a value onto the left of a Redis list and optionally set an expiration time.

Inputs: name (required), value (required), expire. Returns: result

lrangeC

Get elements from a Redis list within a specific range.

Returns: str: A JSON string containing the list of elements or an error message.

Inputs: name (required), stop (required), start (required). Returns: result

lremA

Remove elements from a Redis list.

Args: name: The name of the list count: Number of elements to remove (0 = all, positive = from head, negative = from tail) element: The element value to remove

Returns: A string indicating the number of elements removed.

Inputs: name (required), count (required), element (required). Returns: result

psubscribeB

Subscribe to Redis channels using a pattern.

Args: pattern: The Redis channel pattern to subscribe to.

Returns: A dictionary containing the subscription ID or an error message.

Inputs: pattern (required). Returns: result

publishB

Publish a message to a Redis channel.

Args: channel: The Redis channel to publish to. message: The message to send.

Returns: A success message or an error message.

Inputs: channel (required), message (required). Returns: result

read_messagesA

Read pending pub/sub messages for an existing subscription.

Args: subscription_id: The ID returned by subscribe() or psubscribe(). timeout_ms: Time to wait for messages in milliseconds. Use 0 for non-blocking. max_messages: Maximum number of messages to return in one call.

Returns: A dictionary containing the collected messages or an error message.

Inputs: subscription_id (required), timeout_ms, max_messages. Returns: result

renameB

Renames a Redis key from old_key to new_key.

Args: old_key (str): The current name of the Redis key to rename. new_key (str): The new name to assign to the key.

Returns: Dict[str, Any]: A dictionary containing the result of the operation. On success: {"status": "success", "message": "..."} On error: {"error": "..."}

Inputs: new_key (required), old_key (required). Returns: result

rpopA

Remove and return the last element from a Redis list.

Inputs: name (required). Returns: result

rpushC

Push a value onto the right of a Redis list and optionally set an expiration time.

Inputs: name (required), value (required), expire. Returns: result

saddB

Add a value to a Redis set with an optional expiration time.

Args: name: The Redis set key. value: The value to add to the set. expire_seconds: Optional; time in seconds after which the set should expire.

Returns: A success message or an error message.

Inputs: name (required), value (required), expire_seconds. Returns: result

scan_all_keysA

Scan and return ALL keys matching a pattern using multiple SCAN iterations.

This function automatically handles the SCAN cursor iteration to collect all matching keys. It's safer than KEYS * for large databases but will still collect all results in memory.

⚠️ WARNING: With very large datasets (millions of keys), this may consume significant memory. For large-scale operations, consider using scan_keys() with manual iteration instead.

Args: pattern: Pattern to match keys against (default is "*" for all keys). batch_size: Number of keys to scan per iteration (default 100).

Returns: A list of all keys matching the pattern or an error message.

Inputs: pattern, batch_size. Returns: result

scan_keysA

Scan keys in the Redis database using the SCAN command (non-blocking, production-safe).

⚠️ IMPORTANT: This returns PARTIAL results from one iteration. Use scan_all_keys() to get ALL matching keys, or call this function multiple times with the returned cursor until cursor becomes 0.

The SCAN command iterates through the keyspace in small chunks, making it safe to use on large databases without blocking other operations.

Args: pattern: Pattern to match keys against (default is "" for all keys). Common patterns: "user:", "cache:", ":123", etc. count: Hint for the number of keys to return per iteration (default 100). Redis may return more or fewer keys than this hint. cursor: The cursor position to start scanning from (0 to start from beginning). To continue scanning, use the cursor value returned from previous call.

Returns: A dictionary containing: - 'cursor': Next cursor position (0 means scan is complete) - 'keys': List of keys found in this iteration (PARTIAL RESULTS) - 'total_scanned': Number of keys returned in this batch - 'scan_complete': Boolean indicating if scan is finished Or an error message if something goes wrong.

Example usage: First call: scan_keys("user:") -> returns cursor=1234, keys=[...], scan_complete=False Next call: scan_keys("user:", cursor=1234) -> continues from where it left off Final call: returns cursor=0, scan_complete=True when done

Inputs: count, cursor, pattern. Returns: result

search_redis_documentsA

Search Redis documentation and knowledge base to learn about Redis concepts and use cases.

This tool exposes updated and curated documentation, and must be invoked every time the user wants to learn more in areas including:

Common Use Cases:

  • Session Management: User session storage and management

  • Caching: Application-level and database query caching

  • Rate Limiting: API throttling and request limiting

  • Leaderboards: Gaming and ranking systems

  • Semantic Search: AI-powered similarity search

  • Agentic Workflows: AI agent state and memory management

  • RAG (Retrieval-Augmented Generation): Vector storage for AI applications

  • Real-time Analytics: Counters, metrics, and time-series data

  • Message Queues: Task queues and job processing

  • Geospatial: Location-based queries and proximity search

Args: question: The question about Redis concepts, data structures, features, or use cases

Returns: Union[List[Dict[str, Any]], Dict[str, Any]]: A list of documentation results from the API, or a dict with an error message.

Inputs: question (required). Returns: result

setA

Set a Redis string value with an optional expiration time.

Args: key (str): The key to set. value (str, bytes, int, float, dict): The value to store. expiration (int, optional): Expiration time in seconds.

Returns: str: Confirmation message or an error message.

Inputs: key (required), value (required), expiration. Returns: result

set_vector_in_hashB

Store a vector as a field in a Redis hash.

Args: name: The Redis hash key. vector_field: The field name inside the hash. Unless specifically required, use the default field name vector: The vector (list of numbers) to store in the hash.

Returns: True if the vector was successfully stored, False otherwise.

Inputs: name (required), vector (required), vector_field. Returns: result

smembersA

Get all members of a Redis set.

Args: name: The Redis set key.

Returns: A list of values in the set or an error message.

Inputs: name (required). Returns: result

sremA

Remove a value from a Redis set.

Args: name: The Redis set key. value: The value to remove from the set.

Returns: A success message or an error message.

Inputs: name (required), value (required). Returns: result

subscribeB

Subscribe to a Redis channel and return a reusable subscription handle.

Args: channel: The Redis channel to subscribe to.

Returns: A dictionary containing the subscription ID or an error message.

Inputs: channel (required). Returns: result

typeA

Returns the string representation of the type of the value stored at key

Args: key (str): The key to check.

Returns: str: The type of key, or none when key doesn't exist

Inputs: key (required). Returns: result

unsubscribeA

Unsubscribe and close an existing pub/sub subscription.

Args: subscription_id: The ID returned by subscribe() or psubscribe().

Returns: A dictionary describing the closed subscription or an error message.

Inputs: subscription_id (required). Returns: result

vector_search_hashA

Perform a KNN vector similarity search using Redis 8 or later version on vectors stored in hash data structures.

Args: query_vector: List of floats to use as the query vector. index_name: Name of the Redis index. Unless specifically specified, use the default index name. vector_field: Name of the indexed vector field. Unless specifically required, use the default field name k: Number of nearest neighbors to return. return_fields: List of fields to return (optional).

Returns: A list of matched documents or an error message.

Inputs: query_vector (required), k, index_name, vector_field, +1 more. Returns: result

xackC

Acknowledge entries that were processed by a consumer group.

Args: key (str): The stream key. group_name (str): The consumer group name. entry_ids (List[str]): Entry IDs to acknowledge.

Returns: str: Confirmation message or an error message.

Inputs: key (required), entry_ids (required), group_name (required). Returns: result

xaddA

Add an entry to a Redis stream with an optional expiration time.

Args: key (str): The stream key. fields (dict): The fields and values for the stream entry. expiration (int, optional): Expiration time in seconds.

Returns: str: The ID of the added entry or an error message.

Inputs: key (required), fields (required), expiration. Returns: result

xdelB

Delete an entry from a Redis stream.

Args: key (str): The stream key. entry_id (str): The ID of the entry to delete.

Returns: str: Confirmation message or an error message.

Inputs: key (required), entry_id (required). Returns: result

xgroup_createA

Create a consumer group for a Redis stream.

Args: key (str): The stream key. group_name (str): The consumer group name. start_id (str, optional): Stream ID from which the group starts consuming. mkstream (bool, optional): Create the stream if it does not exist.

Returns: str: Confirmation message or an error message.

Inputs: key (required), group_name (required), mkstream, start_id. Returns: result

xgroup_destroyC

Destroy a consumer group for a Redis stream.

Args: key (str): The stream key. group_name (str): The consumer group name.

Returns: str: Confirmation message or an error message.

Inputs: key (required), group_name (required). Returns: result

xrangeC

Read entries from a Redis stream.

Args: key (str): The stream key. count (int, optional): Number of entries to retrieve.

Returns: str: The retrieved stream entries or an error message.

Inputs: key (required), count. Returns: result

xreadgroupA

Read entries from a Redis stream using a consumer group.

Args: key (str): The stream key. group_name (str): The consumer group name. consumer_name (str): The consumer name. count (int, optional): Maximum number of entries to retrieve. block_ms (int, optional): Maximum time to block waiting for entries. Use None for a non-blocking read. 0 is rejected because Redis treats BLOCK 0 as an indefinite wait. stream_id (str, optional): Stream ID to read from. Use ">" for new messages.

Returns: str: The retrieved stream entries or an error message.

Inputs: key (required), group_name (required), consumer_name (required), count, +2 more. Returns: result

zaddB

Add a member to a Redis sorted set with an optional expiration time.

Args: key (str): The sorted set key. score (float): The score of the member. member (str): The member to add. expiration (int, optional): Expiration time in seconds.

Returns: str: Confirmation message or an error message.

Inputs: key (required), score (required), member (required), expiration. Returns: result

zrangeA

Retrieve a range of members from a Redis sorted set.

Args: key (str): The sorted set key. start (int): The starting index. end (int): The ending index. with_scores (bool, optional): Whether to include scores in the result.

Returns: str: The sorted set members in the given range or an error message.

Inputs: end (required), key (required), start (required), with_scores. Returns: result

zremB

Remove a member from a Redis sorted set.

Args: key (str): The sorted set key. member (str): The member to remove.

Returns: str: Confirmation message or an error message.

Inputs: key (required), member (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 53 tools

    Disambiguation5/5

    Each tool maps to a distinct Redis command or data structure operation, so an agent can clearly identify the appropriate tool for a given task. The few overlapping tools like scan_keys and scan_all_keys are explicitly differentiated by their partial vs. full result behavior.

    Naming Consistency4/5

    Tool names use lowercase with underscores and generally follow a verb_noun or Redis command style. Minor deviations like 'dbsize' or single-word commands ('set', 'get', 'type') are standard Redis command names and don't break the overall consistency.

    Tool Count2/5

    With 53 tools, the surface is very large and could overwhelm an agent. While Redis is broad, so many individual tools are excessive for a single MCP server, and many related operations could be grouped or parameterized.

    Completeness4/5

    The tool set covers the main Redis data structures (strings, hashes, lists, sets, sorted sets, streams, JSON) plus pub/sub, search, indexing, and server info. Missing operations like TTL/EXISTS/INCR or index deletion are minor gaps that can be worked around.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers