Skip to main content

Redis MCP Server

A Model Context Protocol (MCP) server for Redis operations built with FastMCP.

Features

  • Core Redis operations: get, set, delete, list
  • Bulk operations: mget, mset
  • Pattern-based key scanning
  • Connection pooling for efficient Redis access
  • Multiple transport support (stdio, SSE, streamable-http)
  • Environment-based configuration
  • Type hints and comprehensive error handling

Installation

From PyPI

pip install redis-mcp

Or using uv:

uv tool install redis-mcp

From Source

# Clone the repository
git clone https://github.com/yourusername/redis-mcp.git
cd redis-mcp

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install the package
pip install -e .

Configuration

The server can be configured via environment variables:

  • REDIS_HOST: Redis server hostname (default: localhost)
  • REDIS_PORT: Redis server port (default: 6379)
  • REDIS_DB: Redis database number (default: 0)
  • REDIS_PASSWORD: Redis password (optional)
  • REDIS_USERNAME: Redis username (optional)

Usage

As a CLI Tool

# Using stdio transport (default)
redis-mcp

# Using SSE transport
redis-mcp --transport sse

# With custom Redis connection
redis-mcp --host redis.example.com --port 6380 --db 1

In Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "redis": {
      "command": "uvx",
      "args": ["redis-mcp"],
      "env": {
        "REDIS_HOST": "localhost",
        "REDIS_PORT": "6379"
      }
    }
  }
}

Available Tools

  • get: Retrieve a value by key
  • set: Store a key-value pair with optional expiry and conditions
  • delete: Remove one or more keys
  • list: List keys matching a pattern
  • mget: Get multiple values in one operation
  • mset: Set multiple key-value pairs in one operation
  • scan: Iterate through keys matching a pattern without blocking

Example Usage

from fastmcp import Client

async def main():
    async with Client("http://localhost:8000/sse") as client:
        # Set a value
        await client.call_tool("set", {"key": "user:123", "value": "John Doe"})
        
        # Get a value
        result = await client.call_tool("get", {"key": "user:123"})
        print(result)  # "John Doe"
        
        # List keys
        keys = await client.call_tool("list", {"pattern": "user:*"})
        print(keys)  # ["user:123"]

Development

Setup

# Install development dependencies
pip install -e ".[dev]"

Running Tests

pytest

Code Quality

# Format code
black .
isort .

# Type checking
mypy .

# Linting
ruff check .

Requirements

  • Python 3.10+
  • Redis server
  • FastMCP 2.3.3+

License

MIT

Release files for redis-mcp 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redis-mcp 0.1.3
File Size Uploaded
redis_mcp-0.1.3.tar.gz 41.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redis-mcp 0.1.3
File Interpreter ABI Platform
redis_mcp-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / redis_mcp-0.1.3.tar.gz

Download URL redis_mcp-0.1.3.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
43fd25e67243f4b8d9efbd0077aff586373189aced8eaf76ee408292c17cdadb
BLAKE2b-256 checksum
How to use checksums
5fb68a6eb59d89878ae279a39fd108c7e77995ce7b8b6873ec3e46e8052c8f6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / redis_mcp-0.1.3-py3-none-any.whl

Download URL redis_mcp-0.1.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee0e8b430644f36843848c6a02e2cd804b8c24e5b8033ff12a4d464c33118d90
BLAKE2b-256 checksum
How to use checksums
8579ab351b42f9b741ea641b2e79969b0313868a6e552ddd4b2e8f6b234d9406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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