Official Redis MCP server providing a natural language interface for intelligent agent applications, efficiently managing and searching Redis data.
Redis MCP Server - Project Details
Project Overview
The Redis MCP Server is a Model Content Protocol (MCP) server developed by Redis Labs. It provides a natural language interface for AI agent applications, enabling them to efficiently manage and search data within Redis. This project seamlessly integrates with MCP clients, supporting AI-driven workflows to interact with structured and unstructured data in Redis.
Project Repository: https://github.com/redis/mcp-redis
Core Features
🤖 Natural Language Queries
- Supports AI agents in querying and updating Redis data using natural language.
- Can handle natural language instructions such as "Store the entire conversation in a stream," "Cache this item," "Store the session with an expiration time," etc.
🔗 Seamless MCP Integration
- Compatible with any MCP client, enabling smooth communication.
- Supports both stdio and SSE transport protocols.
📊 Comprehensive Redis Support
Supports all major Redis data structures:
- String: Stores simple configuration values, session data, or cached responses.
- Hash: Stores field-value pairs, supporting vector embedding storage.
- List: Queues, message brokers, or maintaining a list of recent operations.
- Set: Tracks unique values, supporting set operations.
- Sorted Set: Leaderboards, priority queues, time-based analytics.
- Pub/Sub: Real-time notifications, chat applications, distributing updates.
- Streams: Event sourcing, activity feeds, sensor data logging.
- JSON: Complex nested data structures, document database.
🔍 Search and Filtering
- Supports efficient data retrieval and search.
- Vector index management and vector search capabilities.
- Query engine tools.
⚡ High Performance and Lightweight
- Designed for high-performance data operations.
- Scalable architecture.
Installation and Configuration
Environment Requirements
- Python 3.13+
- uv package manager
- Redis server
Installation Steps
# Clone the repository
git clone https://github.com/redis/mcp-redis.git
cd mcp-redis
# Install dependencies using uv
uv venv
source .venv/bin/activate
uv sync
Environment Variable Configuration
Variable Name | Description | Default Value |
---|---|---|
REDIS_HOST |
Redis IP or hostname | "127.0.0.1" |
REDIS_PORT |
Redis port | 6379 |
REDIS_USERNAME |
Database username | "default" |
REDIS_PWD |
Database password | "" |
REDIS_SSL |
Enable/disable SSL/TLS | False |
REDIS_CA_PATH |
CA certificate path | None |
REDIS_SSL_KEYFILE |
Client private key file | None |
REDIS_SSL_CERTFILE |
Client certificate file | None |
REDIS_CERT_REQS |
Whether to verify server certificate | "required" |
REDIS_CA_CERTS |
Path to trusted CA certificate file | None |
REDIS_CLUSTER_MODE |
Enable Redis cluster mode | False |
MCP_TRANSPORT |
Transport protocol (stdio/sse) | stdio |
Deployment Methods
1. Local Process (Default)
# Using stdio transport
uv run src/main.py
2. Network Service
# Set SSE transport
export MCP_TRANSPORT="sse"
uv run src/main.py
# Test the server
curl -i http://127.0.0.1:8000/sse
3. Docker Deployment
# Build the image
docker build -t mcp-redis .
# Run the container
docker run --rm --name redis-mcp-server -i \
-e REDIS_HOST=<redis_hostname> \
-e REDIS_PORT=<redis_port> \
-e REDIS_USERNAME=<redis_username> \
-e REDIS_PWD=<redis_password> \
mcp-redis
Integration Methods
Claude Desktop Integration
Edit the claude_desktop_config.json
file:
{
"mcpServers": {
"redis": {
"command": "<full path to uv command>",
"args": [
"--directory",
"<MCP server directory>",
"run",
"src/main.py"
],
"env": {
"REDIS_HOST": "<Redis hostname>",
"REDIS_PORT": "<Redis port>",
"REDIS_PWD": "<Redis password>",
"REDIS_SSL": true,
"REDIS_CA_PATH": "<CA certificate path>"
}
}
}
}
VS Code Integration
Enable proxy mode and configure mcp.json
:
{
"servers": {
"redis": {
"type": "stdio",
"command": "<full path to uv command>",
"args": [
"--directory",
"<MCP server directory>",
"run",
"src/main.py"
],
"env": {
"REDIS_HOST": "<Redis hostname>",
"REDIS_PORT": "<Redis port>",
"REDIS_USERNAME": "<Redis username>",
"REDIS_PWD": "<Redis password>"
}
}
}
}
OpenAI Agents SDK Integration
# Install the SDK
pip install openai-agents
# Configure the API key
export OPENAI_API_KEY="<openai_token>"
# Run the application
python3.13 redis_assistant.py
Automated Deployment (Smithery)
# Use Smithery to automatically configure Claude Desktop
npx -y @smithery/cli install @redis/mcp-redis --client claude
Use Cases
🤖 AI Assistants
- Enables large language models to access, store, and process data in Redis.
- Implements intelligent data management and querying.
💬 Chatbots and Virtual Agents
- Retrieve conversation data.
- Manage message queues.
- Personalize responses.
📈 Data Search and Analysis
- Real-time insight queries.
- Fast data lookup.
- Vector similarity search.
🔄 Event Processing
- Manage event streams using Redis Streams.
- Real-time data processing.
- Event sourcing.
Debugging and Troubleshooting
MCP Inspector
# Visual debugging
npx @modelcontextprotocol/inspector uv run src/main.py
Log Monitoring
# Monitor Claude logs
tail -f ~/Library/Logs/Claude/mcp-server-redis.log
OpenAI Dashboard
You can troubleshoot agent workflows through the OpenAI dashboard.
Development and Contribution
Contribution Process
- Fork the repository.
- Create a new branch (
feature-branch
). - Commit your changes.
- Push to the branch and submit a PR.
Technology Stack
- Language: Python 3.13+
- Package Management: uv
- Protocol: MCP (Model Content Protocol)
- Database: Redis
- Containerization: Docker
License and Support
- License: MIT License
- Technical Support: Get help through GitHub Issues
Summary
The Redis MCP Server is a powerful tool that bridges the gap between AI agents and Redis databases, enabling AI applications to manage and query data more intelligently through a natural language interface. Whether building intelligent assistants, chatbots, or performing real-time data analysis, this project provides a reliable and efficient solution.
Its modular design, rich support for Redis data structures, and multiple deployment methods make it suitable for a wide range of scenarios, from small projects to enterprise-level applications. Through integration with major platforms such as Claude, VS Code, and OpenAI, developers can easily incorporate the power of Redis into their AI-driven applications.