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
適切な変数を追加して Redis 接続を構成するには、.env.example ファイルを参照してください。
サーバーを実行します。
python src/server.py
Related MCP server: MCP Database 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.この実装は、MCP を介した Redis 統合のための強固な基盤を提供します。特定のユースケースに合わせて、必要に応じて Redis コマンドを追加することで、さらに拡張できます。
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Marketo MCP server for AI. 130 tools to operate Marketo from Claude, Cursor, or ChatGPT.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server giving Claude AI access to 22+ NYC public-record databases for real estate due diligence
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceProvides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.166 npm30MIT
- AlicenseNot gradedqualityDmaintenanceThis server provides database access capabilities to Claude, supporting SQLite, SQL Server, PostgreSQL, and MySQL databases.1,009 npmMIT
- AlicenseNot gradedqualityDmaintenanceThis server provides database access capabilities to Claude, supporting SQLite, SQL Server, PostgreSQL, and MySQL databases.1,009 npmMIT
- AlicenseBqualityDmaintenanceEnables AI assistants to perform comprehensive Redis database operations including managing strings, hashes, lists, sets, sorted sets, TTL management, and data backup/restore. Supports secure connections and provides batch operations for efficient Redis interaction through natural language.3414 npm2MIT