Version 4.43 or later needs to be installed to add the server automatically
Use cases
About
Access to Redis database operations.
| Attribute | Details |
|---|---|
| Docker Image | mcp/redis |
| Author | redis |
| Repository | https://github.com/redis/mcp-redis |
| Attribute | Details |
|---|---|
| Dockerfile | https://github.com/redis/mcp-redis/blob/53df2bcb7754a393f53b6c880ab710b95fefa343/Dockerfile |
| Commit | 53df2bcb7754a393f53b6c880ab710b95fefa343 |
| Docker Image built by | Docker Inc. |
| Docker Scout Health Score | |
| Verify Signature | COSIGN_REPOSITORY=mcp/signatures cosign verify mcp/redis --key https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub |
| Licence | MIT License |
| Tools provided by this Server | Short Description |
|---|---|
client_list | Get a list of connected clients to the Redis server. |
create_vector_index_hash | Create a Redis 8 vector similarity index using HNSW on a Redis hash. |
dbsize | Get the number of keys stored in the Redis database |
delete | Delete a Redis key. |
expire | Set an expiration time for a Redis key. |
get | Get a Redis string value. |
get_index_info | Retrieve schema and information about a specific Redis index using FT.INFO. |
get_indexed_keys_number | Retrieve the number of indexed keys by the index |
get_indexes | List of indexes in the Redis database |
get_vector_from_hash | Retrieve a vector from a Redis hash and convert it back from binary blob. |
hdel | Delete a field from a Redis hash. |
hexists | Check if a field exists in a Redis hash. |
hget | Get the value of a field in a Redis hash. |
hgetall | Get all fields and values from a Redis hash. |
hset | Set a field in a hash stored at key with an optional expiration time. |
hybrid_search | Perform a hybrid search combining a Redis filter expression with KNN vector similarity. |
info | Get Redis server information and statistics. |
json_del | Delete a JSON value from Redis at a given path. |
json_get | Retrieve a JSON value from Redis at a given path. |
json_set | Set a JSON value in Redis at a given path with an optional expiration time. |
llen | Get the length of a Redis list. |
lpop | Remove and return the first element from a Redis list. |
lpush | Push a value onto the left of a Redis list and optionally set an expiration time. |
lrange | Get elements from a Redis list within a specific range. |
lrem | Remove elements from a Redis list. |
psubscribe | Subscribe to Redis channels using a pattern. |
publish | Publish a message to a Redis channel. |
read_messages | Read pending pub/sub messages for an existing subscription. |
rename | Renames a Redis key from old_key to new_key. |
rpop | Remove and return the last element from a Redis list. |
rpush | Push a value onto the right of a Redis list and optionally set an expiration time. |
sadd | Add a value to a Redis set with an optional expiration time. |
scan_all_keys | Scan and return ALL keys matching a pattern using multiple SCAN iterations. |
scan_keys | Scan keys in the Redis database using the SCAN command (non-blocking, production-safe). |
search_redis_documents | Search Redis documentation and knowledge base to learn about Redis concepts and use cases. |
set | Set a Redis string value with an optional expiration time. |
set_vector_in_hash | Store a vector as a field in a Redis hash. |
smembers | Get all members of a Redis set. |
srem | Remove a value from a Redis set. |
subscribe | Subscribe to a Redis channel and return a reusable subscription handle. |
type | Returns the string representation of the type of the value stored at key |
unsubscribe | Unsubscribe and close an existing pub/sub subscription. |
vector_search_hash | Perform a KNN vector similarity search using Redis 8 or later version on vectors stored in hash data structures. |
xack | Acknowledge entries that were processed by a consumer group. |
xadd | Add an entry to a Redis stream with an optional expiration time. |
xdel | Delete an entry from a Redis stream. |
xgroup_create | Create a consumer group for a Redis stream. |
xgroup_destroy | Destroy a consumer group for a Redis stream. |
xrange | Read entries from a Redis stream. |
xreadgroup | Read entries from a Redis stream using a consumer group. |
zadd | Add a member to a Redis sorted set with an optional expiration time. |
zrange | Retrieve a range of members from a Redis sorted set. |
zrem | Remove a member from a Redis sorted set. |
client_listGet a list of connected clients to the Redis server.
create_vector_index_hashCreate 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.
| Parameters | Type | Description |
|---|---|---|
dim | integeroptional | The dimensionality of the vectors stored under the vector_field. |
distance_metric | stringoptional | The distance function to use (e.g., 'COSINE', 'L2', 'IP'). |
index_name | stringoptional | The name of the Redis index to create. Unless specifically required, use the default name for the index. |
prefix | stringoptional | The key prefix used to identify documents to index (e.g., 'doc:'). Unless specifically required, use the default prefix. |
vector_field | stringoptional | The name of the vector field to be indexed for similarity search. Unless specifically required, use the default field name |
dbsizeGet the number of keys stored in the Redis database
deleteDelete a Redis key.
| Parameters | Type | Description |
|---|---|---|
key | string |
expireSet an expiration time for a Redis key.
| Parameters | Type | Description |
|---|---|---|
expire_seconds | integer | Time in seconds after which the key should expire. |
name | string | The Redis key. |
getGet a Redis string value.
| Parameters | Type | Description |
|---|---|---|
key | string |
get_index_infoRetrieve schema and information about a specific Redis index using FT.INFO.
| Parameters | Type | Description |
|---|---|---|
index_name | string |
get_indexed_keys_numberRetrieve the number of indexed keys by the index
| Parameters | Type | Description |
|---|---|---|
index_name | string |
get_indexesList of indexes in the Redis database
Returns: str: A JSON string containing the list of indexes or an error message.
get_vector_from_hashRetrieve a vector from a Redis hash and convert it back from binary blob.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis hash key. |
vector_field | stringoptional | The field name inside the hash. Unless specifically required, use the default field name |
hdelDelete a field from a Redis hash.
| Parameters | Type | Description |
|---|---|---|
key | string | The field name inside the hash. |
name | string | The Redis hash key. |
hexistsCheck if a field exists in a Redis hash.
| Parameters | Type | Description |
|---|---|---|
key | string | The field name inside the hash. |
name | string | The Redis hash key. |
hgetGet the value of a field in a Redis hash.
| Parameters | Type | Description |
|---|---|---|
key | string | The field name inside the hash. |
name | string | The Redis hash key. |
hgetallGet all fields and values from a Redis hash.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis hash key. |
hsetSet a field in a hash stored at key with an optional expiration time.
| Parameters | Type | Description |
|---|---|---|
key | string | The field name inside the hash. |
name | string | The Redis hash key. |
value | string | The value to set. |
expire_seconds | stringoptional | Optional; time in seconds after which the key should expire. |
hybrid_searchPerform a hybrid search combining a Redis filter expression with KNN vector similarity.
Hybrid search pre-filters documents by metadata before ranking by vector similarity — the standard pattern for production RAG and semantic search pipelines.
Filter expression examples: "*" → no filter, pure vector search (same as vector_search_hash) "@category:{news}" → tag filter "@year:[2020 2024]" → numeric range "@lang:{en} @year:[2022 +inf]" → combined tag + range "@title:redis" → full-text match on a text field
Full filter syntax: https://redis.io/docs/latest/develop/interact/search-and-query/query/
| Parameters | Type | Description |
|---|---|---|
query_vector | array | List of floats to use as the query vector. |
filter_expression | stringoptional | Redis filter expression to restrict candidates before KNN ranking. |
index_name | stringoptional | Name of the Redis index (default: 'vector_index'). |
k | integeroptional | Number of nearest neighbors to return. |
return_fields | stringoptional | Additional fields to include in results (optional). |
vector_field | stringoptional | Name of the indexed vector field (default: 'vector'). |
infoGet Redis server information and statistics.
| Parameters | Type | Description |
|---|---|---|
section | stringoptional | The section of the info command (default, memory, cpu, etc.). |
json_delDelete a JSON value from Redis at a given path.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis key where the JSON document is stored. |
path | stringoptional | The JSON path to delete (default: root '$'). |
json_getRetrieve a JSON value from Redis at a given path.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis key where the JSON document is stored. |
path | stringoptional | The JSON path to retrieve (default: root '$'). |
json_setSet a JSON value in Redis at a given path with an optional expiration time.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis key where the JSON document is stored. |
path | string | The JSON path where the value should be set. |
value | string | The JSON value to store (as JSON string, or will be auto-converted). |
expire_seconds | stringoptional | Optional; time in seconds after which the key should expire. |
llenGet the length of a Redis list.
| Parameters | Type | Description |
|---|---|---|
name | string |
lpopRemove and return the first element from a Redis list.
| Parameters | Type | Description |
|---|---|---|
name | string |
lpushPush a value onto the left of a Redis list and optionally set an expiration time.
| Parameters | Type | Description |
|---|---|---|
name | string | |
value | string | |
expire | stringoptional |
lrangeGet elements from a Redis list within a specific range.
Returns: str: A JSON string containing the list of elements or an error message.
| Parameters | Type | Description |
|---|---|---|
name | string | |
start | integer | |
stop | integer |
lremRemove elements from a Redis list.
| Parameters | Type | Description |
|---|---|---|
count | integer | Number of elements to remove (0 = all, positive = from head, negative = from tail) |
element | string | The element value to remove |
name | string | The name of the list |
psubscribeSubscribe to Redis channels using a pattern.
| Parameters | Type | Description |
|---|---|---|
pattern | string | The Redis channel pattern to subscribe to. |
publishPublish a message to a Redis channel.
| Parameters | Type | Description |
|---|---|---|
channel | string | The Redis channel to publish to. |
message | string | The message to send. |
read_messagesRead pending pub/sub messages for an existing subscription.
| Parameters | Type | Description |
|---|---|---|
subscription_id | string | The ID returned by subscribe() or psubscribe(). |
max_messages | integeroptional | Maximum number of messages to return in one call. |
timeout_ms | integeroptional | Time to wait for messages in milliseconds. Use 0 for non-blocking. |
renameRenames a Redis key from old_key to new_key.
| Parameters | Type | Description |
|---|---|---|
new_key | string | |
old_key | string |
rpopRemove and return the last element from a Redis list.
| Parameters | Type | Description |
|---|---|---|
name | string |
rpushPush a value onto the right of a Redis list and optionally set an expiration time.
| Parameters | Type | Description |
|---|---|---|
name | string | |
value | string | |
expire | stringoptional |
saddAdd a value to a Redis set with an optional expiration time.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis set key. |
value | string | The value to add to the set. |
expire_seconds | stringoptional | Optional; time in seconds after which the set should expire. |
scan_all_keysScan 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.
| Parameters | Type | Description |
|---|---|---|
batch_size | integeroptional | Number of keys to scan per iteration (default 100). |
pattern | stringoptional | Pattern to match keys against (default is "*" for all keys). |
scan_keysScan 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.
| Parameters | Type | Description |
|---|---|---|
count | integeroptional | Hint for the number of keys to return per iteration (default 100). |
cursor | integeroptional | The cursor position to start scanning from (0 to start from beginning). |
pattern | stringoptional | Pattern to match keys against (default is "*" for all keys). |
search_redis_documentsSearch 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:
question|string|The question about Redis concepts, data structures, features, or use casessetSet a Redis string value with an optional expiration time.
| Parameters | Type | Description |
|---|---|---|
key | string | |
value | string | |
expiration | stringoptional |
set_vector_in_hashStore a vector as a field in a Redis hash.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis hash key. |
vector | array | The vector (list of numbers) to store in the hash. |
vector_field | stringoptional | The field name inside the hash. Unless specifically required, use the default field name |
smembersGet all members of a Redis set.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis set key. |
sremRemove a value from a Redis set.
| Parameters | Type | Description |
|---|---|---|
name | string | The Redis set key. |
value | string | The value to remove from the set. |
subscribeSubscribe to a Redis channel and return a reusable subscription handle.
| Parameters | Type | Description |
|---|---|---|
channel | string | The Redis channel to subscribe to. |
typeReturns the string representation of the type of the value stored at key
| Parameters | Type | Description |
|---|---|---|
key | string |
unsubscribeUnsubscribe and close an existing pub/sub subscription.
| Parameters | Type | Description |
|---|---|---|
subscription_id | string | The ID returned by subscribe() or psubscribe(). |
vector_search_hashPerform a KNN vector similarity search using Redis 8 or later version on vectors stored in hash data structures.
| Parameters | Type | Description |
|---|---|---|
query_vector | array | List of floats to use as the query vector. |
index_name | stringoptional | Name of the Redis index. Unless specifically specified, use the default index name. |
k | integeroptional | Number of nearest neighbors to return. |
return_fields | stringoptional | List of fields to return (optional). |
vector_field | stringoptional | Name of the indexed vector field. Unless specifically required, use the default field name |
xackAcknowledge entries that were processed by a consumer group.
| Parameters | Type | Description |
|---|---|---|
entry_ids | array | |
group_name | string | |
key | string |
xaddAdd an entry to a Redis stream with an optional expiration time.
| Parameters | Type | Description |
|---|---|---|
fields | object | |
key | string | |
expiration | stringoptional |
xdelDelete an entry from a Redis stream.
| Parameters | Type | Description |
|---|---|---|
entry_id | string | |
key | string |
xgroup_createCreate a consumer group for a Redis stream.
| Parameters | Type | Description |
|---|---|---|
group_name | string | |
key | string | |
mkstream | booleanoptional | |
start_id | stringoptional |
xgroup_destroyDestroy a consumer group for a Redis stream.
| Parameters | Type | Description |
|---|---|---|
group_name | string | |
key | string |
xrangeRead entries from a Redis stream.
| Parameters | Type | Description |
|---|---|---|
key | string | |
count | integeroptional |
xreadgroupRead entries from a Redis stream using a consumer group.
| Parameters | Type | Description |
|---|---|---|
consumer_name | string | |
group_name | string | |
key | string | |
block_ms | stringoptional | |
count | integeroptional | |
stream_id | stringoptional |
zaddAdd a member to a Redis sorted set with an optional expiration time.
| Parameters | Type | Description |
|---|---|---|
key | string | |
member | string | |
score | number | |
expiration | stringoptional |
zrangeRetrieve a range of members from a Redis sorted set.
| Parameters | Type | Description |
|---|---|---|
end | integer | |
key | string | |
start | integer | |
with_scores | booleanoptional |
zremRemove a member from a Redis sorted set.
| Parameters | Type | Description |
|---|---|---|
key | string | |
member | string |
{
"mcpServers": {
"redis": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"REDIS_HOST",
"-e",
"REDIS_PORT",
"-e",
"REDIS_USERNAME",
"-e",
"REDIS_SSL",
"-e",
"REDIS_CA_PATH",
"-e",
"REDIS_SSL_KEYFILE",
"-e",
"REDIS_SSL_CERTFILE",
"-e",
"REDIS_CERT_REQS",
"-e",
"REDIS_CA_CERTS",
"-e",
"REDIS_CLUSTER_MODE",
"-e",
"REDIS_PWD",
"mcp/redis"
],
"env": {
"REDIS_HOST": "127.0.0.1",
"REDIS_PORT": "6379",
"REDIS_USERNAME": "default",
"REDIS_SSL": "False",
"REDIS_CA_PATH": "",
"REDIS_SSL_KEYFILE": "",
"REDIS_SSL_CERTFILE": "",
"REDIS_CERT_REQS": "required",
"REDIS_CA_CERTS": "",
"REDIS_CLUSTER_MODE": "False",
"REDIS_PWD": ""
}
}
}
}