mcp-server-redis: A Redis MCP Server
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
This repository is an example of how to create an MCP server for managing Redis data.
Overview
A Model Context Protocol server for interacting with Redis. It provides tools for setting, retrieving, listing, and deleting keys in Redis.
Components
Tools
The server implements the following tools:
-
set_value: Set a specified key to a given value- Takes a
key(string) and avalue(string) - Returns a confirmation message upon success
- Takes a
-
get_value: Retrieve the value of a specified key- Takes a
key(string) - Returns the value as a string, or
Noneif the key does not exist
- Takes a
-
list_keys: List Redis keys matching a given pattern- Takes a
pattern(default: "*") - Returns a list of matching keys
- Takes a
-
delete_key: Delete a specified key- Takes a
key(string) - Returns the number of keys deleted (0 or 1)
- Takes a
Configuration
The server connects to Redis using the following environment variables (all are required):
REDIS_HOST: Redis hostREDIS_PORT: Redis portREDIS_DB: Redis database numberREDIS_PASSWORD: Redis password
If any of these variables are missing, the server will raise an error during startup. Make sure to set each of these before running the server.
Quickstart
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"redis": {
"command": "uvx",
"args": [
"mcp-server-redis"
]
}
}
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory $(PWD) run mcp-server-redis
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Metadata
Release files for mcp-server-redis 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_server_redis-0.1.1.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_server_redis-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.7 kB
Release files / mcp_server_redis-0.1.1.tar.gz
| Download URL | mcp_server_redis-0.1.1.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc642e9d1ac06a3eb068d51776b9bf0488167c0f1379fe3a57364ec513d3aec2
|
|
BLAKE2b-256 checksum How to use checksums |
8c426bdac5ce9b2d706c704bc3ebda44604f407476f8a956ba5cc8429fc8297c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.26
|
Release files / mcp_server_redis-0.1.1-py3-none-any.whl
| Download URL | mcp_server_redis-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3251728681637b97bf26e5d829fb1940c5bfc09d9afc3c9e1eada765a75f58c3
|
|
BLAKE2b-256 checksum How to use checksums |
7ead017477f5fb7ce3acae905c3f2bd52858c627ed20b8a1b3b9cb3dbfe526a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.26
|