client_list
Get a list of connected clients to the Redis server.
Read and write every Redis type from a chat client — strings, hashes, JSON, lists, sets, sorted sets and streams — and run KNN or metadata-filtered vector search over what you stored.
LABSCO SUMMARY
Inspection and change land in the same place: dbsize, INFO and client_list sit next to the calls that set keys and destroy consumer groups. The vector side is the part that goes beyond a cache client — index creation, KNN and hybrid search that pre-filters by metadata are all present, which makes an instance usable as a retrieval backend rather than only as storage. Nothing is read-only here, so delete, json_del and xgroup_destroy are one call away from whatever session is connected.
The Redis project's own server over a live connection to an instance: 53 tools covering the core data types, pub/sub, consumer groups, and the search and vector index commands.
A Redis instance the server can reach, and uv with a Python available (UV_PYTHON). The vector index and KNN tools target Redis 8 or later. MIT licensed.
One command — uvx --from redis-mcp-server@latest redis-mcp-server --url redis://localhost:6379/0
USE CASES
Scan for the keys matching the pattern in question, check what type each one actually is, read the value, and look at the expiry that was or was not set on it.
Create an HNSW index over a key prefix with the dimension and distance metric you want, write embeddings into the hashes, then query by nearest neighbour — or filter by metadata first when the corpus is mixed.
Read the raw entries to see what accumulated, create a consumer group if one is missing, then read as a consumer and acknowledge the entries you actually processed.
Take the key count, pull the memory and cpu sections of INFO, and see which clients are connected — the three answers you want before deciding whether the problem is data or load.
Subscribe to the channel or a pattern of channels, drain the pending messages with a timeout, publish a test message of your own to confirm the path, then close the subscription.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
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.
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.
dbsizeGet the number of keys stored in the Redis database
deleteDelete a Redis key.
Args: key (str): The key to delete.
Returns: str: Confirmation message or an error message.
expireSet 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.
getGet a Redis string value.
Args: key (str): The key to retrieve.
Returns: str, bytes: The stored value or an error message.
get_index_infoRetrieve 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.
get_indexed_keys_numberRetrieve 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
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.
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.
hdelDelete 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.
hexistsCheck 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.
hgetGet 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.
hgetallGet 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.
hsetSet 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.
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/
Args: query_vector: List of floats to use as the query vector. filter_expression: Redis filter expression to restrict candidates before KNN ranking. Defaults to '*' (no filter). index_name: Name of the Redis index (default: 'vector_index'). vector_field: Name of the indexed vector field (default: 'vector'). k: Number of nearest neighbors to return. return_fields: Additional fields to include in results (optional).
Returns: A list of matched documents with their similarity score, or an error message.
infoGet 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.
json_delDelete 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.
json_getRetrieve 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.
json_setSet 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.
llenGet the length of a Redis list.
lpopRemove and return the first element from a Redis list.
lpushPush a value onto the left of a Redis list and optionally set an expiration time.
lrangeGet elements from a Redis list within a specific range.
Returns: str: A JSON string containing the list of elements or an error message.
lremRemove 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.
psubscribeSubscribe 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.
publishPublish 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.
read_messagesRead 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.
renameRenames 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": "..."}
rpopRemove and return the last element from a Redis list.
rpushPush a value onto the right of a Redis list and optionally set an expiration time.
saddAdd 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.
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.
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.
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.
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:
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
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:
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.
setSet 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.
set_vector_in_hashStore 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.
smembersGet all members of a Redis set.
Args: name: The Redis set key.
Returns: A list of values in the set or an error message.
sremRemove 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.
subscribeSubscribe 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.
typeReturns 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
unsubscribeUnsubscribe 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.
vector_search_hashPerform 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.
xackAcknowledge 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.
xaddAdd 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.
xdelDelete 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.
xgroup_createCreate 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.
xgroup_destroyDestroy 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.
xrangeRead 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.
xreadgroupRead 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.
zaddAdd 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.
zrangeRetrieve 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.
zremRemove 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.
BEFORE YOU INSTALL
53 tools when we connected.
All 4 documented clients run the server on your machine.
CONTEXT COST
Rated by the size of the 53 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
uvx --from redis-mcp-server@latest redis-mcp-server --url redis://localhost:6379/0{
"mcpServers": {
"redis-mcp-server": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"redis-mcp-server@latest",
"redis-mcp-server",
"--url",
"redis://localhost:6379/0"
]
}
}
}{
"servers": {
"redis": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"redis-mcp-server@latest",
"redis-mcp-server",
"--url",
"redis://localhost:6379/0"
]
}
}
}{
"mcpServers": {
"Redis MCP Server": {
"command": "uvx",
"args": [
"--from",
"redis-mcp-server@latest",
"redis-mcp-server",
"--url",
"redis://localhost:6379/0"
]
}
}
}{
"mcpServers": {
"redis": {
"command": "docker",
"args": [
"run",
"--rm",
"--name",
"redis-mcp-server",
"-i",
"-e",
"REDIS_HOST=<YOUR_REDIS_HOST>",
"-e",
"REDIS_PORT=<YOUR_REDIS_PORT>",
"-e",
"REDIS_USERNAME=<YOUR_REDIS_USERNAME>",
"-e",
"REDIS_PWD=<YOUR_REDIS_PWD>",
"mcp/redis"
]
}
}
}