Skip to content

Commit dfccb64

Browse files
committed
upgraded mcp[cli] to 1.9.4, configuration of streamable-http and README instructions
1 parent cecd636 commit dfccb64

File tree

6 files changed

+68
-21
lines changed

6 files changed

+68
-21
lines changed

README.md

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,22 @@ uv sync
5757
To configure this Redis MCP Server, consider the following environment variables:
5858

5959
| Name | Description | Default Value |
60-
|----------------------|-----------------------------------------------------------|--------------|
60+
|----------------------|-----------------------------------------------------------|---------------|
6161
| `REDIS_HOST` | Redis IP or hostname | `"127.0.0.1"` |
62-
| `REDIS_PORT` | Redis port | `6379` |
63-
| `REDIS_DB` | Database | 0 |
64-
| `REDIS_USERNAME` | Default database username | `"default"` |
65-
| `REDIS_PWD` | Default database password | "" |
66-
| `REDIS_SSL` | Enables or disables SSL/TLS | `False` |
67-
| `REDIS_CA_PATH` | CA certificate for verifying server | None |
68-
| `REDIS_SSL_KEYFILE` | Client's private key file for client authentication | None |
69-
| `REDIS_SSL_CERTFILE` | Client's certificate file for client authentication | None |
70-
| `REDIS_CERT_REQS` | Whether the client should verify the server's certificate | `"required"` |
71-
| `REDIS_CA_CERTS` | Path to the trusted CA certificates file | None |
72-
| `REDIS_CLUSTER_MODE` | Enable Redis Cluster mode | `False` |
73-
| `MCP_TRANSPORT` | Use the `stdio` or `sse` transport | `stdio` |
62+
| `REDIS_PORT` | Redis port | `6379` |
63+
| `REDIS_DB` | Database | 0 |
64+
| `REDIS_USERNAME` | Default database username | `"default"` |
65+
| `REDIS_PWD` | Default database password | "" |
66+
| `REDIS_SSL` | Enables or disables SSL/TLS | `False` |
67+
| `REDIS_CA_PATH` | CA certificate for verifying server | None |
68+
| `REDIS_SSL_KEYFILE` | Client's private key file for client authentication | None |
69+
| `REDIS_SSL_CERTFILE` | Client's certificate file for client authentication | None |
70+
| `REDIS_CERT_REQS` | Whether the client should verify the server's certificate | `"required"` |
71+
| `REDIS_CA_CERTS` | Path to the trusted CA certificates file | None |
72+
| `REDIS_CLUSTER_MODE` | Enable Redis Cluster mode | `False` |
73+
| `MCP_TRANSPORT` | Use the `stdio`, `streamable-http` or `sse` transport | `stdio` |
74+
| `MCP_HOST` | Server host when `streamable-http` or `sse` are set | `127.0.0.1` |
75+
| `MCP_PORT` | Server port when `streamable-http` or `sse` are set | `8000` |
7476

7577

7678
There are several ways to set environment variables:
@@ -101,9 +103,38 @@ OR,
101103
## Transports
102104

103105
This MCP server can be configured to handle requests locally, running as a process and communicating with the MCP client via `stdin` and `stdout`.
104-
This is the default configuration. The `sse` transport is also configurable so the server is available over the network.
106+
This is the default configuration, `stdio`. The `streamable-http` and `sse` (deprecated) transports are also configurable, which make the server available over the network.
105107
Configure the `MCP_TRANSPORT` variable accordingly.
106108

109+
> Authentication has not yet been implemented, and [attackers could use DNS rebinding](https://modelcontextprotocol.io/docs/concepts/transports#security-considerations) to access the server.
110+
111+
### Streamable HTTP
112+
113+
```commandline
114+
export MCP_TRANSPORT="streamable-http"
115+
```
116+
117+
Then start the server.
118+
119+
```commandline
120+
uv run src/main.py
121+
```
122+
123+
Configure in GitHub Copilot
124+
125+
```commandline
126+
"mcp": {
127+
"servers": {
128+
"redis-mcp": {
129+
"type": "http",
130+
"url": "http://127.0.0.1:8000/mcp/"
131+
},
132+
}
133+
},
134+
```
135+
136+
### SSE (deprecated)
137+
107138
```commandline
108139
export MCP_TRANSPORT="sse"
109140
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "Redis MCP Server, by Redis"
55
readme = "README.md"
66
requires-python = ">=3.13"
77
dependencies = [
8-
"mcp[cli]>=1.5.0",
8+
"mcp[cli]>=1.9.4",
99
"redis>=6.0.0",
1010
"dotenv>=0.9.9",
1111
"numpy>=2.2.4",

src/common/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
load_dotenv()
66

77
MCP_TRANSPORT = os.getenv('MCP_TRANSPORT', 'stdio')
8+
MCP_HOST = os.getenv('MCP_HOST', '127.0.0.1')
9+
MCP_PORT = os.getenv('MCP_PORT', 8000)
810

911
REDIS_CFG = {"host": os.getenv('REDIS_HOST', '127.0.0.1'),
1012
"port": int(os.getenv('REDIS_PORT',6379)),

src/common/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from mcp.server.fastmcp import FastMCP
22

3+
from common.config import MCP_PORT, MCP_HOST
4+
35
# Initialize FastMCP server
46
mcp = FastMCP(
57
"Redis MCP Server",
8+
host=MCP_HOST,
9+
port=MCP_PORT,
610
dependencies=["redis", "dotenv", "numpy"]
711
)
812

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class RedisMCPServer:
2020
def __init__(self):
21-
print("Starting the RedisMCPServer", file=sys.stderr)
21+
print("Starting the Redis MCP Server", file=sys.stderr)
2222

2323
def run(self):
2424
mcp.run(transport=MCP_TRANSPORT)

uv.lock

Lines changed: 15 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)