-
Notifications
You must be signed in to change notification settings - Fork 280
DOC-5254 starter docs for Redis MCP #1578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9bc131b
DOC-5254 started MCP docs
andy-stark-redis 67d58b0
DOC-5254 rounded out install and client config details
andy-stark-redis 9a786f3
DOC-5254 added Github link
andy-stark-redis 8246f7b
Apply suggestions from code review
andy-stark-redis ab515bb
DOC-5254 updated config properties
andy-stark-redis d62b14b
DOC-5254 added details for Redis Cloud MCP
andy-stark-redis ec7366c
DOC-5254 updated docs with latest info
andy-stark-redis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| Title: Redis MCP | ||
| alwaysopen: false | ||
| categories: | ||
| - docs | ||
| - integrate | ||
| - rs | ||
| description: Access a Redis server using any MCP client. | ||
| group: service | ||
| hideListLinks: false | ||
| linkTitle: Redis MCP | ||
| summary: Redis MCP server lets MCP clients access the features of Redis. | ||
| type: integration | ||
| weight: 1 | ||
| --- | ||
|
|
||
| The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) | ||
| is a standard that lets AI agents access data and perform actions. Using MCP, | ||
| your server can publish a set of commands that are usable by any MCP-compatible | ||
| client app (such as [Claude Desktop](https://claude.ai/download) or | ||
| [VSCode](https://code.visualstudio.com/)). These commands can retrieve | ||
| whatever data you wish to provide and you can also let the agent make | ||
| changes to the data. For example, you could publish a feed of news items that | ||
| an agent can use in its responses, and also let the agent add the user's | ||
| comments to those items. | ||
|
|
||
| Redis MCP is a general-purpose implementation that lets agents read, write, and | ||
| query data in Redis and also has some basic commands to manage the Redis | ||
| server. With this enabled, you can use an LLM client as a very high-level | ||
| interface to Redis. Add, query, and analyze any Redis data set directly from | ||
| an LLM chat using instructions and questions like the following: | ||
|
|
||
| - "Store the entire conversation in the 'recent_chats' stream" | ||
| - "Cache this item" | ||
| - "How many keys does my database have?" | ||
| - "What is user:1's email?" | ||
|
|
||
| See the other pages in this section to learn how to set up and use Redis MCP. | ||
| See also the [Github repository](https://github.com/redis/mcp-redis) for | ||
andy-stark-redis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| the latest changes. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| --- | ||
| Title: Configure client apps | ||
| alwaysopen: false | ||
| categories: | ||
| - docs | ||
| - integrate | ||
| - rs | ||
| summary: Access a Redis server using any MCP client. | ||
| group: service | ||
| linkTitle: Configure client apps | ||
| description: Configure client apps to use the Redis MCP server. | ||
| type: integration | ||
| weight: 20 | ||
| --- | ||
|
|
||
| When you have [installed]({{< relref "/integrate/redis-mcp/install" >}}) | ||
| the Redis MCP server, you must also configure your client app to use it. | ||
| The sections below describe the ways you can do this. | ||
|
|
||
| ## Smithery | ||
|
|
||
| [Smithery](https://smithery.ai/) provides a searchable repository of scripts | ||
| that add configurations for many MCP services to client apps. | ||
| The easiest way to configure your client is to use the | ||
| [Smithery tool for Redis MCP](https://smithery.ai/server/@redis/mcp-redis). | ||
|
|
||
| When you select your client from the **Install** bar on the Redis MCP page, | ||
| you will see a command line that you can copy and paste into a terminal. | ||
| Running this command will configure your client app to use Redis MCP. (Note | ||
| that you must have [Node.js](https://nodejs.org/en) installed to run | ||
| the Smithery scripts.) For example, the command line for | ||
| [Claude Desktop](https://claude.ai/download) is | ||
|
|
||
| ```bash | ||
| npx -y @smithery/cli@latest install @redis/mcp-redis --client claude | ||
| ``` | ||
|
|
||
| The script will prompt you for the information required to connect to | ||
| your Redis database. | ||
|
|
||
| ## Manual configuration | ||
|
|
||
| You can also add the configuration for Redis MCP to your client app | ||
| manually. The exact method varies from client to client but the | ||
| basic approach is similar in each case. The pages listed below | ||
| give the general configuration details for some common MCP client tools: | ||
|
|
||
| - [Claude Desktop](https://modelcontextprotocol.io/quickstart/user) | ||
| - [Github Copilot for VSCode](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) | ||
andy-stark-redis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - [OpenAI](https://openai.github.io/openai-agents-python/mcp/) | ||
|
|
||
| ### Local servers | ||
|
|
||
| For a locally-running MCP server, you need to edit the configuration | ||
| file to add the command that launches the server, along with its | ||
| arguments. For example, with Claude Desktop, you can locate the | ||
| file by selecting **Settings** from the menu, then selecting the | ||
| **Developer** tab, and then clicking the **Edit Config** button. | ||
| Open this JSON file and add your settings as | ||
| shown below: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| . | ||
| . | ||
| "redis": { | ||
| "command": "<path-to-uv-command>", | ||
| "args": [ | ||
| "--directory", | ||
| "<your-folder-path>/mcp-redis", | ||
| "run", | ||
| "src/main.py" | ||
| ] | ||
| } | ||
| }, | ||
| . | ||
| . | ||
| } | ||
| ``` | ||
|
|
||
| You can find the path to the `uv` command using `which uv`, or | ||
| the equivalent. You can also optionally set the environment for | ||
| the command shell here in the `env` section: | ||
|
|
||
| ```json | ||
| "redis": { | ||
| "command": "<path-to-uv-command>>", | ||
| "args": [ | ||
| "--directory", | ||
| "<your-folder-path>/mcp-redis", | ||
| "run", | ||
| "src/main.py" | ||
| ], | ||
| "env": { | ||
| "REDIS_HOST": "<your_redis_database_hostname>", | ||
| "REDIS_PORT": "<your_redis_database_port>", | ||
| "REDIS_PWD": "<your_redis_database_password>", | ||
| "REDIS_SSL": True|False, | ||
| "REDIS_CA_PATH": "<your_redis_ca_path>", | ||
| "REDIS_CLUSTER_MODE": True|False | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| If you are using | ||
| [Docker]({{< relref "/integrate/redis-mcp/install#install-using-docker" >}}) | ||
| to deploy the server, change the `command` and `args` sections of the | ||
| configuration as shown below: | ||
|
|
||
| ```json | ||
| "redis": { | ||
| "command": "docker", | ||
| "args": ["run", | ||
| "--rm", | ||
| "--name", | ||
| "redis-mcp-server", | ||
| "-i", | ||
| "-e", "REDIS_HOST=<redis_hostname>", | ||
| "-e", "REDIS_PORT=<redis_port>", | ||
| "-e", "REDIS_USERNAME=<redis_username>", | ||
| "-e", "REDIS_PWD=<redis_password>", | ||
| "mcp-redis"] | ||
| } | ||
| ``` | ||
|
|
||
| ### Remote servers | ||
|
|
||
| If you set up an | ||
| [externally visible]({{< relref "/integrate/redis-mcp/install#making-mcp-visible-externally" >}}) | ||
| MCP server, you may be able to configure it directly from the app (but | ||
| if you can't, then see [Using a gateway](#using-a-gateway) for an alternative approach). For | ||
| example, the following `JSON` element configures | ||
| [Github Copilot for VSCode](https://code.visualstudio.com/docs/copilot/overview) | ||
andy-stark-redis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| to use an `sse` type server running at `127.0.0.1`: | ||
|
|
||
| ```json | ||
| . | ||
| . | ||
| "mcp": { | ||
| "servers": { | ||
| "redis-mcp": { | ||
| "type": "sse", | ||
| "url": "http://127.0.0.1:8000/sse" | ||
| }, | ||
| } | ||
| }, | ||
| . | ||
| . | ||
| ``` | ||
|
|
||
| ### Using a gateway | ||
|
|
||
| Apps that don't currently support external MCP servers directly, such as Claude | ||
| Desktop, can still access them using a *gateway*. See | ||
| [MCP server gateway](https://github.com/lightconetech/mcp-gateway) | ||
| for more information. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| --- | ||
| Title: Install | ||
| alwaysopen: false | ||
| categories: | ||
| - docs | ||
| - integrate | ||
| - rs | ||
| summary: Access a Redis server using any MCP client. | ||
| group: service | ||
| linkTitle: Install the server | ||
| description: Install and configure the Redis MCP server. | ||
| type: integration | ||
| weight: 10 | ||
| --- | ||
|
|
||
| The MCP server runs separately from Redis, so you will need a | ||
| Redis server for it to connect to. See [Redis Cloud]({{< relref "/operate/rc" >}}) | ||
| or [Redis Open Source]({{< relref "/operate/oss_and_stack" >}}) to learn | ||
| how to get a test server active within minutes. | ||
|
|
||
| When you have a Redis server available, use the instructions below to install and | ||
| configure the Redis MCP server. | ||
|
|
||
| ## Install the server from source | ||
|
|
||
| Clone Redis MCP from the | ||
| [Github repository](https://github.com/redis/mcp-redis) using the following | ||
| command: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/redis/mcp-redis.git | ||
| ``` | ||
|
|
||
| You will also need the [`uv`](https://github.com/astral-sh/uv) packaging | ||
| tool to set up the server. See the `uv` | ||
| [installation instructions](https://github.com/astral-sh/uv?tab=readme-ov-file#installation) | ||
| for more information. | ||
|
|
||
| When you have installed `uv`, go to the `mcp-redis` folder that you cloned and | ||
| enter the following commands to initialize the MCP server code: | ||
|
|
||
| ```bash | ||
| cd mcp-redis | ||
|
|
||
| uv venv | ||
| source .venv/bin/activate | ||
| uv sync | ||
| ``` | ||
|
|
||
| ## Install using Docker | ||
|
|
||
| You can use the [`mcp/redis`](https://hub.docker.com/r/mcp/redis) | ||
| image to run Redis MCP with [Docker](https://www.docker.com/). | ||
| Alternatively, use the following | ||
| command to build the Docker image with the `Dockerfile` in the | ||
| `mcp/redis` folder: | ||
|
|
||
| ``` | ||
| docker build -t mcp-redis . | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The default settings for MCP assume a Redis server is running on the | ||
| local machine, with the default port and no security arrangements. | ||
| To change these settings, use the environment variables shown in the | ||
| table below. For example, for a `bash` shell, use | ||
|
|
||
| ```bash | ||
| export REDIS_USERNAME="my_username" | ||
| ``` | ||
|
|
||
| from the command line or the `.bashrc` file to set the username you want | ||
| to connect with. | ||
|
|
||
|
|
||
| | Name | Description | Default Value | | ||
| |----------------------|-----------------------------------------------------------|---------------| | ||
| | `REDIS_HOST` | Redis IP or hostname | `"127.0.0.1"` | | ||
| | `REDIS_PORT` | Redis port | `6379` | | ||
| | `REDIS_USERNAME` | Default database username | `"default"` | | ||
| | `REDIS_PWD` | Default database password | "" | | ||
| | `REDIS_SSL` | Enables or disables SSL/TLS | `False` | | ||
| | `REDIS_CA_PATH` | CA certificate for verifying server | None | | ||
| | `REDIS_SSL_KEYFILE` | Client's private key file for client authentication | None | | ||
| | `REDIS_SSL_CERTFILE` | Client's certificate file for client authentication | None | | ||
| | `REDIS_CERT_REQS` | Whether the client should verify the server's certificate | `"required"` | | ||
| | `REDIS_CA_CERTS` | Path to the trusted CA certificates file | None | | ||
| | `REDIS_CLUSTER_MODE` | Enable Redis Cluster mode | `False` | | ||
| | `MCP_TRANSPORT` | Use the `stdio` or `sse` transport | `stdio` | | ||
|
|
||
| ### Making MCP visible externally | ||
|
|
||
| {{< note >}}The configuration for an MCP client includes the commands | ||
| to start a local server, so you can ignore this section if you don't | ||
| want your Redis MCP to be externally accessible. | ||
| {{< /note >}} | ||
|
|
||
| The default configuration assumes you only want to use the MCP server | ||
| locally, but you can make it externally available by setting | ||
| `MCP_TRANSPORT` to `sse`: | ||
|
|
||
| ```bash | ||
| export MCP_TRANSPORT="sse" | ||
| ``` | ||
|
|
||
| Then, start the server with the following command: | ||
|
|
||
| ```bash | ||
| uv run src/main.py | ||
| ``` | ||
|
|
||
| You can test the server is responding with the [`curl`](https://curl.se/) | ||
| tool: | ||
|
|
||
| ```bash | ||
| curl -i http://127.0.0.1:8000/sse | ||
| HTTP/1.1 200 OK | ||
| ``` | ||
|
|
||
| ## Next steps | ||
|
|
||
| When you have installed the server, you will need a MCP client to | ||
| connect to it and use its services. See | ||
| [Configure client apps]({{< relref "/integrate/redis-mcp/client-conf" >}}) | ||
| for more information. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.