You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): add --database-url CLI option for direct Redis connections
Add support for connecting to Redis databases via URL without requiring
a profile. This is useful for ad-hoc connections to standalone Redis
instances that aren't configured as profiles.
Changes:
- Add --database-url option to 'mcp serve' command (supports REDIS_URL env)
- Add DatabaseTools::new_from_url() constructor for URL-based connections
- Update get_database_tools() to prefer URL over profile when both available
- Update MCP documentation with both connection approaches
- Add unit test for database_url configuration
The URL format follows the standard Redis URL scheme:
redis[s]://[[username:]password@]host[:port][/db]
Copy file name to clipboardExpand all lines: mkdocs-site/docs/mcp/getting-started.md
+44-2Lines changed: 44 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,11 @@ redisctl mcp tools
83
83
84
84
### Database Connection Options
85
85
86
-
The `--database-url` flag enables 125+ database tools for direct Redis operations including all data types, Redis Stack modules (Search, JSON, TimeSeries, Bloom), Streams, and Pub/Sub.
86
+
The MCP server provides 125+ database tools for direct Redis operations including all data types, Redis Stack modules (Search, JSON, TimeSeries, Bloom), Streams, and Pub/Sub. You can connect in two ways:
87
+
88
+
#### Option 1: Direct URL (Recommended for Ad-Hoc Connections)
89
+
90
+
Use `--database-url` for quick connections to any Redis database:
87
91
88
92
```bash
89
93
# Local Redis
@@ -92,13 +96,51 @@ The `--database-url` flag enables 125+ database tools for direct Redis operation
#### Option 2: Database Profile (Recommended for Regular Use)
113
+
114
+
Configure a database profile in your redisctl config file (`~/.config/redisctl/config.toml` or `~/Library/Application Support/redisctl/config.toml` on macOS):
115
+
116
+
```toml
117
+
# Default database profile to use when none specified
118
+
default_database_profile = "local-redis"
119
+
120
+
[profiles.local-redis]
121
+
deployment_type = "database"
122
+
123
+
[profiles.local-redis.credentials.database]
124
+
host = "localhost"
125
+
port = 6379
126
+
password = "mypassword"# optional
127
+
tls = false
128
+
username = "default"# optional, defaults to "default"
129
+
db = 0# optional, defaults to 0
130
+
```
131
+
132
+
Then start the MCP server with that profile:
133
+
134
+
```bash
135
+
# Uses the default database profile from config
136
+
redisctl mcp serve
137
+
138
+
# Or specify a profile explicitly
139
+
redisctl -p local-redis mcp serve
100
140
```
101
141
142
+
**Note**: If both `--database-url` and a database profile are available, the `--database-url` takes precedence.
0 commit comments