Skip to main content
Version: 0.0.1

Getting Started with Redis Message Queue Backend

This guide will walk you through installing and using the Redis message queue backend for the Slack MCP Server. In just a few minutes, you'll have a working Redis-based event processing system.

What You'll Get

By following this guide, you'll have:

Redis Backend Installed: Ready-to-use Redis message queue backend
Slack MCP Integration: Seamless integration with Slack MCP Server
Event Processing: Ability to publish and consume Slack events via Redis
Production Ready: Scalable solution with consumer groups and acknowledgments
Working Examples: Sample code to get started quickly

5-Minute Quick Start

Step 1: Install Redis

Install and start a Redis server using Docker (recommended) or native installation:

Using Docker (Recommended):

docker run -d --name redis-mcp -p 6379:6379 redis:7-alpine

Or install natively:

  • macOS: brew install redis && brew services start redis
  • Ubuntu/Debian: sudo apt install redis-server && sudo systemctl start redis
  • Windows: Use Redis for Windows

Step 2: Install the Redis Backend

pip install abe-redis

Step 3: Configure Environment

export QUEUE_BACKEND=redis
export REDIS_URL=redis://localhost:6379/0

Step 4: Use with Slack MCP Server

# The Slack MCP Server will automatically discover and use the Redis backend
python -m slack_mcp_server

That's it! Your Slack MCP Server is now using Redis for event processing.

Basic Usage Examples

Publishing Events

import asyncio
from slack_mcp_plugin.backends.queue import RedisMessageQueueBackend

async def publish_example():
# Create backend from environment variables
backend = RedisMessageQueueBackend.from_env()

# Publish a Slack event
event = {
"type": "message",
"channel": "C123456",
"user": "U123456",
"text": "Hello from Redis!",
}

await backend.publish("slack:events", event)
await backend.close()

asyncio.run(publish_example())

Consuming Events (Simple Mode)

import asyncio
from slack_mcp_plugin.backends.queue import RedisMessageQueueBackend

async def consume_example():
backend = RedisMessageQueueBackend.from_env()

# Consume messages from all slack:* streams
async for message in backend.consume():
print(f"Received: {message}")
# Process your event here

# Break after processing some messages (for demo)
break

await backend.close()

asyncio.run(consume_example())

Consuming with Consumer Groups (Distributed Mode)

import asyncio
from slack_mcp_plugin.backends.queue import RedisMessageQueueBackend

async def distributed_consumer(worker_id: int):
backend = RedisMessageQueueBackend.from_env()

# Multiple workers can share the workload using consumer groups
async for message in backend.consume(group="slack-workers"):
print(f"Worker {worker_id} processing: {message}")
# Process event
await asyncio.sleep(1) # Simulate work

await backend.close()

# Run multiple workers
asyncio.gather(
distributed_consumer(1),
distributed_consumer(2),
distributed_consumer(3),
)

Configuration Options

Environment Variables

The Redis backend supports the following environment variables:

VariableRequiredDefaultDescription
REDIS_URLYesredis://localhost:6379/0Redis connection URL
REDIS_PASSWORDNoNoneRedis authentication password
REDIS_SSLNofalseEnable SSL/TLS connection
REDIS_MAX_CONNECTIONSNo10Maximum connection pool size
REDIS_STREAM_MAXLENNo10000Maximum stream length for trimming
QUEUE_BACKENDYes-Must be set to redis

Example Configurations

Development (Local Redis)

export QUEUE_BACKEND=redis
export REDIS_URL=redis://localhost:6379/0

Production (Secure Redis)

export QUEUE_BACKEND=redis
export REDIS_URL=redis://prod-redis.example.com:6379/0
export REDIS_PASSWORD=your_secure_password
export REDIS_SSL=true
export REDIS_MAX_CONNECTIONS=20
export REDIS_STREAM_MAXLEN=50000

Running the Example

The project includes a comprehensive example demonstrating all features:

# Clone the repository (if contributing/developing)
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 .

# Run the example (ensure Redis is running)
python examples/basic_usage.py

The example demonstrates:

  • Publishing messages to Redis streams
  • Simple consumption without consumer groups
  • Distributed consumption with consumer groups
  • Combined publish/consume patterns

Next Steps

Now that you have the basics:

  1. 📋 Requirements - Detailed system requirements
  2. 🛠️ Installation - Advanced installation options
  3. 📚 API Reference - Complete API documentation

Troubleshooting

Redis Connection Issues

Problem: ConnectionError: Unable to connect to Redis

Solutions:

  • Verify Redis is running: redis-cli ping (should return PONG)
  • Check REDIS_URL format: redis://host:port/db
  • Verify network connectivity and firewall rules

Import Errors

Problem: ModuleNotFoundError: No module named 'slack_mcp_plugin'

Solution:

pip install --upgrade abe-redis

Consumer Not Receiving Messages

Problem: Consumer runs but doesn't receive messages

Solutions:

  • Verify messages are being published to streams matching slack:* pattern
  • Check Redis streams: redis-cli XINFO STREAM slack:events
  • Ensure consumer group is created properly

For more help, visit our GitHub Issues.