MCP Server Redis
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Supports configuration via environment variables using .env files to set up Redis connection parameters.
Provides tools for interacting with Redis databases, including basic operations (get, set, delete, increment), list operations, hash operations, set operations, and pub/sub functionality, with automatic reconnection handling.
Usage
The structure is as follows:
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
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.
This server cannot be installed
A server that provides Claude with Redis database access and operations through a set of tools for basic operations, lists, hashes, sets, and pub/sub functionality.