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
@@ -120,9 +122,51 @@ export function createSupabaseMcpServer(options: SupabaseMcpServerOptions) {
120
122
returnresponse.data;
121
123
},
122
124
}),
125
+
get_cost: tool({
126
+
description:
127
+
'Gets the cost of creating a new project or branch. Never assume organization as costs can be different for each.',
128
+
parameters: z.object({
129
+
type: z.enum(['project','branch']),
130
+
organization_id: z
131
+
.string()
132
+
.describe('The organization ID. Always ask the user.'),
133
+
}),
134
+
execute: async({ type, organization_id })=>{
135
+
functiongenerateResponse(cost: Cost){
136
+
return`The new ${type} will cost $${cost.amount}${cost.recurrence}. You must repeat this to the user and confirm their understanding.`;
137
+
}
138
+
switch(type){
139
+
case'project': {
140
+
constcost=awaitgetNextProjectCost(
141
+
managementApiClient,
142
+
organization_id
143
+
);
144
+
returngenerateResponse(cost);
145
+
}
146
+
case'branch': {
147
+
constcost=getBranchCost();
148
+
returngenerateResponse(cost);
149
+
}
150
+
default:
151
+
thrownewError(`Unknown cost type: ${type}`);
152
+
}
153
+
},
154
+
}),
155
+
confirm_cost: tool({
156
+
description:
157
+
'Ask the user to confirm their understanding of the cost of creating a new project or branch. Call `get_cost` first. Returns a unique ID for this confirmation which should be passed to `create_project` or `create_branch`.',
158
+
parameters: z.object({
159
+
type: z.enum(['project','branch']),
160
+
recurrence: z.enum(['hourly','monthly']),
161
+
amount: z.number(),
162
+
}),
163
+
execute: async(cost)=>{
164
+
returnawaithashObject(cost);
165
+
},
166
+
}),
123
167
create_project: tool({
124
168
description:
125
-
'Creates a new Supabase project. Always ask the user which organization to create the project in. Each new project can incur additional costs: If on a free org, the user gets 2 projects for free. On a paid org, the user should reference https://supabase.com/pricing. Confirm that the user understands this before creating new projects. The project can take a few minutes to initialize - use `getProject` to check the status.',
169
+
'Creates a new Supabase project. Always ask the user which organization to create the project in. The project can take a few minutes to initialize - use `get_project` to check the status.',
126
170
parameters: z.object({
127
171
name: z.string().describe('The name of the project'),
128
172
region: z.optional(
@@ -133,8 +177,28 @@ export function createSupabaseMcpServer(options: SupabaseMcpServerOptions) {
@@ -320,7 +384,7 @@ export function createSupabaseMcpServer(options: SupabaseMcpServerOptions) {
320
384
}),
321
385
execute_sql: tool({
322
386
description:
323
-
'Executes raw SQL in the Postgres database. Use `applyMigration` instead for DDL operations.',
387
+
'Executes raw SQL in the Postgres database. Use `apply_migration` instead for DDL operations.',
324
388
parameters: z.object({
325
389
project_id: z.string(),
326
390
query: z.string().describe('The SQL query to execute'),
@@ -441,15 +505,29 @@ export function createSupabaseMcpServer(options: SupabaseMcpServerOptions) {
441
505
// Experimental features
442
506
create_branch: tool({
443
507
description:
444
-
'Creates a development branch on a Supabase project. This will apply all migrations from the main project to a fresh branch database. Note that production data will not carry over. The branch will get its own project_id via the resulting project_ref. Use this ID to execute queries and migrations on the branch. Branching is only available on a paid org and each branch will incur additional costs. You must confirm that the user understands these costs before calling this function. Details here: https://supabase.com/docs/guides/deployment/branching#pricing',
508
+
'Creates a development branch on a Supabase project. This will apply all migrations from the main project to a fresh branch database. Note that production data will not carry over. The branch will get its own project_id via the resulting project_ref. Use this ID to execute queries and migrations on the branch.',
445
509
parameters: z.object({
446
510
project_id: z.string(),
447
-
name: z
511
+
name: z.string().describe('Name of the branch to create'),
0 commit comments