Skip to main content
Glama

MCP Server Redis

用法

结构如下:

mcp-server-redis/ ├── src/ │ ├── __init__.py │ ├── main.py # Main entry point │ ├── config.py # Configuration │ ├── connection.py # Redis connection management │ ├── resources/ # Resource implementations │ │ ├── __init__.py │ │ ├── status.py # Connection status resources │ │ └── keys.py # Key-related resources │ └── tools/ # Tool implementations │ ├── __init__.py │ ├── basic.py # Basic Redis operations │ ├── lists.py # List operations │ ├── hashes.py # Hash operations │ ├── sets.py # Set operations │ └── pubsub.py # Pub/Sub operations ├── tests/ # Test directory │ └── __init__.py ├── README.md └── pyproject.toml

要使用此服务器,您需要:

安装所需的依赖项:

[如果尚未安装] https://docs.astral.sh/uv/

uv venv

source .venv/bin/activate

uv sync

参考 .env.example 文件,通过添加适当的变量来配置您的 Redis 连接。

运行服务器:

python src/server.py

此服务器的功能

资源:

  • redis://status - 当前连接状态
  • redis://info——Redis 服务器信息
  • redis://keys/{pattern} - 列出与模式匹配的键

工具:

  • 基本操作:
    • get_value - 获取一个值
    • set_value - 设置可选到期值
    • delete_key——删除一个键
    • 增量 - 增加一个数值
  • 列表操作:
    • list_push - 将值推送到列表
    • list_range - 获取列表值的范围
  • 哈希操作:
    • hash_set - 设置哈希字段
    • hash_get - 获取哈希字段
  • 集合运算:
    • set_add-添加到集合
    • set_members - 获取集合成员
  • 发布/订阅:
    • publish_message - 发布消息

每个工具都包含错误处理功能并返回有意义的响应。如果连接丢失,服务器将自动重新连接到 Redis。

您可以使用 MCP 检查器进行测试: mcp dev src/server.py

或者在 Claude Desktop 中安装: mcp install src/server.py

例子

User: What's the current Redis connection status? LLM: Let me check the Redis connection status for you. [Reading resource redis://status] The Redis server is currently connected and running on localhost:6379, database 0. User: Can you store my name "Alice" in Redis? LLM: I'll help you store your name in Redis using the set_value tool. [Calling set_value with key="name" value="Alice"] Successfully set key 'name' I've stored your name "Alice" in Redis under the key "name". Would you like me to verify the value was stored correctly by retrieving it? User: Yes please verify it LLM: I'll retrieve the value using the get_value tool. [Calling get_value with key="name"] Alice Yes, I can confirm that your name "Alice" was successfully stored in Redis and can be retrieved correctly. The value matches exactly what we stored.

此实现为通过 MCP 集成 Redis 奠定了坚实的基础。您可以根据具体用例的需求,添加更多 Redis 命令来进一步扩展它。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

该服务器通过一组用于基本操作、列表、哈希、集合和发布/订阅功能的工具为 Claude 提供 Redis 数据库访问和操作。

  1. 此服务器的功能
    1. 例子

      Related MCP Servers

      • -
        security
        A
        license
        -
        quality
        Provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
        Last updated -
        73
        17
        JavaScript
        MIT License
        • Apple
        • Linux
      • A
        security
        A
        license
        A
        quality
        Enables users to perform Redis database operations using the Model Context Protocol (MCP) tools, allowing for efficient data management through commands like setting, getting, and scanning hash fields.
        Last updated -
        13
        29
        5
        TypeScript
        MIT License
      • A
        security
        A
        license
        A
        quality
        Connects Claude Desktop to Redmine for seamless project and issue management, including searching, creating, updating, and tracking tasks using Redmine's API.
        Last updated -
        5
        14
        Python
        Mozilla Public License 2.0
        • Apple
        • Linux
      • A
        security
        F
        license
        A
        quality
        A server that enables Claude Desktop users to access the Claude API directly, allowing them to bypass Professional Plan limitations and use advanced features like custom system prompts and conversation management.
        Last updated -
        1
        5
        Python
        • Apple

      View all related MCP servers

      MCP directory API

      We provide all the information about MCP servers via our MCP API.

      curl -X GET 'https://glama.ai/api/mcp/v1/servers/prajwalnayak7/mcp-server-redis'

      If you have feedback or need assistance with the MCP directory API, please join our Discord server