Installing Redis Message Queue Backend
This guide provides step-by-step instructions for installing and configuring the Redis message queue backend for Slack MCP Server.
Step 1: Install Redis Server
First, you need a running Redis server. Choose the method that best fits your environment:
- Docker (Recommended)
- macOS
- Ubuntu/Debian
- Windows
# Pull and run Redis 7
docker run -d \
--name redis-mcp \
-p 6379:6379 \
redis:7-alpine
# Verify it's running
docker ps | grep redis-mcp
# Test connection
docker exec redis-mcp redis-cli ping
# Install Redis using Homebrew
brew install redis
# Start Redis service
brew services start redis
# Verify it's running
redis-cli ping # Should return "PONG"
# Update package list
sudo apt update
# Install Redis
sudo apt install redis-server
# Start Redis service
sudo systemctl start redis-server
sudo systemctl enable redis-server
# Verify it's running
redis-cli ping # Should return "PONG"
Option 1: Docker (Recommended)
docker run -d --name redis-mcp -p 6379:6379 redis:7-alpine
Option 2: Native Installation
- Download Redis from GitHub Releases
- Extract and run
redis-server.exe
- Test with
redis-cli.exe ping
Step 2: Install Python Package
Install the Redis backend package using your preferred package manager:
- pip
- uv
- poetry
# Install from PyPI
pip install abe-redis
# Verify installation
pip show abe-redis
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install the package
uv pip install abe-redis
# Verify installation
uv pip show abe-redis
# Add to your project
poetry add abe-redis
# Verify installation
poetry show abe-redis
Step 3: Configure Environment Variables
Set up the required environment variables for the Redis backend:
- Bash/Zsh
- Fish
- Windows PowerShell
- .env File
# Required: Set backend type
export QUEUE_BACKEND=redis
# Required: Redis connection URL
export REDIS_URL=redis://localhost:6379/0
# Optional: Redis password (if authentication is enabled)
export REDIS_PASSWORD=your_password
# Optional: Enable SSL/TLS
export REDIS_SSL=true
# Optional: Connection pool size
export REDIS_MAX_CONNECTIONS=10
# Optional: Stream max length
export REDIS_STREAM_MAXLEN=10000
Persist in ~/.bashrc or ~/.zshrc:
echo 'export QUEUE_BACKEND=redis' >> ~/.bashrc
echo 'export REDIS_URL=redis://localhost:6379/0' >> ~/.bashrc
source ~/.bashrc
# Required
set -x QUEUE_BACKEND redis
set -x REDIS_URL redis://localhost:6379/0
# Optional
set -x REDIS_PASSWORD your_password
set -x REDIS_SSL true
Persist in ~/.config/fish/config.fish:
echo 'set -x QUEUE_BACKEND redis' >> ~/.config/fish/config.fish
echo 'set -x REDIS_URL redis://localhost:6379/0' >> ~/.config/fish/config.fish
# Required
$env:QUEUE_BACKEND = "redis"
$env:REDIS_URL = "redis://localhost:6379/0"
# Optional
$env:REDIS_PASSWORD = "your_password"
$env:REDIS_SSL = "true"
Persist (run as Administrator):
[System.Environment]::SetEnvironmentVariable("QUEUE_BACKEND", "redis", "User")
[System.Environment]::SetEnvironmentVariable("REDIS_URL", "redis://localhost:6379/0", "User")
Create a .env
file in your project root:
# .env
QUEUE_BACKEND=redis
REDIS_URL=redis://localhost:6379/0
REDIS_PASSWORD=your_password
REDIS_SSL=false
REDIS_MAX_CONNECTIONS=10
REDIS_STREAM_MAXLEN=10000
Load it in your Python code:
from dotenv import load_dotenv
load_dotenv()
Step 4: Verify Installation
Test that everything is working correctly:
# test_redis_backend.py
import asyncio
from slack_mcp_plugin.backends.queue import RedisMessageQueueBackend
async def test_connection():
# Create backend from environment
backend = RedisMessageQueueBackend.from_env()
# Test publish
await backend.publish("slack:test", {"message": "Hello Redis!"})
print("✅ Successfully published message")
# Test consume
async for message in backend.consume():
print(f"✅ Successfully consumed message: {message}")
break
await backend.close()
print("✅ Connection closed successfully")
if __name__ == "__main__":
asyncio.run(test_connection())
Run the test:
python test_redis_backend.py
Expected output:
✅ Successfully published message
✅ Successfully consumed message: {'message': 'Hello Redis!'}
✅ Connection closed successfully
Advanced Installation Options
Installing from Source (For Development)
If you want to contribute or modify the Redis backend:
# Clone the repository
git clone https://github.com/Chisanan232/MCP-BackEnd-Message-Queue-Redis.git
cd MCP-BackEnd-Message-Queue-Redis
# Install in editable mode
pip install -e .
# Or with development dependencies
pip install -e ".[dev]"
Production Deployment
For production environments, consider:
-
Redis Configuration:
# Enable persistence
redis-server --appendonly yes --appendfsync everysec
# Set password
redis-server --requirepass your_secure_password -
Environment Variables:
export REDIS_URL=redis://prod-redis.example.com:6379/0
export REDIS_PASSWORD=your_secure_password
export REDIS_SSL=true
export REDIS_MAX_CONNECTIONS=50
export REDIS_STREAM_MAXLEN=100000 -
Monitoring:
# Monitor Redis performance
redis-cli --stat
# Check stream info
redis-cli XINFO STREAM slack:events
Troubleshooting Installation
Package Installation Fails
Problem: pip install
fails with dependency errors
Solution:
# Upgrade pip
python -m pip install --upgrade pip
# Try installing with --no-cache-dir
pip install --no-cache-dir abe-redis
# Or use a virtual environment
python -m venv venv
source venv/bin/activate
pip install abe-redis
Redis Connection Refused
Problem: ConnectionError: Error connecting to Redis
Solutions:
# Check if Redis is running
redis-cli ping
# Check Redis port
netstat -an | grep 6379
# Verify REDIS_URL format
echo $REDIS_URL # Should be redis://host:port/db
# Test connection manually
redis-cli -h localhost -p 6379 ping
Import Errors
Problem: ModuleNotFoundError: No module named 'slack_mcp_plugin'
Solution:
# Reinstall the package
pip uninstall abe-redis
pip install abe-redis
# Verify Python path
python -c "import sys; print('\n'.join(sys.path))"
Next Steps
Now that you have the Redis backend installed:
- 🚀 Quick Start Guide - Learn usage patterns and examples
- 📚 API Reference - Explore the complete API
- 🤝 Contributing - Help improve the Redis backend
Ready to start using the Redis backend? Check out the Quick Start Guide for usage examples!