@aliyun-rds/supabase-mcp-server 1.0.3 → 1.0.4
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 +151 -16
- package/dist/index.js +1060 -364
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -4,10 +4,29 @@ MCP (Model Context Protocol) server for self-hosted Supabase instances. Allows A
|
|
|
4
4
|
|
|
5
5
|
Originally developed by [HenkDz](https://github.com/HenkDz), now maintained by lemontreen.
|
|
6
6
|
|
|
7
|
+
## 🚀 Two Modes of Operation
|
|
8
|
+
|
|
9
|
+
This server supports two modes:
|
|
10
|
+
|
|
11
|
+
### 1. **Alibaba Cloud Mode** (Recommended for Alibaba Cloud RDS AI users)
|
|
12
|
+
- Automatically fetches Supabase credentials from Alibaba Cloud OpenAPI
|
|
13
|
+
- Only requires Alibaba Cloud AccessKey (AK) and SecretKey (SK)
|
|
14
|
+
- Supports multiple Supabase instances with interactive selection
|
|
15
|
+
- No need to manually configure `anon-key`, `service-key`, or `jwt-secret`
|
|
16
|
+
|
|
17
|
+
### 2. **Legacy Mode** (For standard self-hosted Supabase)
|
|
18
|
+
- Requires manual configuration of Supabase URL and keys
|
|
19
|
+
- Compatible with any self-hosted Supabase instance
|
|
20
|
+
|
|
7
21
|
## Features
|
|
8
22
|
|
|
9
23
|
This server exposes a rich set of tools for interacting with your self-hosted Supabase instance:
|
|
10
24
|
|
|
25
|
+
* **Alibaba Cloud Management** (Alibaba Cloud Mode only)
|
|
26
|
+
* `list_aliyun_supabase_instances`: Lists all Supabase instances from Alibaba Cloud RDS AI.
|
|
27
|
+
* `connect_to_supabase_instance`: Connects to a specific Supabase instance by name.
|
|
28
|
+
* `get_current_supabase_instance`: Shows the currently connected instance.
|
|
29
|
+
* `disconnect_supabase_instance`: Disconnects from the current instance.
|
|
11
30
|
* **Database Schema**
|
|
12
31
|
* `list_tables`: Lists all tables in the `public` schema.
|
|
13
32
|
* `list_extensions`: Lists installed PostgreSQL extensions.
|
|
@@ -15,7 +34,7 @@ This server exposes a rich set of tools for interacting with your self-hosted Su
|
|
|
15
34
|
* `get_database_stats`: Gets database statistics (e.g., table sizes).
|
|
16
35
|
* **Migrations & SQL**
|
|
17
36
|
* `list_migrations`: Lists applied migrations from the `supabase_migrations` schema.
|
|
18
|
-
* `apply_migration`: Applies a new SQL migration
|
|
37
|
+
* `apply_migration`: Applies a new SQL migration via RPC.
|
|
19
38
|
* `execute_sql`: Executes arbitrary SQL (Requires helper function in DB or direct DB access).
|
|
20
39
|
* `generate_typescript_types`: Generates TypeScript types from the database schema.
|
|
21
40
|
* **Project Configuration**
|
|
@@ -28,9 +47,9 @@ This server exposes a rich set of tools for interacting with your self-hosted Su
|
|
|
28
47
|
* **Auth User Management**
|
|
29
48
|
* `list_auth_users`: Lists users from `auth.users`.
|
|
30
49
|
* `get_auth_user`: Retrieves details for a specific user.
|
|
31
|
-
* `create_auth_user`: Creates a new user
|
|
32
|
-
* `delete_auth_user`: Deletes a user
|
|
33
|
-
* `update_auth_user`: Updates user details
|
|
50
|
+
* `create_auth_user`: Creates a new user using Supabase Admin API.
|
|
51
|
+
* `delete_auth_user`: Deletes a user using Supabase Admin API.
|
|
52
|
+
* `update_auth_user`: Updates user details using Supabase Admin API.
|
|
34
53
|
* **Storage Insights**
|
|
35
54
|
* `list_storage_buckets`: Lists all storage buckets.
|
|
36
55
|
* `list_storage_objects`: Lists objects within a specific bucket.
|
|
@@ -51,7 +70,93 @@ For example, when you ask an AI assistant "List all tables in my database", it w
|
|
|
51
70
|
|
|
52
71
|
## Setup and Installation
|
|
53
72
|
|
|
54
|
-
###
|
|
73
|
+
### Alibaba Cloud Mode Setup
|
|
74
|
+
|
|
75
|
+
#### Quick Start with npx
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx @aliyun-rds/supabase-mcp-server \
|
|
79
|
+
--aliyun-ak YOUR_ACCESS_KEY_ID \
|
|
80
|
+
--aliyun-sk YOUR_ACCESS_KEY_SECRET \
|
|
81
|
+
--aliyun-region cn-hangzhou
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Important**: The `--aliyun-region` parameter is **required**. Without it, the API will return empty instance lists even though no error is reported. Common regions include:
|
|
85
|
+
- `cn-hangzhou` (China East 1)
|
|
86
|
+
- `cn-beijing` (China North 2)
|
|
87
|
+
- `cn-shanghai` (China East 2)
|
|
88
|
+
- `cn-shenzhen` (China South 1)
|
|
89
|
+
|
|
90
|
+
#### Configuration for Claude Desktop
|
|
91
|
+
|
|
92
|
+
Add to your `claude_desktop_config.json`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"aliyun-supabase": {
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": [
|
|
100
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
101
|
+
"--aliyun-ak", "YOUR_ACCESS_KEY_ID",
|
|
102
|
+
"--aliyun-sk", "YOUR_ACCESS_KEY_SECRET",
|
|
103
|
+
"--aliyun-region", "cn-hangzhou"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**With RAG Agent integration:**
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"aliyun-supabase": {
|
|
116
|
+
"command": "npx",
|
|
117
|
+
"args": [
|
|
118
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
119
|
+
"--aliyun-ak", "YOUR_ACCESS_KEY_ID",
|
|
120
|
+
"--aliyun-sk", "YOUR_ACCESS_KEY_SECRET",
|
|
121
|
+
"--aliyun-region", "cn-hangzhou",
|
|
122
|
+
"--enable-rag-agent"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Or use environment variables:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"mcpServers": {
|
|
134
|
+
"aliyun-supabase": {
|
|
135
|
+
"command": "npx",
|
|
136
|
+
"args": [
|
|
137
|
+
"@aliyun-rds/supabase-mcp-server",
|
|
138
|
+
"--enable-rag-agent"
|
|
139
|
+
],
|
|
140
|
+
"env": {
|
|
141
|
+
"ALIYUN_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_ID",
|
|
142
|
+
"ALIYUN_ACCESS_KEY_SECRET": "YOUR_ACCESS_KEY_SECRET",
|
|
143
|
+
"ALIYUN_REGION": "cn-hangzhou"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Usage Workflow
|
|
151
|
+
|
|
152
|
+
1. **List instances**: Use `list_aliyun_supabase_instances` to see all your Supabase instances
|
|
153
|
+
2. **Connect**: Use `connect_to_supabase_instance` with the instance name
|
|
154
|
+
3. **Use tools**: Now you can use all Supabase tools (list_tables, execute_sql, etc.)
|
|
155
|
+
4. **Disconnect** (optional): Use `disconnect_supabase_instance` to switch instances
|
|
156
|
+
|
|
157
|
+
### Legacy Mode Setup
|
|
158
|
+
|
|
159
|
+
#### Method 1: Using npx (Recommended)
|
|
55
160
|
|
|
56
161
|
The easiest way to use this server is via npx, which requires no installation:
|
|
57
162
|
|
|
@@ -107,6 +212,16 @@ If you want to build from source:
|
|
|
107
212
|
|
|
108
213
|
The server requires configuration details for your Supabase instance. These can be provided via command-line arguments or environment variables. CLI arguments take precedence.
|
|
109
214
|
|
|
215
|
+
### Alibaba Cloud Mode Parameters
|
|
216
|
+
|
|
217
|
+
**Required:**
|
|
218
|
+
|
|
219
|
+
* `--aliyun-ak <key>` or `ALIYUN_ACCESS_KEY_ID=<key>`: Your Alibaba Cloud Access Key ID.
|
|
220
|
+
* `--aliyun-sk <secret>` or `ALIYUN_ACCESS_KEY_SECRET=<secret>`: Your Alibaba Cloud Access Key Secret.
|
|
221
|
+
* `--aliyun-region <region>` or `ALIYUN_REGION=<region>`: **Required**. The Alibaba Cloud region where your Supabase instances are deployed (e.g., `cn-hangzhou`, `cn-beijing`). Without this parameter, the API will return empty instance lists.
|
|
222
|
+
|
|
223
|
+
### Legacy Mode Parameters
|
|
224
|
+
|
|
110
225
|
**Required:**
|
|
111
226
|
|
|
112
227
|
* `--url <url>` or `SUPABASE_URL=<url>`: The main HTTP URL of your Supabase project (e.g., `http://localhost:8000`).
|
|
@@ -126,15 +241,25 @@ This server can integrate with [rag-agent-mcp](https://pypi.org/project/rag-agen
|
|
|
126
241
|
|
|
127
242
|
**How it works:**
|
|
128
243
|
- When `--enable-rag-agent` is set, the server automatically connects to a rag-agent MCP server
|
|
129
|
-
- The host and port are extracted from your `--url` parameter (e.g., `http://
|
|
244
|
+
- The host and port are extracted from your `--url` parameter (e.g., `http://your-server:8080` → host: `your-server`, port: `8080`)
|
|
130
245
|
- The `--anon-key` value is used as the API key for authenticating with rag-agent
|
|
131
|
-
- All rag-agent tools are prefixed with `rag_` to avoid naming conflicts (e.g., `
|
|
246
|
+
- All rag-agent tools are prefixed with `rag_` to avoid naming conflicts (e.g., `rag_create_collection`, `rag_add_documents`, `rag_query`)
|
|
132
247
|
|
|
133
248
|
**Example configuration:**
|
|
134
249
|
```bash
|
|
135
250
|
npx @aliyun-rds/supabase-mcp-server \
|
|
136
|
-
--url http://
|
|
137
|
-
--anon-key "
|
|
251
|
+
--url http://your-supabase-url:port \
|
|
252
|
+
--anon-key "your-anon-key-here" \
|
|
253
|
+
--service-key "your-service-key-here" \
|
|
254
|
+
--enable-rag-agent
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Alibaba Cloud Mode with RAG Agent:**
|
|
258
|
+
```bash
|
|
259
|
+
npx @aliyun-rds/supabase-mcp-server \
|
|
260
|
+
--aliyun-ak YOUR_ACCESS_KEY_ID \
|
|
261
|
+
--aliyun-sk YOUR_ACCESS_KEY_SECRET \
|
|
262
|
+
--aliyun-region cn-hangzhou \
|
|
138
263
|
--enable-rag-agent
|
|
139
264
|
```
|
|
140
265
|
|
|
@@ -143,6 +268,10 @@ npx @aliyun-rds/supabase-mcp-server \
|
|
|
143
268
|
- `rag-agent-mcp` package must be available via `uvx`
|
|
144
269
|
- The rag-agent service must be running at the specified host and port
|
|
145
270
|
|
|
271
|
+
**Behavior Differences:**
|
|
272
|
+
- **Legacy Mode**: RAG Agent tools are initialized immediately and available after server startup
|
|
273
|
+
- **Alibaba Cloud Mode**: RAG Agent tools are listed at startup but only become functional after connecting to a Supabase instance using `connect_to_supabase_instance` tool
|
|
274
|
+
|
|
146
275
|
### Important Notes:
|
|
147
276
|
|
|
148
277
|
* **`execute_sql` Helper Function:** Many tools rely on a `public.execute_sql` function within your Supabase database for secure and efficient SQL execution via RPC. The server attempts to check for this function on startup. If it's missing *and* a `service-key` (or `SUPABASE_SERVICE_ROLE_KEY`) *and* `db-url` (or `DATABASE_URL`) are provided, it will attempt to create the function and grant necessary permissions. If creation fails or keys aren't provided, tools relying solely on RPC may fail.
|
|
@@ -198,14 +327,14 @@ If you want to use this server with both Supabase and RAG Agent tools, configure
|
|
|
198
327
|
"remote-selfhosted-supabase": {
|
|
199
328
|
"command": "ssh",
|
|
200
329
|
"args": [
|
|
201
|
-
"
|
|
202
|
-
"cd /
|
|
330
|
+
"user@your-server-ip",
|
|
331
|
+
"cd /path/to/selfhosted-supabase-mcp && node dist/index.js",
|
|
203
332
|
"--url",
|
|
204
|
-
"http://
|
|
333
|
+
"http://your-supabase-url:port",
|
|
205
334
|
"--anon-key",
|
|
206
|
-
"
|
|
335
|
+
"your-anon-key-here",
|
|
207
336
|
"--service-key",
|
|
208
|
-
"
|
|
337
|
+
"your-service-key-here",
|
|
209
338
|
"--enable-rag-agent"
|
|
210
339
|
]
|
|
211
340
|
}
|
|
@@ -215,9 +344,15 @@ If you want to use this server with both Supabase and RAG Agent tools, configure
|
|
|
215
344
|
|
|
216
345
|
In this configuration:
|
|
217
346
|
- The server runs on a remote machine via SSH
|
|
218
|
-
- It connects to Supabase at
|
|
219
|
-
- RAG Agent integration
|
|
347
|
+
- It connects to Supabase at the specified URL
|
|
348
|
+
- `--enable-rag-agent` enables RAG Agent integration
|
|
349
|
+
- RAG Agent will automatically connect to the same host:port extracted from `--url`
|
|
220
350
|
- Both Supabase and RAG Agent tools will be available to your AI assistant
|
|
351
|
+
|
|
352
|
+
**Important Notes for RAG Agent:**
|
|
353
|
+
- In **Legacy Mode**: RAG Agent tools are available immediately after server startup
|
|
354
|
+
- In **Alibaba Cloud Mode**: RAG Agent tools are listed at startup but only work after connecting to a Supabase instance using `connect_to_supabase_instance`
|
|
355
|
+
- All RAG Agent tools are prefixed with `rag_` (e.g., `rag_create_collection`, `rag_add_documents`, `rag_query`)
|
|
221
356
|
```
|
|
222
357
|
|
|
223
358
|
### Claude for Desktop
|