Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-server-redis

MCP.Pizza Chef: prajwalnayak7

mcp-server-redis is an MCP server that enables interaction with Redis Server, AWS MemoryDB, and similar in-memory key-value stores. It supports caching and other use cases requiring fast, ephemeral data storage. The server provides structured access to Redis features including basic operations, lists, hashes, sets, and pub/sub messaging, making it ideal for real-time data workflows and ephemeral context management in AI-enhanced applications.

Use This MCP server To

Cache API responses for faster retrieval Store session data for web applications Manage real-time pub/sub messaging workflows Maintain ephemeral state for AI agents Perform fast key-value lookups in workflows Implement rate limiting using Redis counters Store and query hash and set data structures Monitor Redis connection status and health

README

MseeP.ai Security Assessment Badge

Usage

The structure is as follows:

mcp-server-redis/
├── src/
│   ├── __init__.py
│   ├── main.py           # Main entry point
│   ├── config.py         # Configuration
│   ├── connection.py     # Redis connection management
│   ├── resources/        # Resource implementations
│   │   ├── __init__.py
│   │   ├── status.py     # Connection status resources
│   │   └── keys.py       # Key-related resources
│   └── tools/           # Tool implementations
│       ├── __init__.py
│       ├── basic.py     # Basic Redis operations
│       ├── lists.py     # List operations
│       ├── hashes.py    # Hash operations
│       ├── sets.py      # Set operations
│       └── pubsub.py    # Pub/Sub operations
├── tests/              # Test directory
│   └── __init__.py
├── README.md
└── pyproject.toml

To use this server, you'll need to:

Install the required dependencies:

[If not already installed] https://docs.astral.sh/uv/

uv venv

source .venv/bin/activate

uv sync

Refer to the .env.example file to configure your Redis connection by adding the appropriate variables.

Run the server:

python src/server.py

Capabilities of this server

Resources:

  • redis://status - Current connection status
  • redis://info - Redis server information
  • redis://keys/{pattern} - List keys matching a pattern

Tools:

  • Basic operations:
    • get_value - Get a value
    • set_value - Set a value with optional expiry
    • delete_key - Delete a key
    • increment - Increment a numeric value
  • List operations:
    • list_push - Push values to a list
    • list_range - Get range of list values
  • Hash operations:
    • hash_set - Set hash fields
    • hash_get - Get hash fields
  • Set operations:
    • set_add - Add to a set
    • set_members - Get set members
  • Pub/Sub:
    • publish_message - Publish a message

Each tool includes error handling and returns meaningful responses. The server will automatically reconnect to Redis if the connection is lost.

You can test it with the MCP Inspector: mcp dev src/server.py

Or install it in Claude Desktop: mcp install src/server.py

Example

User: What's the current Redis connection status?
LLM: Let me check the Redis connection status for you.

[Reading resource redis://status]

The Redis server is currently connected and running on localhost:6379, database 0.

User: Can you store my name "Alice" in Redis?
LLM: I'll help you store your name in Redis using the set_value tool.

[Calling set_value with key="name" value="Alice"]
Successfully set key 'name'

I've stored your name "Alice" in Redis under the key "name". Would you like me to verify the value was stored correctly by retrieving it?

User: Yes please verify it
LLM: I'll retrieve the value using the get_value tool.

[Calling get_value with key="name"]
Alice

Yes, I can confirm that your name "Alice" was successfully stored in Redis and can be retrieved correctly. The value matches exactly what we stored.

This implementation provides a solid foundation for Redis integration through MCP. You can extend it further by adding more Redis commands as needed for your specific use case.

mcp-server-redis FAQ

How do I configure mcp-server-redis to connect to my Redis instance?
Configure connection details in the config.py file or environment variables to point to your Redis or AWS MemoryDB endpoint.
Can mcp-server-redis handle Redis pub/sub messaging?
Yes, it includes pub/sub tools to subscribe and publish messages for real-time communication.
What Redis data structures are supported by mcp-server-redis?
It supports basic key-value operations, lists, hashes, sets, and pub/sub features.
Is mcp-server-redis suitable for caching in AI workflows?
Absolutely, it provides fast in-memory caching ideal for ephemeral context storage in AI applications.
How does mcp-server-redis handle connection health monitoring?
It includes resources to check and report Redis connection status and health.
Can I use mcp-server-redis with AWS MemoryDB?
Yes, it supports AWS MemoryDB as a compatible Redis in-memory key-value store.
What programming languages or frameworks is mcp-server-redis compatible with?
It is a Python-based MCP server but can be integrated with any system that supports MCP protocol clients.
How secure is the connection to Redis when using mcp-server-redis?
Security depends on your Redis setup; mcp-server-redis supports standard Redis authentication and TLS if configured.