mcp-data-redis-interface
Utility for engaging with a Redis instance to manage data persistence and transient storage, encompassing fundamental commands for keys, ordered sequences, mappings, unique collections, and message broadcasting.
Author

prajwalnayak7
Quick Info
Actions
Tags
Security Audit
Operational Structure
The system architecture is organized as follows:
mcp-data-redis-interface/ ├── source_code/ │ ├── init.py │ ├── entrypoint.py # Primary execution locus │ ├── configuration.py # Parameter setup │ ├── linkage.py # Management of Redis connections │ ├── modules/ │ │ ├── init.py │ │ ├── health.py # Resources reporting connectivity status │ │ └── keys_mgmt.py # Resources for key manipulation │ └── tools/ │ ├── init.py │ ├── core_ops.py # Essential Redis interactions │ ├── streams.py # Operations involving lists/sequences │ ├── dictionaries.py # Operations for hash structures │ ├── unique_sets.py # Operations on set data types │ └── broadcaster.py # Publish/Subscribe functionality ├── tests_suite/ │ └── init.py ├── documentation.md └── project_manifest.toml
To deploy this service, adhere to these prerequisites:
Install necessary package dependencies:
[If environment setup is pending] Consult https://docs.astral.sh/uv/
Initialize virtual environment:
uv venv
Activate environment shell:
source .venv/bin/activate
Fetch dependencies:
uv sync
Configure Redis credentials by populating environment variables as detailed in the .env.example template.
Initiate the service process:
python source_code/entrypoint.py
Service Endpoints & Actions
Exposed Resources (Queryable Endpoints):
- redis://status - Reports current connection health
- redis://info - Retrieves metadata about the Redis instance
- redis://keys/{pattern} - Fetches keys matching a specified wildcard pattern
Available Tools (Executable Actions):
- Fundamental Operations:
- get_value - Retrieve data associated with a key
- set_value - Persist data to a key, optionally setting an expiration time (TTL)
- delete_key - Erase a specified key
- increment - Atomically boost the value of a numeric key
- Sequence Operations:
- list_push - Append elements to a list structure
- list_range - Extract a sub-segment of elements from a list
- Mapping Operations:
- hash_set - Write or update field-value pairs within a hash
- hash_get - Fetch specific fields or all fields from a hash
- Uniqueness Operations:
- set_add - Introduce a unique element into a set
- set_members - List all elements contained within a set
- Messaging:
- publish_message - Broadcast data to subscribed channels
Robust exception management is integrated into every tool, ensuring informative feedback. The server module is designed for automatic re-establishment of the Redis link upon connection failure.
Testing is easily managed via the MCP Inspector:
mcp dev source_code/entrypoint.py
Or for deployment within a specific environment:
mcp install source_code/entrypoint.py
Illustrative Scenario
User: I need to know the operational status of the Redis connection. LLM: Checking the current connection state of the Redis backend for you.
[Consulting resource redis://status]
The persistent data store is confirmed online and operational, binding to localhost:6379 on database index 0.
User: Please secure my identifier "Alice" within Redis. LLM: I will utilize the set_value utility to persist "Alice" under the key "name" in Redis.
[Executing set_value with key="name" value="Alice" ] Key 'name' successfully written.
Your identifier "Alice" has been saved in Redis under the key "name". Shall I confirm the integrity of this storage by retrieving the data immediately?
User: Affirmative, perform the verification retrieval. LLM: Initiating data retrieval via the get_value tool.
[Calling get_value with key="name" ] Alice
I confirm the storage operation was successful; the retrieved data matches the input value "Alice" precisely.

