The Redis MCP server enables Large Language Models (LLMs) to interact with Redis key-value stores through a standardized set of tools. This server bridges the gap between AI models and Redis databases, allowing for data storage, retrieval, and manipulation operations.
Before using the Redis MCP server, you need:
Run the Redis MCP server using Docker:
docker run -i --rm mcp/redis redis://localhost:6379
When running on macOS with Docker, use host.docker.internal
instead of localhost
if the Redis server is on the host network:
docker run -i --rm mcp/redis redis://host.docker.internal:6379
You can also run the server directly with NPX:
npx -y @modelcontextprotocol/server-redis redis://localhost:6379
The Redis URL is optional and defaults to redis://localhost:6379
. If you experience connection issues with localhost
, try using the explicit IP redis://127.0.0.1:6379
.
To use this server with the Claude Desktop app, add the following configuration to your claude_desktop_config.json
file:
{
"mcpServers": {
"redis": {
"command": "docker",
"args": [
"run",
"- i",
"--rm",
"mcp/redis",
"redis://host.docker.internal:6379"]
}
}
}
{
"mcpServers": {
"redis": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-redis",
"redis://localhost:6379"
]
}
}
}
The Redis MCP server provides several tools for interacting with Redis:
Sets a Redis key-value pair with optional expiration:
key
(string): Redis keyvalue
(string): Value to storeexpireSeconds
(number, optional): Expiration time in secondsRetrieves a value by key from Redis:
key
(string): Redis key to retrieveDeletes one or more keys from Redis:
key
(string | string[]): Key or array of keys to deleteLists Redis keys matching a pattern:
pattern
(string, optional): Pattern to match keys (default: *)If you encounter an ECONNREFUSED error:
Verify the Redis server is running:
redis-cli ping
should return "PONG"memurai-cli ping
should return "PONG"Check the service status:
systemctl status redis
brew services list
Ensure the Redis port (default 6379) isn't blocked by a firewall
Try using the explicit IP address:
redis://localhost:6379
redis://127.0.0.1:6379
The server implements these connection policies:
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.
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"
]
}
}
}
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.
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.