The Redis MCP Server provides a Model Context Protocol interface for interacting with a Redis database, enabling operations across multiple data types:
Hash operations: Set multiple fields (
hmset), get a specific field (hget), or retrieve all fields and values (hgetall)Key operations: Scan keys matching a pattern (
scan) and delete keys (del)String operations: Set values with optional NX/PX conditions (
set) and retrieve values (get)Sorted set operations: Add members with scores (
zadd), get ranges by index (zrange) or score (zrangebyscore), and remove members (zrem)Set operations: Add members (
sadd) and retrieve all members (smembers)
Provides access to Redis database operations through a Model Context Protocol (MCP) server. Includes tools for various Redis commands such as HMSET, HGET, HGETALL, SCAN, SET, GET, DEL, ZADD, ZRANGE, ZRANGEBYSCORE, ZREM, SADD, and SMEMBERS.
Redis MCP Server
A Model Context Protocol (MCP) server that provides access to Redis database operations.
Project Structure
Related MCP server: Redash MCP Server
Available Tools
Tool | Type | Description | Input Schema |
hmset | Hash Command | Set multiple hash fields to multiple values |
: string (Hash key)
: object (Field-value pairs to set) |
hget | Hash Command | Get the value of a hash field |
: string (Hash key)
: string (Field to get) |
hgetall | Hash Command | Get all fields and values in a hash |
: string (Hash key) |
scan | Key Command | Scan Redis keys matching a pattern |
: string (Pattern to match, e.g., "user:*")
: number, optional (Number of keys to return) |
set | String Command | Set string value with optional NX and PX options |
: string (Key to set)
: string (Value to set)
: boolean, optional (Only set if not exists)
: number, optional (Expiry in milliseconds) |
get | String Command | Get string value |
: string (Key to get) |
del | Key Command | Delete a key |
: string (Key to delete) |
zadd | Sorted Set Command | Add one or more members to a sorted set |
: string (Sorted set key)
: array of objects with
: number and
: string |
zrange | Sorted Set Command | Return a range of members from a sorted set by index |
: string (Sorted set key)
: number (Start index)
: number (Stop index)
: boolean, optional (Include scores in output) |
zrangebyscore | Sorted Set Command | Return members from a sorted set with scores between min and max |
: string (Sorted set key)
: number (Minimum score)
: number (Maximum score)
: boolean, optional (Include scores in output) |
zrem | Sorted Set Command | Remove one or more members from a sorted set |
: string (Sorted set key)
: array of strings (Members to remove) |
sadd | Set Command | Add one or more members to a set |
: string (Set key)
: array of strings (Members to add to the set) |
smembers | Set Command | Get all members in a set |
: string (Set key) |
Usage
Configure in your MCP client (e.g., Claude Desktop, Cline):
Command Line Arguments
--redis-host: Redis server host (default: localhost)--redis-port: Redis server port (default: 6379)
Installing via Smithery
To install Redis Server for Claude Desktop automatically via Smithery:
Development
To add a new Redis tool:
Create a new tool class in
src/tools/extendingRedisToolDefine the tool's interface in
src/interfaces/types.tsRegister the tool in
src/tools/tool_registry.ts
Example tool implementation:
Running evals
The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found here.