Skip to content

Commit 1c9c2cc

Browse files
committed
completed Redis connectivity function
1 parent 528b76c commit 1c9c2cc

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ source .venv/bin/activate
2222
uv sync
2323
```
2424

25+
26+
## Configuration
27+
28+
To configure the Redis Cloud API MCP Server, consider the following environment variables:
29+
30+
| Name | Description | Default Value |
31+
|-------------------------|-----------------------------------------------------------|---------------|
32+
| `REDIS_HOST` | Redis IP or hostname | '127.0.0.1' |
33+
| `REDIS_PORT` | Redis port | 6379 |
34+
| `REDIS_USERNAME` | Default database username | 'default' |
35+
| `REDIS_PWD` | Default database password | '' |
36+
| `REDIS_SSL` | Enables or disables SSL/TLS | False |
37+
| `REDIS_CA_PATH` | CA certificate for verifying server | '' |
38+
| `REDIS_SSL_KEYFILE` | Client's private key file for client authentication | '' |
39+
| `REDIS_SSL_CERTFILE` | Client's certificate file for client authentication | '' |
40+
| `REDIS_CERT_REQS` | Whether the client should verify the server's certificate | '' |
41+
| `REDIS_CA_CERTS` | Path to the trusted CA certificates file | '' |
42+
2543
## Integration with Claude Desktop
2644
You can configure Claude Desktop to use this MCP Server.
2745

src/common/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
REDIS_CFG = {"host": os.getenv('REDIS_HOST', '127.0.0.1'),
77
"port": int(os.getenv('REDIS_PORT',6379)),
8-
"username": os.getenv('REDIS_USERNAME','default'),
8+
"username": os.getenv('REDIS_USERNAME', None),
99
"password": os.getenv('REDIS_PWD',''),
1010
"ssl": os.getenv('REDIS_SSL', False),
11-
"ssl_ca_path": os.getenv('REDIS_CA_PATH',''),
12-
"ssl_keyfile": os.getenv('REDIS_SSL_KEYFILE', ''),
13-
"ssl_certfile": os.getenv('REDIS_SSL_CERTFILE', ''),
14-
"ssl_cert_reqs": os.getenv('REDIS_CERT_REQS', ''),
15-
"ssl_ca_certs": os.getenv('REDIS_CA_CERTS', '')}
11+
"ssl_ca_path": os.getenv('REDIS_SSL_CA_PATH', None),
12+
"ssl_keyfile": os.getenv('REDIS_SSL_KEYFILE', None),
13+
"ssl_certfile": os.getenv('REDIS_SSL_CERTFILE', None),
14+
"ssl_cert_reqs": os.getenv('REDIS_SSL_CERT_REQS', 'required'),
15+
"ssl_ca_certs": os.getenv('REDIS_SSL_CA_CERTS', None)}

src/common/connection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def get_connection(cls, decode_responses=True) -> Redis:
2020
password=REDIS_CFG["password"],
2121
ssl=REDIS_CFG["ssl"],
2222
ssl_ca_path=REDIS_CFG["ssl_ca_path"],
23+
ssl_keyfile=REDIS_CFG["ssl_keyfile"],
24+
ssl_certfile=REDIS_CFG["ssl_certfile"],
25+
ssl_cert_reqs=REDIS_CFG["ssl_cert_reqs"],
26+
ssl_ca_certs=REDIS_CFG["ssl_ca_certs"],
2327
decode_responses=decode_responses,
2428
max_connections=10,
2529
lib_name=f"redis-py(mcp-server_v{__version__})"

0 commit comments

Comments
 (0)