Skip to main content

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_redis-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_redis-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

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

Hashes for mcp_server_redis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bc642e9d1ac06a3eb068d51776b9bf0488167c0f1379fe3a57364ec513d3aec2
MD5 80985fa7216df48f95cfc57206a50c87
BLAKE2b-256 8c426bdac5ce9b2d706c704bc3ebda44604f407476f8a956ba5cc8429fc8297c

See more details on using hashes here.

File details

Details for the file mcp_server_redis-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_redis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3251728681637b97bf26e5d829fb1940c5bfc09d9afc3c9e1eada765a75f58c3
MD5 471eadf10c5ebfbe335593a9236ff4c9
BLAKE2b-256 7ead017477f5fb7ce3acae905c3f2bd52858c627ed20b8a1b3b9cb3dbfe526a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page