Skip to main content

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.

PyPI version

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 a value (string)
    • Returns a confirmation message upon success
  • get_value: Retrieve the value of a specified key

    • Takes a key (string)
    • Returns the value as a string, or None if the key does not exist
  • list_keys: List Redis keys matching a given pattern

    • Takes a pattern (default: "*")
    • Returns a list of matching keys
  • delete_key: Delete a specified key

    • Takes a key (string)
    • Returns the number of keys deleted (0 or 1)

Configuration

The server connects to Redis using the following environment variables (all are required):

  • REDIS_HOST: Redis host
  • REDIS_PORT: Redis port
  • REDIS_DB: Redis database number
  • REDIS_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:

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:
uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --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)

Source distribution for mcp-server-redis 0.1.1
File Size Uploaded
mcp_server_redis-0.1.1.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-server-redis 0.1.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page