|
| 1 | +# Redis MCP Server Extension |
| 2 | + |
| 3 | +This extension provides a natural language interface for managing and searching data in Redis through the Model Context Protocol (MCP). |
| 4 | + |
| 5 | +## What this extension provides |
| 6 | + |
| 7 | +The Redis MCP Server enables AI agents to efficiently interact with Redis databases using natural language commands. You can: |
| 8 | + |
| 9 | +- **Store and retrieve data**: Cache items, store session data, manage configuration values |
| 10 | +- **Work with data structures**: Manage hashes, lists, sets, sorted sets, and streams |
| 11 | +- **Search and filter**: Perform efficient data retrieval and searching operations |
| 12 | +- **Pub/Sub messaging**: Publish and subscribe to real-time message channels |
| 13 | +- **JSON operations**: Store, retrieve, and manipulate JSON documents |
| 14 | +- **Vector search**: Manage vector indexes and perform similarity searches |
| 15 | + |
| 16 | +## Available Tools |
| 17 | + |
| 18 | +### String Operations |
| 19 | +- Set, get, and manage string values with optional expiration |
| 20 | +- Useful for caching, session data, and simple configuration |
| 21 | + |
| 22 | +### Hash Operations |
| 23 | +- Store field-value pairs within a single key |
| 24 | +- Support for vector embeddings storage |
| 25 | +- Ideal for user profiles, product information, and structured objects |
| 26 | + |
| 27 | +### List Operations |
| 28 | +- Append, pop, and manage list items |
| 29 | +- Perfect for queues, message brokers, and activity logs |
| 30 | + |
| 31 | +### Set Operations |
| 32 | +- Add, remove, and list unique set members |
| 33 | +- Perform set operations like intersection and union |
| 34 | +- Great for tracking unique values and tags |
| 35 | + |
| 36 | +### Sorted Set Operations |
| 37 | +- Manage score-based ordered data |
| 38 | +- Ideal for leaderboards, priority queues, and time-based analytics |
| 39 | + |
| 40 | +### Pub/Sub Operations |
| 41 | +- Publish messages to channels and subscribe to receive them |
| 42 | +- Real-time notifications and chat applications |
| 43 | + |
| 44 | +### Stream Operations |
| 45 | +- Add, read, and delete from data streams |
| 46 | +- Event sourcing, activity feeds, and sensor data logging |
| 47 | + |
| 48 | +### JSON Operations |
| 49 | +- Store, retrieve, and manipulate JSON documents |
| 50 | +- Complex nested data structures with path-based access |
| 51 | + |
| 52 | +### Vector Search |
| 53 | +- Manage vector indexes and perform similarity searches |
| 54 | +- AI/ML applications and semantic search |
| 55 | + |
| 56 | +### Server Management |
| 57 | +- Retrieve database information and statistics |
| 58 | +- Monitor Redis server status and performance |
| 59 | + |
| 60 | +## Usage Examples |
| 61 | + |
| 62 | +You can interact with Redis using natural language: |
| 63 | + |
| 64 | +- "Store this user session data with a 1-hour expiration" |
| 65 | +- "Add this item to the shopping cart list" |
| 66 | +- "Search for similar vectors in the product embeddings" |
| 67 | +- "Publish a notification to the alerts channel" |
| 68 | +- "Get the top 10 scores from the leaderboard" |
| 69 | +- "Cache this API response for 5 minutes" |
| 70 | + |
| 71 | +## Configuration |
| 72 | + |
| 73 | +The extension connects to Redis using a Redis URL. Default configuration connects to `redis://127.0.0.1:6379/0`. |
| 74 | + |
| 75 | +### Primary Configuration: Redis URL |
| 76 | + |
| 77 | +Set the `REDIS_URL` environment variable to configure your Redis connection: |
| 78 | + |
| 79 | +```bash |
| 80 | +export REDIS_URL=redis://[username:password@]host:port/database |
| 81 | +``` |
| 82 | + |
| 83 | +### Configuration Examples |
| 84 | + |
| 85 | +**Local Redis (no authentication):** |
| 86 | +```bash |
| 87 | +export REDIS_URL=redis://127.0.0.1:6379/0 |
| 88 | +# or |
| 89 | +export REDIS_URL=redis://localhost:6379/0 |
| 90 | +``` |
| 91 | + |
| 92 | +**Redis with password:** |
| 93 | +```bash |
| 94 | +export REDIS_URL=redis://:mypassword@localhost:6379/0 |
| 95 | +``` |
| 96 | + |
| 97 | +**Redis with username and password:** |
| 98 | +```bash |
| 99 | +export REDIS_URL=redis://myuser:mypassword@localhost:6379/0 |
| 100 | +``` |
| 101 | + |
| 102 | +**Redis Cloud:** |
| 103 | +```bash |
| 104 | +export REDIS_URL=redis://default: [email protected]:12345/0 |
| 105 | +``` |
| 106 | + |
| 107 | +**Redis with SSL:** |
| 108 | +```bash |
| 109 | +export REDIS_URL=rediss://user: [email protected]:6380/0 |
| 110 | +``` |
| 111 | + |
| 112 | +**Redis with SSL and certificates:** |
| 113 | +```bash |
| 114 | +export REDIS_URL=rediss://user:pass@host:6380/0?ssl_cert_reqs=required&ssl_ca_certs=/path/to/ca.pem |
| 115 | +``` |
| 116 | + |
| 117 | +**AWS ElastiCache:** |
| 118 | +```bash |
| 119 | +export REDIS_URL=redis://my-cluster.abc123.cache.amazonaws.com:6379/0 |
| 120 | +``` |
| 121 | + |
| 122 | +**Azure Cache for Redis:** |
| 123 | +```bash |
| 124 | +export REDIS_URL=rediss://mycache.redis.cache.windows.net:6380/0?ssl_cert_reqs=required |
| 125 | +``` |
| 126 | + |
| 127 | +### Backward Compatibility: Individual Environment Variables |
| 128 | + |
| 129 | +If `REDIS_URL` is not set, the extension will fall back to individual environment variables: |
| 130 | + |
| 131 | +- `REDIS_HOST` - Redis hostname (default: 127.0.0.1) |
| 132 | +- `REDIS_PORT` - Redis port (default: 6379) |
| 133 | +- `REDIS_DB` - Database number (default: 0) |
| 134 | +- `REDIS_USERNAME` - Redis username (optional) |
| 135 | +- `REDIS_PWD` - Redis password (optional) |
| 136 | +- `REDIS_SSL` - Enable SSL: "true" or "false" (default: false) |
| 137 | +- `REDIS_SSL_CA_PATH` - Path to CA certificate file |
| 138 | +- `REDIS_SSL_KEYFILE` - Path to SSL key file |
| 139 | +- `REDIS_SSL_CERTFILE` - Path to SSL certificate file |
| 140 | +- `REDIS_SSL_CERT_REQS` - SSL certificate requirements (default: "required") |
| 141 | +- `REDIS_SSL_CA_CERTS` - Path to CA certificates file |
| 142 | +- `REDIS_CLUSTER_MODE` - Enable cluster mode: "true" or "false" (default: false) |
| 143 | + |
| 144 | +**Example using individual variables:** |
| 145 | +```bash |
| 146 | +export REDIS_HOST=my-redis-server.com |
| 147 | +export REDIS_PORT=6379 |
| 148 | +export REDIS_PWD=mypassword |
| 149 | +export REDIS_SSL=true |
| 150 | +``` |
| 151 | + |
| 152 | +### Configuration Priority |
| 153 | + |
| 154 | +1. **`REDIS_URL`** (highest priority) - If set, this will be used exclusively |
| 155 | +2. **Individual environment variables** - Used as fallback when `REDIS_URL` is not set |
| 156 | +3. **Built-in defaults** - Used when no configuration is provided |
| 157 | + |
| 158 | +### Configuration Methods |
| 159 | + |
| 160 | +1. **Environment Variables**: Set variables in your shell or system |
| 161 | +2. **`.env` File**: Create a `.env` file in your project directory |
| 162 | +3. **System Environment**: Set variables at the system level |
| 163 | +4. **Shell Profile**: Add exports to your `.bashrc`, `.zshrc`, etc. |
| 164 | + |
| 165 | +### No Configuration Required |
| 166 | + |
| 167 | +If you don't set any configuration, the extension will automatically connect to a local Redis instance at `redis://127.0.0.1:6379/0`. |
| 168 | + |
| 169 | +### Advanced SSL Configuration |
| 170 | + |
| 171 | +For production environments with custom SSL certificates, you can use query parameters in the Redis URL: |
| 172 | + |
| 173 | +```bash |
| 174 | +export REDIS_URL=rediss://user:pass@host:6380/0?ssl_cert_reqs=required&ssl_ca_path=/path/to/ca.pem&ssl_keyfile=/path/to/key.pem&ssl_certfile=/path/to/cert.pem |
| 175 | +``` |
| 176 | + |
| 177 | +Supported SSL query parameters: |
| 178 | +- `ssl_cert_reqs` - Certificate requirements: "required", "optional", "none" |
| 179 | +- `ssl_ca_certs` - Path to CA certificates file |
| 180 | +- `ssl_ca_path` - Path to CA certificate file |
| 181 | +- `ssl_keyfile` - Path to SSL private key file |
| 182 | +- `ssl_certfile` - Path to SSL certificate file |
| 183 | + |
| 184 | +For detailed configuration options and Redis URL format, see the main Redis MCP Server documentation. |
0 commit comments