Add your description here
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_redis-0.1.1.tar.gz.
File metadata
- Download URL: mcp_server_redis-0.1.1.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.26
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc642e9d1ac06a3eb068d51776b9bf0488167c0f1379fe3a57364ec513d3aec2
|
|
| MD5 |
80985fa7216df48f95cfc57206a50c87
|
|
| BLAKE2b-256 |
8c426bdac5ce9b2d706c704bc3ebda44604f407476f8a956ba5cc8429fc8297c
|
File details
Details for the file mcp_server_redis-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcp_server_redis-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.26
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3251728681637b97bf26e5d829fb1940c5bfc09d9afc3c9e1eada765a75f58c3
|
|
| MD5 |
471eadf10c5ebfbe335593a9236ff4c9
|
|
| BLAKE2b-256 |
7ead017477f5fb7ce3acae905c3f2bd52858c627ed20b8a1b3b9cb3dbfe526a0
|