MCP Server Redis

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Supports configuration via environment variables using .env files to set up Redis connection parameters.

  • Provides tools for interacting with Redis databases, including basic operations (get, set, delete, increment), list operations, hash operations, set operations, and pub/sub functionality, with automatic reconnection handling.

용법

구조는 다음과 같습니다.

지엑스피1

이 서버를 사용하려면 다음이 필요합니다.

필요한 종속성을 설치하세요:

[아직 설치되지 않은 경우] https://docs.astral.sh/uv/

uv venv

source .venv/bin/activate

uv sync

적절한 변수를 추가하여 Redis 연결을 구성하려면 .env.example 파일을 참조하세요.

서버를 실행합니다:

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 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.

이 구현은 MCP를 통한 Redis 통합을 위한 견고한 기반을 제공합니다. 특정 사용 사례에 따라 필요에 따라 Redis 명령을 추가하여 더욱 확장할 수 있습니다.

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

클로드에게 기본 작업, 목록, 해시, 세트 및 pub/sub 기능을 위한 도구 세트를 통해 Redis 데이터베이스에 대한 접근과 작업을 제공하는 서버입니다.

  1. Capabilities of this server
    1. Example
      ID: 5ydzwgd6w0