@aliyun-rds/supabase-mcp-server 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -39
- package/dist/index.js +805 -99
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -70,6 +70,23 @@ For example, when you ask an AI assistant "List all tables in my database", it w
|
|
|
70
70
|
3. Execute the tool against your Supabase instance
|
|
71
71
|
4. Present the results in a human-readable format
|
|
72
72
|
|
|
73
|
+
## Authentication Modes & Permission Levels
|
|
74
|
+
|
|
75
|
+
The server supports three authentication modes with automatic tool filtering:
|
|
76
|
+
|
|
77
|
+
- **Mode 1 – Alibaba Cloud Multi-Instance (AuthMode `aliyun`, permission `full`)**
|
|
78
|
+
Use `--aliyun-ak`, `--aliyun-sk`, and `--aliyun-region` to discover and manage multiple Aliyun RDS Supabase instances. Grants access to all tools, including Aliyun management tools.
|
|
79
|
+
- **Mode 2 – Single Instance Admin (AuthMode `admin`, permission `admin`)**
|
|
80
|
+
Use `--supabase-url`, `--supabase-anon-key`, and `--supabase-service-role-key` for a single project. Admin-only tools stay available; Aliyun management tools are hidden.
|
|
81
|
+
- **Mode 3 – Single Instance User (AuthMode `user`, permission `user`)**
|
|
82
|
+
Use `--supabase-url`, `--supabase-anon-key`, plus `--supabase-user-email` and `--supabase-user-password`. Runs under the user’s RLS scope; admin tools and Aliyun management tools are disabled.
|
|
83
|
+
|
|
84
|
+
Tool visibility is enforced automatically:
|
|
85
|
+
- **Aliyun-only tools** (e.g., `list_aliyun_supabase_instances`, `connect_to_supabase_instance`, `get_current_supabase_instance`, `disconnect_supabase_instance`) require `full` permissions.
|
|
86
|
+
- **Admin-only tools** (auth management, `get_service_key`, `verify_jwt_secret`, `install_execute_sql_function`, `rebuild_hooks`) require `full` or `admin` permissions.
|
|
87
|
+
|
|
88
|
+
Mode selection priority: if multiple configurations are provided, the server picks Aliyun first; if Aliyun is absent and user credentials are complete, user mode is selected; otherwise admin mode is used. A warning is logged when multiple modes are detected.
|
|
89
|
+
|
|
73
90
|
## Setup and Installation
|
|
74
91
|
|
|
75
92
|
### Alibaba Cloud Mode Setup
|
|
@@ -158,16 +175,87 @@ Or use environment variables:
|
|
|
158
175
|
3. **Use tools**: Now you can use all Supabase tools (list_tables, execute_sql, etc.)
|
|
159
176
|
4. **Disconnect** (optional): Use `disconnect_supabase_instance` to switch instances
|
|
160
177
|
|
|
161
|
-
###
|
|
178
|
+
### Single Instance Admin Mode Setup
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npx @aliyun-rds/supabase-mcp-server \
|
|
182
|
+
--supabase-url https://<your-project>.supabase.co \
|
|
183
|
+
--supabase-anon-key <anon-key> \
|
|
184
|
+
--supabase-service-role-key <service-role-key> \
|
|
185
|
+
[--db-url <postgres-connection-string>] \
|
|
186
|
+
[--jwt-secret <jwt-secret>] \
|
|
187
|
+
[--enable-rag-agent]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Environment variable alternative:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
SUPABASE_URL=https://<your-project>.supabase.co \
|
|
194
|
+
SUPABASE_ANON_KEY=<anon-key> \
|
|
195
|
+
SUPABASE_SERVICE_ROLE_KEY=<service-role-key> \
|
|
196
|
+
supabase-mcp
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Claude Desktop / Cursor JSON 示例:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"mcpServers": {
|
|
204
|
+
"supabase-admin": {
|
|
205
|
+
"command": "npx",
|
|
206
|
+
"args": [
|
|
207
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
208
|
+
"--supabase-url", "https://<your-project>.supabase.co",
|
|
209
|
+
"--supabase-anon-key", "<anon-key>",
|
|
210
|
+
"--supabase-service-role-key", "<service-role-key>"
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
162
216
|
|
|
163
|
-
|
|
217
|
+
### Single Instance User Mode Setup (RLS Restricted)
|
|
164
218
|
|
|
165
|
-
|
|
219
|
+
```bash
|
|
220
|
+
npx @aliyun-rds/supabase-mcp-server \
|
|
221
|
+
--supabase-url https://<your-project>.supabase.co \
|
|
222
|
+
--supabase-anon-key <anon-key> \
|
|
223
|
+
--supabase-user-email <user-email> \
|
|
224
|
+
--supabase-user-password <user-password> \
|
|
225
|
+
[--enable-rag-agent]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Environment variable alternative:
|
|
166
229
|
|
|
167
230
|
```bash
|
|
168
|
-
|
|
231
|
+
SUPABASE_URL=https://<your-project>.supabase.co \
|
|
232
|
+
SUPABASE_ANON_KEY=<anon-key> \
|
|
233
|
+
SUPABASE_USER_EMAIL=<user-email> \
|
|
234
|
+
SUPABASE_USER_PASSWORD=<user-password> \
|
|
235
|
+
supabase-mcp
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Claude Desktop / Cursor JSON 示例:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"mcpServers": {
|
|
243
|
+
"supabase-user": {
|
|
244
|
+
"command": "npx",
|
|
245
|
+
"args": [
|
|
246
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
247
|
+
"--supabase-url", "https://<your-project>.supabase.co",
|
|
248
|
+
"--supabase-anon-key", "<anon-key>",
|
|
249
|
+
"--supabase-user-email", "<user-email>",
|
|
250
|
+
"--supabase-user-password", "<user-password>"
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
169
255
|
```
|
|
170
256
|
|
|
257
|
+
### Additional Installation Options
|
|
258
|
+
|
|
171
259
|
#### Global Installation
|
|
172
260
|
|
|
173
261
|
```bash
|
|
@@ -180,20 +268,45 @@ supabase-mcp \
|
|
|
180
268
|
|
|
181
269
|
## Configuration
|
|
182
270
|
|
|
183
|
-
|
|
271
|
+
Choose one configuration path. CLI flags override environment variables.
|
|
272
|
+
|
|
273
|
+
### Mode 1 — Alibaba Cloud Multi-Instance (permission: full)
|
|
274
|
+
|
|
275
|
+
Required:
|
|
276
|
+
- `--aliyun-ak <key>` or `ALIYUN_ACCESS_KEY_ID=<key>`
|
|
277
|
+
- `--aliyun-sk <secret>` or `ALIYUN_ACCESS_KEY_SECRET=<secret>`
|
|
278
|
+
- `--aliyun-region <region>` or `ALIYUN_REGION=<region>` (e.g., `cn-hangzhou`, `cn-beijing`; required for discovery)
|
|
279
|
+
|
|
280
|
+
Behavior: pulls Supabase URL/keys/DB URL/JWT secret from Aliyun for the selected instance.
|
|
281
|
+
|
|
282
|
+
### Mode 2 — Single Instance Admin (permission: admin)
|
|
283
|
+
|
|
284
|
+
Required:
|
|
285
|
+
- `--supabase-url <url>` or `SUPABASE_URL`
|
|
286
|
+
- `--supabase-anon-key <key>` or `SUPABASE_ANON_KEY`
|
|
287
|
+
- `--supabase-service-role-key <key>` or `SUPABASE_SERVICE_ROLE_KEY`
|
|
288
|
+
|
|
289
|
+
Optional:
|
|
290
|
+
- `--db-url <postgres-connection-string>` or `DB_URL`
|
|
291
|
+
- `--jwt-secret <secret>` or `JWT_SECRET`
|
|
184
292
|
|
|
185
|
-
|
|
293
|
+
Legacy flag aliases are still accepted: `--url`, `--anon-key`, `--service-key`, `--db-url`, `--jwt-secret`.
|
|
186
294
|
|
|
187
|
-
|
|
188
|
-
* `--aliyun-sk <secret>` or `ALIYUN_ACCESS_KEY_SECRET=<secret>`: Alibaba Cloud Access Key Secret.
|
|
189
|
-
* `--aliyun-region <region>` or `ALIYUN_REGION=<region>`: **Mandatory** region where your Supabase instances live (e.g., `cn-hangzhou`, `cn-beijing`). Without this, the OpenAPI call cannot list instances. This value becomes the default region, but tools like `list_aliyun_supabase_instances` accept a `region_id` parameter so you can query other regions on demand.
|
|
295
|
+
### Mode 3 — Single Instance User (permission: user, RLS enforced)
|
|
190
296
|
|
|
191
|
-
|
|
297
|
+
Required:
|
|
298
|
+
- `--supabase-url <url>` or `SUPABASE_URL`
|
|
299
|
+
- `--supabase-anon-key <key>` or `SUPABASE_ANON_KEY`
|
|
300
|
+
- `--supabase-user-email <email>` or `SUPABASE_USER_EMAIL`
|
|
301
|
+
- `--supabase-user-password <password>` or `SUPABASE_USER_PASSWORD`
|
|
192
302
|
|
|
193
|
-
|
|
194
|
-
* `--enable-rag-agent` or `ENABLE_RAG_AGENT=true`: Enable RAG Agent MCP integration. When enabled, the server resolves the Supabase host/port from the selected instance and uses the retrieved anon key as the API key for rag-agent; no manual `--url` or `--anon-key` flags are needed.
|
|
303
|
+
Behavior: operates under the provided user's RLS policies; admin-only and Aliyun management tools are filtered out.
|
|
195
304
|
|
|
196
|
-
|
|
305
|
+
### Common Options
|
|
306
|
+
|
|
307
|
+
- `--tools-config <path>`: JSON file specifying which tools to enable (whitelist). Format: `{"enabledTools": ["tool_name_1", "tool_name_2"]}`.
|
|
308
|
+
- `--enable-rag-agent` or `ENABLE_RAG_AGENT=true`: Enable RAG Agent MCP integration. When enabled, the server resolves the Supabase host/port from the selected instance and uses the retrieved anon key as the API key for rag-agent.
|
|
309
|
+
- `--workspace-path <path>`: Workspace root for file operations (optional).
|
|
197
310
|
|
|
198
311
|
### RAG Agent Integration
|
|
199
312
|
|
|
@@ -234,7 +347,10 @@ npx @aliyun-rds/supabase-mcp-server \
|
|
|
234
347
|
### Cursor
|
|
235
348
|
|
|
236
349
|
1. Create or open the file `.cursor/mcp.json` in your project root.
|
|
237
|
-
2. Add the following
|
|
350
|
+
2. Add one of the following configurations based on your authentication mode:
|
|
351
|
+
|
|
352
|
+
**Mode 1 (Aliyun multi-instance, permission: full)**
|
|
353
|
+
Grants all tools, including Aliyun management.
|
|
238
354
|
|
|
239
355
|
```json
|
|
240
356
|
{
|
|
@@ -243,12 +359,9 @@ npx @aliyun-rds/supabase-mcp-server \
|
|
|
243
359
|
"command": "npx",
|
|
244
360
|
"args": [
|
|
245
361
|
"@aliyun-rds/supabase-mcp-server",
|
|
246
|
-
"--aliyun-ak",
|
|
247
|
-
"<your-access-key-
|
|
248
|
-
"--aliyun-
|
|
249
|
-
"<your-access-key-secret>",
|
|
250
|
-
"--aliyun-region",
|
|
251
|
-
"cn-hangzhou",
|
|
362
|
+
"--aliyun-ak", "<your-access-key-id>",
|
|
363
|
+
"--aliyun-sk", "<your-access-key-secret>",
|
|
364
|
+
"--aliyun-region", "cn-hangzhou",
|
|
252
365
|
"--enable-rag-agent"
|
|
253
366
|
],
|
|
254
367
|
"env": {
|
|
@@ -261,6 +374,47 @@ npx @aliyun-rds/supabase-mcp-server \
|
|
|
261
374
|
}
|
|
262
375
|
```
|
|
263
376
|
|
|
377
|
+
**Mode 2 (Single instance admin, permission: admin)**
|
|
378
|
+
Admin tools available; Aliyun management tools hidden.
|
|
379
|
+
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"mcpServers": {
|
|
383
|
+
"supabase-admin": {
|
|
384
|
+
"command": "npx",
|
|
385
|
+
"args": [
|
|
386
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
387
|
+
"--supabase-url", "https://<your-project>.supabase.co",
|
|
388
|
+
"--supabase-anon-key", "<anon-key>",
|
|
389
|
+
"--supabase-service-role-key", "<service-role-key>",
|
|
390
|
+
"--enable-rag-agent"
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Mode 3 (Single instance user, permission: user, RLS enforced)**
|
|
398
|
+
Runs under user RLS; admin/Aliyun tools disabled.
|
|
399
|
+
|
|
400
|
+
```json
|
|
401
|
+
{
|
|
402
|
+
"mcpServers": {
|
|
403
|
+
"supabase-user": {
|
|
404
|
+
"command": "npx",
|
|
405
|
+
"args": [
|
|
406
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
407
|
+
"--supabase-url", "https://<your-project>.supabase.co",
|
|
408
|
+
"--supabase-anon-key", "<anon-key>",
|
|
409
|
+
"--supabase-user-email", "<user-email>",
|
|
410
|
+
"--supabase-user-password", "<user-password>",
|
|
411
|
+
"--enable-rag-agent"
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
264
418
|
**Important Notes for RAG Agent:**
|
|
265
419
|
- RAG Agent tools stay inactive until you call `connect_to_supabase_instance` and select an Aliyun RDS Supabase project.
|
|
266
420
|
- Switching instances automatically re-initializes the rag-agent connection with the new host/port.
|
|
@@ -268,27 +422,56 @@ npx @aliyun-rds/supabase-mcp-server \
|
|
|
268
422
|
|
|
269
423
|
### Claude for Desktop
|
|
270
424
|
|
|
271
|
-
For Claude Desktop,
|
|
425
|
+
For Claude Desktop, open Settings → Developer → enable "Custom MCP Servers", then add one configuration matching your mode:
|
|
272
426
|
|
|
273
|
-
1
|
|
274
|
-
2. Go to "Developer" and enable "Custom MCP Servers"
|
|
275
|
-
3. Add a new server with the following configuration:
|
|
427
|
+
**Mode 1 (Aliyun, permission: full)**
|
|
276
428
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
429
|
+
```json
|
|
430
|
+
{
|
|
431
|
+
"name": "Aliyun Supabase",
|
|
432
|
+
"command": "npx",
|
|
433
|
+
"args": [
|
|
434
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
435
|
+
"--aliyun-ak", "YOUR_ACCESS_KEY_ID",
|
|
436
|
+
"--aliyun-sk", "YOUR_ACCESS_KEY_SECRET",
|
|
437
|
+
"--aliyun-region", "cn-hangzhou",
|
|
438
|
+
"--enable-rag-agent"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Mode 2 (Single instance admin, permission: admin)**
|
|
444
|
+
|
|
445
|
+
```json
|
|
446
|
+
{
|
|
447
|
+
"name": "Supabase Admin",
|
|
448
|
+
"command": "npx",
|
|
449
|
+
"args": [
|
|
450
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
451
|
+
"--supabase-url", "https://<your-project>.supabase.co",
|
|
452
|
+
"--supabase-anon-key", "<anon-key>",
|
|
453
|
+
"--supabase-service-role-key", "<service-role-key>",
|
|
454
|
+
"--enable-rag-agent"
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Mode 3 (Single instance user, permission: user, RLS enforced)**
|
|
460
|
+
|
|
461
|
+
```json
|
|
462
|
+
{
|
|
463
|
+
"name": "Supabase User",
|
|
464
|
+
"command": "npx",
|
|
465
|
+
"args": [
|
|
466
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
467
|
+
"--supabase-url", "https://<your-project>.supabase.co",
|
|
468
|
+
"--supabase-anon-key", "<anon-key>",
|
|
469
|
+
"--supabase-user-email", "<user-email>",
|
|
470
|
+
"--supabase-user-password", "<user-password>",
|
|
471
|
+
"--enable-rag-agent"
|
|
472
|
+
]
|
|
473
|
+
}
|
|
474
|
+
```
|
|
292
475
|
|
|
293
476
|
### Other MCP-Compatible Tools
|
|
294
477
|
|