Skip to main content
Version: Next

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:

# 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

Step 2: Install Python Package

Install the Redis backend package using your preferred package manager:

# Install from PyPI
pip install abe-redis

# Verify installation
pip show abe-redis

Step 3: Configure Environment Variables

Set up the required environment variables for the Redis backend:

# 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

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:

  1. Redis Configuration:

    # Enable persistence
    redis-server --appendonly yes --appendfsync everysec

    # Set password
    redis-server --requirepass your_secure_password
  2. 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
  3. 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:

  1. 🚀 Quick Start Guide - Learn usage patterns and examples
  2. 📚 API Reference - Explore the complete API
  3. 🤝 Contributing - Help improve the Redis backend

Ready to start using the Redis backend? Check out the Quick Start Guide for usage examples!