Skip to main content
Glama

Использование

Структура выглядит следующим образом:

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

Чтобы настроить соединение Redis, добавив соответствующие переменные, обратитесь к файлу .env.example.

Запустите сервер:

python src/server.py

Related MCP server: Code Analysis MCP Server

Возможности этого сервера

Ресурсы:

  • 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 Inspector: 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.

Эта реализация обеспечивает прочную основу для интеграции Redis через MCP. Вы можете расширить ее, добавив больше команд Redis по мере необходимости для вашего конкретного варианта использования.

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

Latest Blog Posts

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