The Redis MCP Server is a specialized server that allows Large Language Models to interact with Redis databases through the Model Context Protocol. It provides standardized tools for reading, writing, and managing data in Redis key-value stores, making it possible for AI models to directly work with Redis databases.
Before installing the Redis MCP server, ensure you have:
You can run the Redis MCP server using Docker:
docker run -i --rm mcp/redis redis://localhost:6379
Notes for Docker usage:
host.docker.internal
if the server is running on the host networkAlternatively, you can run the server using NPX:
npx -y @modelcontextprotocol/server-redis redis://localhost:6379
To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json
:
{
"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"
]
}
}
}
For manual installation in VS Code, add the following to your User Settings (JSON) file:
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "redis_url",
"description": "Redis URL (e.g. redis://localhost:6379)"
}
],
"servers": {
"redis": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-redis"],
"env": {
"REDIS_URL": "${input:redis_url}"
}
}
}
}
}
For Docker installation in VS Code:
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "redis_url",
"description": "Redis URL (e.g. redis://host.docker.internal:6379)"
}
],
"servers": {
"redis": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/redis"],
"env": {
"REDIS_URL": "${input:redis_url}"
}
}
}
}
}
The Redis MCP server provides the following tools:
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:
redis-cli ping
should return "PONG"memurai-cli ping
should return "PONG"systemctl status redis
brew services list
redis://hostname:port
redis://localhost:6379
fails, try using the explicit IP: redis://127.0.0.1:6379
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.