How redis/mcp-redis works
Project Type and Purpose
• This is an open-source Python MCP Server that provides a natural-language interface to Redis for AI agents.
• Purpose: let MCP clients (OpenAI Agents SDK, Claude Desktop, VS Code, etc.) issue natural-language commands which are translated into Redis operations on strings, hashes, lists, sets, sorted sets, streams, JSON, vector indexes, pub/sub, and server management.
File Structure
• Top-level: Dockerfile/.dockerignore, pyproject.toml, uv.lock, smithery.yaml, README.md, LICENSE
• src/
• common/
• config.py: loads environment variables (REDIS_HOST, MCP_TRANSPORT, etc.)
• connection.py: sets up Redis client (single node or cluster)
• server.py: initializes and runs the MCP protocol server (stdio or SSE)
• tools/
• hash.py, list.py, set.py, sorted_set.py, stream.py, pub_sub.py, json.py, redis_query_engine.py, server_management.py, misc.py
• Each module implements one category of Redis commands and exposes them as MCP “tools.”
• main.py: entry point—discovers tools, registers them, starts the server loop
• version.py
README for Additional Insights
• Transport options: stdio (default) or sse (HTTP SSE endpoint at /sse).
• Deployment: local CLI via uv run, Docker image (Dockerfile), or official mcp/redis image.
• Integration points: OpenAI Agents SDK, Claude Desktop, VS Code extension.
• Configurable via ENV vars for Redis connection, SSL, cluster mode, and transport.
Elements
• Clear Labels: name each component (e.g., “Transport (stdio/SSE)”, “Tool: hash”, “Redis Cluster”)
• Blue rectangles for protocol/transport layers
• Green rectangles for tool handlers
Detail Level
• Individual tool categories or group by function (data structures, pub/sub, search).