The MCP Server Redis provides a Model Context Protocol server implementation for Redis database interactions, allowing language models to directly access and manipulate data in Redis through a structured API interface.
To install the MCP Server Redis, follow these steps:
Make sure you have UV package manager installed:
# If UV is not installed, follow instructions at https://docs.astral.sh/uv/
uv venv
source .venv/bin/activate
uv sync
Configure your Redis connection:
.env
file based on the provided .env.example
Start the server:
python src/server.py
The server provides the following endpoint resources:
redis://status
- Check current Redis connection statusredis://info
- Get detailed Redis server informationredis://keys/{pattern}
- List all keys matching the specified patternget_value
key
set_value
key
, value
, expiry
(optional)delete_key
key
increment
key
, amount
(optional)list_push
key
, values
, side
(optional: "left" or "right")list_range
key
, start
, end
hash_set
key
, fields
(dictionary of field-value pairs)hash_get
key
, fields
(list of fields to retrieve)set_add
key
, members
set_members
key
channel
, message
You can test the server using the MCP Inspector:
mcp dev src/server.py
Or install it in Claude Desktop:
mcp install src/server.py
Here's an example conversation showing how to use the MCP Server:
User: What's the current Redis connection status?
LLM: [Reading resource redis://status]
The Redis server is currently connected and running on localhost:6379, database 0.
User: Can you store my name "Alice" in Redis?
LLM: [Calling set_value with key="name" value="Alice"]
Successfully set key 'name'
User: Yes please verify it
LLM: [Calling get_value with key="name"]
Alice
The server provides automatic reconnection to Redis if the connection is lost and includes error handling for all operations.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "redis" '{"command":"python","args":["src/server.py"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"redis": {
"command": "python",
"args": [
"src/server.py"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"redis": {
"command": "python",
"args": [
"src/server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect