@@ -88,60 +88,60 @@ def set_redis_env_from_config(config: dict):
88
88
89
89
90
90
@click .command ()
91
- @click .option ('--redis-uri ' , help = 'Redis connection URI (redis://user:pass@host:port/db or rediss:// for SSL)' )
92
- @click .option ('--redis- host' , default = '127.0.0.1' , help = 'Redis host' )
93
- @click .option ('--redis- port' , default = 6379 , type = int , help = 'Redis port' )
94
- @click .option ('--redis- db' , default = 0 , type = int , help = 'Redis database number' )
95
- @click .option ('--redis- username' , help = 'Redis username' )
96
- @click .option ('--redis- password' , help = 'Redis password' )
97
- @click .option ('--redis- ssl' , is_flag = True , help = 'Use SSL connection' )
98
- @click .option ('--redis- ssl-ca-path' , help = 'Path to CA certificate file' )
99
- @click .option ('--redis- ssl-keyfile' , help = 'Path to SSL key file' )
100
- @click .option ('--redis- ssl-certfile' , help = 'Path to SSL certificate file' )
101
- @click .option ('--redis- ssl-cert-reqs' , default = 'required' , help = 'SSL certificate requirements' )
102
- @click .option ('--redis- ssl-ca-certs' , help = 'Path to CA certificates file' )
103
- @click .option ('--redis- cluster-mode' , is_flag = True , help = 'Enable Redis cluster mode' )
91
+ @click .option ('--url ' , help = 'Redis connection URI (redis://user:pass@host:port/db or rediss:// for SSL)' )
92
+ @click .option ('--host' , default = '127.0.0.1' , help = 'Redis host' )
93
+ @click .option ('--port' , default = 6379 , type = int , help = 'Redis port' )
94
+ @click .option ('--db' , default = 0 , type = int , help = 'Redis database number' )
95
+ @click .option ('--username' , help = 'Redis username' )
96
+ @click .option ('--password' , help = 'Redis password' )
97
+ @click .option ('--ssl' , is_flag = True , help = 'Use SSL connection' )
98
+ @click .option ('--ssl-ca-path' , help = 'Path to CA certificate file' )
99
+ @click .option ('--ssl-keyfile' , help = 'Path to SSL key file' )
100
+ @click .option ('--ssl-certfile' , help = 'Path to SSL certificate file' )
101
+ @click .option ('--ssl-cert-reqs' , default = 'required' , help = 'SSL certificate requirements' )
102
+ @click .option ('--ssl-ca-certs' , help = 'Path to CA certificates file' )
103
+ @click .option ('--cluster-mode' , is_flag = True , help = 'Enable Redis cluster mode' )
104
104
@click .option ('--mcp-transport' , default = 'stdio' , type = click .Choice (['stdio' , 'streamable-http' , 'sse' ]), help = 'MCP transport method' )
105
105
@click .option ('--mcp-host' , default = '127.0.0.1' , help = 'MCP server host (for http/sse transport)' )
106
106
@click .option ('--mcp-port' , default = 8000 , type = int , help = 'MCP server port (for http/sse transport)' )
107
- def cli (redis_uri , redis_host , redis_port , redis_db , redis_username , redis_password ,
108
- redis_ssl , redis_ssl_ca_path , redis_ssl_keyfile , redis_ssl_certfile ,
109
- redis_ssl_cert_reqs , redis_ssl_ca_certs , redis_cluster_mode ,
107
+ def cli (url , host , port , db , username , password ,
108
+ ssl , ssl_ca_path , ssl_keyfile , ssl_certfile ,
109
+ ssl_cert_reqs , ssl_ca_certs , cluster_mode ,
110
110
mcp_transport , mcp_host , mcp_port ):
111
111
"""Redis MCP Server - Model Context Protocol server for Redis."""
112
112
113
113
# Handle Redis URI if provided
114
- if redis_uri :
114
+ if url :
115
115
try :
116
- uri_config = parse_redis_uri (redis_uri )
116
+ uri_config = parse_redis_uri (url )
117
117
set_redis_env_from_config (uri_config )
118
118
except ValueError as e :
119
119
click .echo (f"Error parsing Redis URI: { e } " , err = True )
120
120
sys .exit (1 )
121
121
else :
122
122
# Set individual Redis parameters
123
123
config = {
124
- 'host' : redis_host ,
125
- 'port' : redis_port ,
126
- 'db' : redis_db ,
127
- 'ssl' : redis_ssl ,
128
- 'cluster_mode' : redis_cluster_mode
124
+ 'host' : host ,
125
+ 'port' : port ,
126
+ 'db' : db ,
127
+ 'ssl' : ssl ,
128
+ 'cluster_mode' : cluster_mode
129
129
}
130
130
131
- if redis_username :
132
- config ['username' ] = redis_username
133
- if redis_password :
134
- config ['password' ] = redis_password
135
- if redis_ssl_ca_path :
136
- config ['ssl_ca_path' ] = redis_ssl_ca_path
137
- if redis_ssl_keyfile :
138
- config ['ssl_keyfile' ] = redis_ssl_keyfile
139
- if redis_ssl_certfile :
140
- config ['ssl_certfile' ] = redis_ssl_certfile
141
- if redis_ssl_cert_reqs :
142
- config ['ssl_cert_reqs' ] = redis_ssl_cert_reqs
143
- if redis_ssl_ca_certs :
144
- config ['ssl_ca_certs' ] = redis_ssl_ca_certs
131
+ if username :
132
+ config ['username' ] = username
133
+ if password :
134
+ config ['password' ] = password
135
+ if ssl_ca_path :
136
+ config ['ssl_ca_path' ] = ssl_ca_path
137
+ if ssl_keyfile :
138
+ config ['ssl_keyfile' ] = ssl_keyfile
139
+ if ssl_certfile :
140
+ config ['ssl_certfile' ] = ssl_certfile
141
+ if ssl_cert_reqs :
142
+ config ['ssl_cert_reqs' ] = ssl_cert_reqs
143
+ if ssl_ca_certs :
144
+ config ['ssl_ca_certs' ] = ssl_ca_certs
145
145
146
146
set_redis_env_from_config (config )
147
147
0 commit comments