Cover image
Try Now
2025-04-03

REDIS MCP服务器 - 使用Docker实施Python

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

Redis MCP Server

A professional implementation of a Redis server with MCP (Model Control Protocol) integration, containerized with Docker.

Features

  • Redis server with persistence
  • MCP server integration for Redis operations
  • Docker and Docker Compose support
  • Comprehensive error handling and logging
  • Environment-based configuration
  • Health checks for Redis service

Prerequisites

  • Docker
  • Docker Compose

Quick Start

  1. Clone the repository:
git clone https://github.com/cbuitragoh/customRedis.git
cd customredis
  1. Start the services:
docker-compose up -d
  1. Check the logs:
docker-compose logs -f

Available Redis Operations

The MCP server provides the following Redis operations:

  • set_redis_key(key: str, value: str): Set a key-value pair
  • get_redis_key(key: str): Retrieve a value by key
  • delete_redis_key(key: str): Delete a key
  • list_redis_keys(pattern: str = '*'): List all keys matching a pattern

Configuration

The application can be configured through environment variables:

  • REDIS_HOST: Redis server host (default: redis)
  • REDIS_PORT: Redis server port (default: 6379)
  • REDIS_DB: Redis database number (default: 0)
  • LOG_LEVEL: Logging level (default: INFO)

Development

Local Development

  1. Create a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the server:
python src/server.py

Docker Development

  1. Build the image:
docker-compose build
  1. Run the services:
docker-compose up

Project Structure

.
├── src/
│   └── server.py      # Main server implementation
├── Dockerfile         # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── requirements.txt   # Python dependencies
├── .env              # Environment variables
└── README.md         # This file

Error Handling

The application includes comprehensive error handling:

  • Connection errors
  • Redis operation errors
  • Server startup/shutdown errors
  • Graceful shutdown on keyboard interrupt

Logging

The application uses Python's logging module with the following features:

  • Timestamp-based log entries
  • Different log levels (INFO, WARNING, ERROR)
  • Detailed error messages
  • Operation success/failure logging

Using with Claude Desktop

To use this Redis MCP server with Claude Desktop, add the following configuration to your Claude Desktop settings:

{
  "mcpServers": {
    "redis": {
            "command": "docker",
            "args": [
                "run", 
                "-i",
                "--rm",
                "--network",
                "customredis_redis-network",
                "customredis-mcp-server"]
    }
  }
}

This configuration:

  • Uses Docker to run the Redis MCP server
  • Connects to Redis using the host machine's Redis instance
  • Runs in interactive mode (-i)
  • Removes the container after use (--rm)
  • Connect the MCP server to same network to Redis container

Make sure:

  1. Redis is running in container from docker-compose redis service
  2. The Redis port (6379) is accessible
  3. Docker is running on your system

License

MIT License

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

    Reviews

    1 (1)
    Avatar
    user_EvekbxXc
    2025-04-16

    CustomRedis by cbuitragoh is an incredible tool for anyone working with Redis. The customization options provided are extensive and cater to a wide array of use cases. The documentation is thorough, making it easy to get started even for newcomers. The community around the product is also active and supportive. Highly recommend checking it out at https://github.com/cbuitragoh/customRedis!