|
| 1 | +--- |
| 2 | +Title: Install |
| 3 | +alwaysopen: false |
| 4 | +categories: |
| 5 | +- docs |
| 6 | +- integrate |
| 7 | +- rs |
| 8 | +summary: Access a Redis server using any MCP client. |
| 9 | +group: service |
| 10 | +linkTitle: Install |
| 11 | +description: Install and configure the Redis MCP server. |
| 12 | +type: integration |
| 13 | +weight: 10 |
| 14 | +--- |
| 15 | + |
| 16 | +The MCP server runs separately from Redis, so you will need a |
| 17 | +Redis server to access. See [Redis Cloud]({{< relref "/operate/rc" >}}) |
| 18 | +or [Redis Open Source]({{< relref "/operate/oss_and_stack" >}}) to learn |
| 19 | +how to get a test server active within minutes. |
| 20 | + |
| 21 | +## Install the server from source |
| 22 | + |
| 23 | +When you have a Redis server, you can clone Redis MCP from the |
| 24 | +[Github repository](https://github.com/redis/mcp-redis) using the following |
| 25 | +command: |
| 26 | + |
| 27 | +```bash |
| 28 | +git clone https://github.com/redis/mcp-redis.git |
| 29 | +``` |
| 30 | + |
| 31 | +You will also need the [`uv`](https://github.com/astral-sh/uv) packaging |
| 32 | +tool to set up the server. See the `uv` |
| 33 | +[installation instructions](https://github.com/astral-sh/uv?tab=readme-ov-file#installation) |
| 34 | +for more information. |
| 35 | + |
| 36 | +When you have `uv`, go into the `mcp-redis` folder that you cloned and |
| 37 | +enter the following commands to initialize the MCP server code: |
| 38 | + |
| 39 | +```bash |
| 40 | +cd mcp-redis |
| 41 | + |
| 42 | +uv venv |
| 43 | +source .venv/bin/activate |
| 44 | +uv sync |
| 45 | +``` |
| 46 | + |
| 47 | +## Install using Docker |
| 48 | + |
| 49 | +You can use the [`mcp/redis`](https://hub.docker.com/r/mcp/redis) |
| 50 | +image (or build your own image from the source using the `Dockerfile`) to |
| 51 | +run Redis MCP with [Docker](https://www.docker.com/). Use the following |
| 52 | +command to download `mcp/redis` from [DockerHub](https://hub.docker.com/): |
| 53 | + |
| 54 | +``` |
| 55 | +docker build -t mcp-redis . |
| 56 | +``` |
| 57 | + |
| 58 | +## Configuration |
| 59 | + |
| 60 | +The default settings for MCP assume a Redis server is running on the |
| 61 | +local machine, with the default port and no security arrangements. |
| 62 | +To change these settings, use the environment variables shown in the |
| 63 | +table below. For example, for a `bash` shell, use |
| 64 | + |
| 65 | +```bash |
| 66 | +export REDIS_USERNAME="my_username" |
| 67 | +``` |
| 68 | + |
| 69 | +from the command line or the `.bashrc` file to set the username you want |
| 70 | +to connect with. |
| 71 | + |
| 72 | + |
| 73 | +| Name | Description | Default Value | |
| 74 | +|----------------------|-----------------------------------------------------------|---------------| |
| 75 | +| `REDIS_HOST` | Redis IP or hostname | `"127.0.0.1"` | |
| 76 | +| `REDIS_PORT` | Redis port | `6379` | |
| 77 | +| `REDIS_USERNAME` | Default database username | `"default"` | |
| 78 | +| `REDIS_PWD` | Default database password | "" | |
| 79 | +| `REDIS_SSL` | Enables or disables SSL/TLS | `False` | |
| 80 | +| `REDIS_CA_PATH` | CA certificate for verifying server | None | |
| 81 | +| `REDIS_SSL_KEYFILE` | Client's private key file for client authentication | None | |
| 82 | +| `REDIS_SSL_CERTFILE` | Client's certificate file for client authentication | None | |
| 83 | +| `REDIS_CERT_REQS` | Whether the client should verify the server's certificate | `"required"` | |
| 84 | +| `REDIS_CA_CERTS` | Path to the trusted CA certificates file | None | |
| 85 | +| `REDIS_CLUSTER_MODE` | Enable Redis Cluster mode | `False` | |
| 86 | +| `MCP_TRANSPORT` | Use the `stdio` or `sse` transport | `stdio` | |
| 87 | + |
| 88 | +### Making MCP visible externally |
| 89 | + |
| 90 | +{{< note >}}The configuration for an MCP client includes the commands |
| 91 | +to start a local server, so you can ignore this section if you don't |
| 92 | +want your Redis MCP to be externally accessible. |
| 93 | +{{< /note >}} |
| 94 | + |
| 95 | +The default configuration assumes you only want to use the MCP server |
| 96 | +locally, but you can make it externally available by setting |
| 97 | +`MCP_TRANSPORT` to `sse`: |
| 98 | + |
| 99 | +```bash |
| 100 | +export MCP_TRANSPORT="sse" |
| 101 | +``` |
| 102 | + |
| 103 | +Then, start the server with the following command: |
| 104 | + |
| 105 | +```bash |
| 106 | +uv run src/main.py |
| 107 | +``` |
| 108 | + |
| 109 | +You can test the server is responding with the [`curl`](https://curl.se/) |
| 110 | +tool: |
| 111 | + |
| 112 | +```bash |
| 113 | +curl -i http://127.0.0.1:8000/sse |
| 114 | +HTTP/1.1 200 OK |
| 115 | +``` |
0 commit comments