@supabase/mcp-server-supabase 0.19.0 → 0.20.0

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.
Files changed (45) hide show
  1. package/dist/chunk-6CWFTRTZ.js +17 -0
  2. package/dist/chunk-6CWFTRTZ.js.map +1 -0
  3. package/dist/{chunk-C4YUF27U.cjs → chunk-A5FTNCK3.cjs} +2 -2
  4. package/dist/{chunk-C4YUF27U.cjs.map → chunk-A5FTNCK3.cjs.map} +1 -1
  5. package/dist/chunk-A64X45AF.cjs +17 -0
  6. package/dist/chunk-A64X45AF.cjs.map +1 -0
  7. package/dist/chunk-FL2XNMHU.cjs +295 -0
  8. package/dist/chunk-FL2XNMHU.cjs.map +1 -0
  9. package/dist/chunk-HNZQTPXQ.cjs +2 -0
  10. package/dist/chunk-HNZQTPXQ.cjs.map +1 -0
  11. package/dist/chunk-JJFVFIBB.js +2 -0
  12. package/dist/chunk-JJFVFIBB.js.map +1 -0
  13. package/dist/chunk-JR6WQZBY.js +295 -0
  14. package/dist/chunk-JR6WQZBY.js.map +1 -0
  15. package/dist/{chunk-6DARTJRP.js → chunk-SS4B4LYS.js} +2 -2
  16. package/dist/{chunk-6DARTJRP.js.map → chunk-SS4B4LYS.js.map} +1 -1
  17. package/dist/cli.cjs +1 -1
  18. package/dist/cli.js +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.d.cts +148 -5
  21. package/dist/index.d.ts +148 -5
  22. package/dist/index.js +1 -1
  23. package/dist/platform/api-platform.cjs +1 -1
  24. package/dist/platform/api-platform.d.cts +1 -1
  25. package/dist/platform/api-platform.d.ts +1 -1
  26. package/dist/platform/api-platform.js +1 -1
  27. package/dist/platform/index.cjs +1 -1
  28. package/dist/platform/index.d.cts +4 -3
  29. package/dist/platform/index.d.ts +4 -3
  30. package/dist/platform/index.js +1 -1
  31. package/dist/{types-abfpaWQw.d.ts → types-Ckih0oCv.d.cts} +15 -5
  32. package/dist/{types-abfpaWQw.d.cts → types-Ckih0oCv.d.ts} +15 -5
  33. package/package.json +2 -2
  34. package/dist/chunk-3BFHAE72.js +0 -17
  35. package/dist/chunk-3BFHAE72.js.map +0 -1
  36. package/dist/chunk-6QB2YXYQ.cjs +0 -17
  37. package/dist/chunk-6QB2YXYQ.cjs.map +0 -1
  38. package/dist/chunk-DG3LSIFH.cjs +0 -2
  39. package/dist/chunk-DG3LSIFH.cjs.map +0 -1
  40. package/dist/chunk-OO7IZCN3.cjs +0 -295
  41. package/dist/chunk-OO7IZCN3.cjs.map +0 -1
  42. package/dist/chunk-WAYAYNQY.js +0 -295
  43. package/dist/chunk-WAYAYNQY.js.map +0 -1
  44. package/dist/chunk-YW7R6DLX.js +0 -2
  45. package/dist/chunk-YW7R6DLX.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a,b as p,c as s,d as c,h as n,i,j as e}from"./chunk-WAYAYNQY.js";import{a as r,d as t}from"./chunk-6DARTJRP.js";import"./chunk-3BFHAE72.js";import{isToolCallerError as E,ToolCallerError as x}from"@supabase/mcp-utils";import{createMcpHandler as l}from"@modelcontextprotocol/server";function m(o){return l(()=>e(o),{legacy:"reject"})}var S=r.version;export{p as CREATE_BRANCH_UI_URI,a as CREATE_PROJECT_UI_URI,s as CURRENT_ELICITATION_TOOLS,c as CURRENT_FEATURE_GROUPS,x as ToolCallerError,t as createFeedbackOperations,m as createSupabaseMcpHandler,e as createSupabaseMcpServer,i as createToolSchemas,E as isToolCallerError,n as supabaseMcpToolSchemas,S as version};
1
+ import{a,b as p,c as s,d as c,h as n,i,j as e}from"./chunk-JR6WQZBY.js";import{a as r,d as t}from"./chunk-SS4B4LYS.js";import"./chunk-6CWFTRTZ.js";import{isToolCallerError as E,ToolCallerError as x}from"@supabase/mcp-utils";import{createMcpHandler as l}from"@modelcontextprotocol/server";function m(o){return l(()=>e(o),{legacy:"reject"})}var S=r.version;export{p as CREATE_BRANCH_UI_URI,a as CREATE_PROJECT_UI_URI,s as CURRENT_ELICITATION_TOOLS,c as CURRENT_FEATURE_GROUPS,x as ToolCallerError,t as createFeedbackOperations,m as createSupabaseMcpHandler,e as createSupabaseMcpServer,i as createToolSchemas,E as isToolCallerError,n as supabaseMcpToolSchemas,S as version};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDG3LSIFHcjs = require('../chunk-DG3LSIFH.cjs');require('../chunk-C4YUF27U.cjs');require('../chunk-VV4YSLRO.cjs');require('../chunk-6QB2YXYQ.cjs');exports.createSupabaseApiPlatform = _chunkDG3LSIFHcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHNZQTPXQcjs = require('../chunk-HNZQTPXQ.cjs');require('../chunk-A5FTNCK3.cjs');require('../chunk-VV4YSLRO.cjs');require('../chunk-A64X45AF.cjs');exports.createSupabaseApiPlatform = _chunkHNZQTPXQcjs.a;
2
2
  //# sourceMappingURL=api-platform.cjs.map
@@ -1,4 +1,4 @@
1
- import { S as SupabasePlatform } from '../types-abfpaWQw.cjs';
1
+ import { S as SupabasePlatform } from '../types-Ckih0oCv.cjs';
2
2
  import '@supabase/mcp-utils';
3
3
  import 'zod/v4';
4
4
 
@@ -1,4 +1,4 @@
1
- import { S as SupabasePlatform } from '../types-abfpaWQw.js';
1
+ import { S as SupabasePlatform } from '../types-Ckih0oCv.js';
2
2
  import '@supabase/mcp-utils';
3
3
  import 'zod/v4';
4
4
 
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-YW7R6DLX.js";import"../chunk-6DARTJRP.js";import"../chunk-W6H5VMAV.js";import"../chunk-3BFHAE72.js";export{a as createSupabaseApiPlatform};
1
+ import{a}from"../chunk-JJFVFIBB.js";import"../chunk-SS4B4LYS.js";import"../chunk-W6H5VMAV.js";import"../chunk-6CWFTRTZ.js";export{a as createSupabaseApiPlatform};
2
2
  //# sourceMappingURL=api-platform.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-VV4YSLRO.cjs');var _chunk6QB2YXYQcjs = require('../chunk-6QB2YXYQ.cjs');exports.DEFAULT_IMPORT_MAP_FILENAMES = _chunk6QB2YXYQcjs.d; exports.ResultTooLargeError = _chunk6QB2YXYQcjs.s; exports.apiKeyTypeSchema = _chunk6QB2YXYQcjs.E; exports.applyMigrationOptionsSchema = _chunk6QB2YXYQcjs.u; exports.branchSchema = _chunk6QB2YXYQcjs.l; exports.createBranchOptionsSchema = _chunk6QB2YXYQcjs.p; exports.createNotebookOptionsSchema = _chunk6QB2YXYQcjs.B; exports.createProjectOptionsSchema = _chunk6QB2YXYQcjs.o; exports.deployEdgeFunctionOptionsSchema = _chunk6QB2YXYQcjs.r; exports.edgeFunctionSchema = _chunk6QB2YXYQcjs.m; exports.edgeFunctionWithBodySchema = _chunk6QB2YXYQcjs.n; exports.executeSqlOptionsSchema = _chunk6QB2YXYQcjs.t; exports.generateTypescriptTypesResultSchema = _chunk6QB2YXYQcjs.z; exports.getDefaultImportMapPath = _chunk6QB2YXYQcjs.e; exports.getLogsOptionsSchema = _chunk6QB2YXYQcjs.x; exports.logsServiceSchema = _chunk6QB2YXYQcjs.w; exports.migrationSchema = _chunk6QB2YXYQcjs.v; exports.notebookCellSchema = _chunk6QB2YXYQcjs.A; exports.notebookSchema = _chunk6QB2YXYQcjs.C; exports.notebookWithContentSchema = _chunk6QB2YXYQcjs.D; exports.organizationSchema = _chunk6QB2YXYQcjs.j; exports.projectSchema = _chunk6QB2YXYQcjs.k; exports.queryLogsOptionsSchema = _chunk6QB2YXYQcjs.y; exports.resetBranchOptionsSchema = _chunk6QB2YXYQcjs.q; exports.storageBucketSchema = _chunk6QB2YXYQcjs.h; exports.storageConfigSchema = _chunk6QB2YXYQcjs.i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-VV4YSLRO.cjs');var _chunkA64X45AFcjs = require('../chunk-A64X45AF.cjs');exports.DEFAULT_IMPORT_MAP_FILENAMES = _chunkA64X45AFcjs.d; exports.ResultTooLargeError = _chunkA64X45AFcjs.s; exports.apiKeyTypeSchema = _chunkA64X45AFcjs.E; exports.applyMigrationOptionsSchema = _chunkA64X45AFcjs.u; exports.branchSchema = _chunkA64X45AFcjs.l; exports.createBranchOptionsSchema = _chunkA64X45AFcjs.p; exports.createNotebookOptionsSchema = _chunkA64X45AFcjs.B; exports.createProjectOptionsSchema = _chunkA64X45AFcjs.o; exports.deployEdgeFunctionOptionsSchema = _chunkA64X45AFcjs.r; exports.edgeFunctionSchema = _chunkA64X45AFcjs.m; exports.edgeFunctionWithBodySchema = _chunkA64X45AFcjs.n; exports.executeSqlOptionsSchema = _chunkA64X45AFcjs.t; exports.generateTypescriptTypesResultSchema = _chunkA64X45AFcjs.z; exports.getDefaultImportMapPath = _chunkA64X45AFcjs.e; exports.getLogsOptionsSchema = _chunkA64X45AFcjs.x; exports.logsServiceSchema = _chunkA64X45AFcjs.w; exports.migrationSchema = _chunkA64X45AFcjs.v; exports.notebookCellSchema = _chunkA64X45AFcjs.A; exports.notebookSchema = _chunkA64X45AFcjs.C; exports.notebookWithContentSchema = _chunkA64X45AFcjs.D; exports.organizationSchema = _chunkA64X45AFcjs.j; exports.projectSchema = _chunkA64X45AFcjs.k; exports.queryLogsOptionsSchema = _chunkA64X45AFcjs.y; exports.resetBranchOptionsSchema = _chunkA64X45AFcjs.q; exports.storageBucketSchema = _chunkA64X45AFcjs.h; exports.storageConfigSchema = _chunkA64X45AFcjs.i;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- export { X as AccountOperations, a1 as ApiKey, a0 as ApiKeyType, F as ApplyMigrationOptions, B as Branch, a4 as BranchingOperations, y as CreateBranchOptions, T as CreateNotebookOptions, C as CreateProjectOptions, W as DatabaseOperations, _ as DebuggingOperations, D as DeployEdgeFunctionOptions, a2 as DevelopmentOperations, E as EdgeFunction, x as EdgeFunctionWithBody, Y as EdgeFunctionsOperations, A as ExecuteSqlOptions, a7 as FeedbackOperations, I as GenerateTypescriptTypesResult, H as GetLogsOptions, L as ListMigrationsResult, Z as LogsDialect, G as LogsService, M as Migration, U as Notebook, N as NotebookCell, a6 as NotebookOperations, V as NotebookWithContent, O as Organization, P as Project, Q as QueryLogsOptions, z as ResetBranchOptions, R as ResultTooLargeError, a5 as SecretOperations, K as StorageBucket, J as StorageConfig, a3 as StorageOperations, a as SuccessResponse, S as SupabasePlatform, $ as apiKeyTypeSchema, j as applyMigrationOptionsSchema, c as branchSchema, g as createBranchOptionsSchema, u as createNotebookOptionsSchema, f as createProjectOptionsSchema, h as deployEdgeFunctionOptionsSchema, e as edgeFunctionSchema, d as edgeFunctionWithBodySchema, i as executeSqlOptionsSchema, n as generateTypescriptTypesResultSchema, k as getLogsOptionsSchema, l as logsServiceSchema, m as migrationSchema, t as notebookCellSchema, v as notebookSchema, w as notebookWithContentSchema, o as organizationSchema, p as projectSchema, q as queryLogsOptionsSchema, r as resetBranchOptionsSchema, s as storageBucketSchema, b as storageConfigSchema } from '../types-abfpaWQw.cjs';
1
+ export { X as AccountOperations, a1 as ApiKey, a0 as ApiKeyType, F as ApplyMigrationOptions, B as Branch, a5 as BranchingOperations, y as CreateBranchOptions, T as CreateNotebookOptions, C as CreateProjectOptions, W as DatabaseOperations, _ as DebuggingOperations, D as DeployEdgeFunctionOptions, a3 as DevelopmentOperations, E as EdgeFunction, x as EdgeFunctionWithBody, Y as EdgeFunctionsOperations, A as ExecuteSqlOptions, a8 as FeedbackOperations, a2 as GenerateTypescriptTypesOptions, I as GenerateTypescriptTypesResult, H as GetLogsOptions, L as ListMigrationsResult, Z as LogsDialect, G as LogsService, M as Migration, U as Notebook, N as NotebookCell, a7 as NotebookOperations, V as NotebookWithContent, O as Organization, P as Project, Q as QueryLogsOptions, z as ResetBranchOptions, R as ResultTooLargeError, a6 as SecretOperations, K as StorageBucket, J as StorageConfig, a4 as StorageOperations, a as SuccessResponse, S as SupabasePlatform, $ as apiKeyTypeSchema, j as applyMigrationOptionsSchema, c as branchSchema, g as createBranchOptionsSchema, u as createNotebookOptionsSchema, f as createProjectOptionsSchema, h as deployEdgeFunctionOptionsSchema, e as edgeFunctionSchema, d as edgeFunctionWithBodySchema, i as executeSqlOptionsSchema, n as generateTypescriptTypesResultSchema, k as getLogsOptionsSchema, l as logsServiceSchema, m as migrationSchema, t as notebookCellSchema, v as notebookSchema, w as notebookWithContentSchema, o as organizationSchema, p as projectSchema, q as queryLogsOptionsSchema, r as resetBranchOptionsSchema, s as storageBucketSchema, b as storageConfigSchema } from '../types-Ckih0oCv.cjs';
2
2
  import '@supabase/mcp-utils';
3
3
  import 'zod/v4';
4
4
 
@@ -10,10 +10,11 @@ import 'zod/v4';
10
10
  declare const DEFAULT_IMPORT_MAP_FILENAMES: readonly ["deno.json", "deno.jsonc", "import_map.json"];
11
11
  /**
12
12
  * Picks the import map to deploy with when none was given or previously set,
13
- * independent of the order the files were passed in.
13
+ * independent of the order the files were passed in. Matches names with or
14
+ * without a leading `./` and returns the name as given.
14
15
  */
15
16
  declare function getDefaultImportMapPath(files: {
16
17
  name: string;
17
- }[]): "deno.json" | "deno.jsonc" | "import_map.json" | undefined;
18
+ }[]): string | undefined;
18
19
 
19
20
  export { DEFAULT_IMPORT_MAP_FILENAMES, getDefaultImportMapPath };
@@ -1,4 +1,4 @@
1
- export { X as AccountOperations, a1 as ApiKey, a0 as ApiKeyType, F as ApplyMigrationOptions, B as Branch, a4 as BranchingOperations, y as CreateBranchOptions, T as CreateNotebookOptions, C as CreateProjectOptions, W as DatabaseOperations, _ as DebuggingOperations, D as DeployEdgeFunctionOptions, a2 as DevelopmentOperations, E as EdgeFunction, x as EdgeFunctionWithBody, Y as EdgeFunctionsOperations, A as ExecuteSqlOptions, a7 as FeedbackOperations, I as GenerateTypescriptTypesResult, H as GetLogsOptions, L as ListMigrationsResult, Z as LogsDialect, G as LogsService, M as Migration, U as Notebook, N as NotebookCell, a6 as NotebookOperations, V as NotebookWithContent, O as Organization, P as Project, Q as QueryLogsOptions, z as ResetBranchOptions, R as ResultTooLargeError, a5 as SecretOperations, K as StorageBucket, J as StorageConfig, a3 as StorageOperations, a as SuccessResponse, S as SupabasePlatform, $ as apiKeyTypeSchema, j as applyMigrationOptionsSchema, c as branchSchema, g as createBranchOptionsSchema, u as createNotebookOptionsSchema, f as createProjectOptionsSchema, h as deployEdgeFunctionOptionsSchema, e as edgeFunctionSchema, d as edgeFunctionWithBodySchema, i as executeSqlOptionsSchema, n as generateTypescriptTypesResultSchema, k as getLogsOptionsSchema, l as logsServiceSchema, m as migrationSchema, t as notebookCellSchema, v as notebookSchema, w as notebookWithContentSchema, o as organizationSchema, p as projectSchema, q as queryLogsOptionsSchema, r as resetBranchOptionsSchema, s as storageBucketSchema, b as storageConfigSchema } from '../types-abfpaWQw.js';
1
+ export { X as AccountOperations, a1 as ApiKey, a0 as ApiKeyType, F as ApplyMigrationOptions, B as Branch, a5 as BranchingOperations, y as CreateBranchOptions, T as CreateNotebookOptions, C as CreateProjectOptions, W as DatabaseOperations, _ as DebuggingOperations, D as DeployEdgeFunctionOptions, a3 as DevelopmentOperations, E as EdgeFunction, x as EdgeFunctionWithBody, Y as EdgeFunctionsOperations, A as ExecuteSqlOptions, a8 as FeedbackOperations, a2 as GenerateTypescriptTypesOptions, I as GenerateTypescriptTypesResult, H as GetLogsOptions, L as ListMigrationsResult, Z as LogsDialect, G as LogsService, M as Migration, U as Notebook, N as NotebookCell, a7 as NotebookOperations, V as NotebookWithContent, O as Organization, P as Project, Q as QueryLogsOptions, z as ResetBranchOptions, R as ResultTooLargeError, a6 as SecretOperations, K as StorageBucket, J as StorageConfig, a4 as StorageOperations, a as SuccessResponse, S as SupabasePlatform, $ as apiKeyTypeSchema, j as applyMigrationOptionsSchema, c as branchSchema, g as createBranchOptionsSchema, u as createNotebookOptionsSchema, f as createProjectOptionsSchema, h as deployEdgeFunctionOptionsSchema, e as edgeFunctionSchema, d as edgeFunctionWithBodySchema, i as executeSqlOptionsSchema, n as generateTypescriptTypesResultSchema, k as getLogsOptionsSchema, l as logsServiceSchema, m as migrationSchema, t as notebookCellSchema, v as notebookSchema, w as notebookWithContentSchema, o as organizationSchema, p as projectSchema, q as queryLogsOptionsSchema, r as resetBranchOptionsSchema, s as storageBucketSchema, b as storageConfigSchema } from '../types-Ckih0oCv.js';
2
2
  import '@supabase/mcp-utils';
3
3
  import 'zod/v4';
4
4
 
@@ -10,10 +10,11 @@ import 'zod/v4';
10
10
  declare const DEFAULT_IMPORT_MAP_FILENAMES: readonly ["deno.json", "deno.jsonc", "import_map.json"];
11
11
  /**
12
12
  * Picks the import map to deploy with when none was given or previously set,
13
- * independent of the order the files were passed in.
13
+ * independent of the order the files were passed in. Matches names with or
14
+ * without a leading `./` and returns the name as given.
14
15
  */
15
16
  declare function getDefaultImportMapPath(files: {
16
17
  name: string;
17
- }[]): "deno.json" | "deno.jsonc" | "import_map.json" | undefined;
18
+ }[]): string | undefined;
18
19
 
19
20
  export { DEFAULT_IMPORT_MAP_FILENAMES, getDefaultImportMapPath };
@@ -1,2 +1,2 @@
1
- import"../chunk-W6H5VMAV.js";import{A as v,B as w,C as x,D as y,E as z,d as a,e as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"../chunk-3BFHAE72.js";export{a as DEFAULT_IMPORT_MAP_FILENAMES,n as ResultTooLargeError,z as apiKeyTypeSchema,p as applyMigrationOptionsSchema,g as branchSchema,k as createBranchOptionsSchema,w as createNotebookOptionsSchema,j as createProjectOptionsSchema,m as deployEdgeFunctionOptionsSchema,h as edgeFunctionSchema,i as edgeFunctionWithBodySchema,o as executeSqlOptionsSchema,u as generateTypescriptTypesResultSchema,b as getDefaultImportMapPath,s as getLogsOptionsSchema,r as logsServiceSchema,q as migrationSchema,v as notebookCellSchema,x as notebookSchema,y as notebookWithContentSchema,e as organizationSchema,f as projectSchema,t as queryLogsOptionsSchema,l as resetBranchOptionsSchema,c as storageBucketSchema,d as storageConfigSchema};
1
+ import"../chunk-W6H5VMAV.js";import{A as v,B as w,C as x,D as y,E as z,d as a,e as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"../chunk-6CWFTRTZ.js";export{a as DEFAULT_IMPORT_MAP_FILENAMES,n as ResultTooLargeError,z as apiKeyTypeSchema,p as applyMigrationOptionsSchema,g as branchSchema,k as createBranchOptionsSchema,w as createNotebookOptionsSchema,j as createProjectOptionsSchema,m as deployEdgeFunctionOptionsSchema,h as edgeFunctionSchema,i as edgeFunctionWithBodySchema,o as executeSqlOptionsSchema,u as generateTypescriptTypesResultSchema,b as getDefaultImportMapPath,s as getLogsOptionsSchema,r as logsServiceSchema,q as migrationSchema,v as notebookCellSchema,x as notebookSchema,y as notebookWithContentSchema,e as organizationSchema,f as projectSchema,t as queryLogsOptionsSchema,l as resetBranchOptionsSchema,c as storageBucketSchema,d as storageConfigSchema};
2
2
  //# sourceMappingURL=index.js.map
@@ -498,9 +498,15 @@ type DebuggingOperations = {
498
498
  logsDialect?: LogsDialect;
499
499
  getLogs(projectId: string, options: GetLogsOptions): Promise<unknown>;
500
500
  queryLogs?(projectId: string, options: QueryLogsOptions): Promise<unknown>;
501
- getSecurityAdvisors(projectId: string): Promise<unknown>;
502
- getPerformanceAdvisors(projectId: string): Promise<unknown>;
503
- getHealthAdvisors?(projectId: string): Promise<unknown>;
501
+ getSecurityAdvisors(projectId: string, options?: {
502
+ includeUnavailable?: boolean;
503
+ }): Promise<unknown>;
504
+ getPerformanceAdvisors(projectId: string, options?: {
505
+ includeUnavailable?: boolean;
506
+ }): Promise<unknown>;
507
+ getHealthAdvisors?(projectId: string, options?: {
508
+ includeUnavailable?: boolean;
509
+ }): Promise<unknown>;
504
510
  };
505
511
  declare const apiKeyTypeSchema: z.ZodEnum<{
506
512
  legacy: "legacy";
@@ -515,10 +521,14 @@ type ApiKey = {
515
521
  id?: string;
516
522
  disabled?: boolean;
517
523
  };
524
+ type GenerateTypescriptTypesOptions = {
525
+ /** Schemas to generate types for. Omitted means the API default (`public`). */
526
+ schemas?: string[];
527
+ };
518
528
  type DevelopmentOperations = {
519
529
  getProjectUrl(projectId: string): Promise<string>;
520
530
  getPublishableKeys(projectId: string): Promise<ApiKey[]>;
521
- generateTypescriptTypes(projectId: string): Promise<GenerateTypescriptTypesResult>;
531
+ generateTypescriptTypes(projectId: string, options?: GenerateTypescriptTypesOptions): Promise<GenerateTypescriptTypesResult>;
522
532
  };
523
533
  type StorageOperations = {
524
534
  getStorageConfig(projectId: string): Promise<StorageConfig>;
@@ -579,4 +589,4 @@ type SupabasePlatform = {
579
589
  feedback?: FeedbackOperations;
580
590
  };
581
591
 
582
- export { apiKeyTypeSchema as $, type ExecuteSqlOptions as A, type Branch as B, type CreateProjectOptions as C, type DeployEdgeFunctionOptions as D, type EdgeFunction as E, type ApplyMigrationOptions as F, type LogsService as G, type GetLogsOptions as H, type GenerateTypescriptTypesResult as I, type StorageConfig as J, type StorageBucket as K, type ListMigrationsResult as L, type Migration as M, type NotebookCell as N, type Organization as O, type Project as P, type QueryLogsOptions as Q, ResultTooLargeError as R, type SupabasePlatform as S, type CreateNotebookOptions as T, type Notebook as U, type NotebookWithContent as V, type DatabaseOperations as W, type AccountOperations as X, type EdgeFunctionsOperations as Y, type LogsDialect as Z, type DebuggingOperations as _, type SuccessResponse as a, type ApiKeyType as a0, type ApiKey as a1, type DevelopmentOperations as a2, type StorageOperations as a3, type BranchingOperations as a4, type SecretOperations as a5, type NotebookOperations as a6, type FeedbackOperations as a7, storageConfigSchema as b, branchSchema as c, edgeFunctionWithBodySchema as d, edgeFunctionSchema as e, createProjectOptionsSchema as f, createBranchOptionsSchema as g, deployEdgeFunctionOptionsSchema as h, executeSqlOptionsSchema as i, applyMigrationOptionsSchema as j, getLogsOptionsSchema as k, logsServiceSchema as l, migrationSchema as m, generateTypescriptTypesResultSchema as n, organizationSchema as o, projectSchema as p, queryLogsOptionsSchema as q, resetBranchOptionsSchema as r, storageBucketSchema as s, notebookCellSchema as t, createNotebookOptionsSchema as u, notebookSchema as v, notebookWithContentSchema as w, type EdgeFunctionWithBody as x, type CreateBranchOptions as y, type ResetBranchOptions as z };
592
+ export { apiKeyTypeSchema as $, type ExecuteSqlOptions as A, type Branch as B, type CreateProjectOptions as C, type DeployEdgeFunctionOptions as D, type EdgeFunction as E, type ApplyMigrationOptions as F, type LogsService as G, type GetLogsOptions as H, type GenerateTypescriptTypesResult as I, type StorageConfig as J, type StorageBucket as K, type ListMigrationsResult as L, type Migration as M, type NotebookCell as N, type Organization as O, type Project as P, type QueryLogsOptions as Q, ResultTooLargeError as R, type SupabasePlatform as S, type CreateNotebookOptions as T, type Notebook as U, type NotebookWithContent as V, type DatabaseOperations as W, type AccountOperations as X, type EdgeFunctionsOperations as Y, type LogsDialect as Z, type DebuggingOperations as _, type SuccessResponse as a, type ApiKeyType as a0, type ApiKey as a1, type GenerateTypescriptTypesOptions as a2, type DevelopmentOperations as a3, type StorageOperations as a4, type BranchingOperations as a5, type SecretOperations as a6, type NotebookOperations as a7, type FeedbackOperations as a8, storageConfigSchema as b, branchSchema as c, edgeFunctionWithBodySchema as d, edgeFunctionSchema as e, createProjectOptionsSchema as f, createBranchOptionsSchema as g, deployEdgeFunctionOptionsSchema as h, executeSqlOptionsSchema as i, applyMigrationOptionsSchema as j, getLogsOptionsSchema as k, logsServiceSchema as l, migrationSchema as m, generateTypescriptTypesResultSchema as n, organizationSchema as o, projectSchema as p, queryLogsOptionsSchema as q, resetBranchOptionsSchema as r, storageBucketSchema as s, notebookCellSchema as t, createNotebookOptionsSchema as u, notebookSchema as v, notebookWithContentSchema as w, type EdgeFunctionWithBody as x, type CreateBranchOptions as y, type ResetBranchOptions as z };
@@ -498,9 +498,15 @@ type DebuggingOperations = {
498
498
  logsDialect?: LogsDialect;
499
499
  getLogs(projectId: string, options: GetLogsOptions): Promise<unknown>;
500
500
  queryLogs?(projectId: string, options: QueryLogsOptions): Promise<unknown>;
501
- getSecurityAdvisors(projectId: string): Promise<unknown>;
502
- getPerformanceAdvisors(projectId: string): Promise<unknown>;
503
- getHealthAdvisors?(projectId: string): Promise<unknown>;
501
+ getSecurityAdvisors(projectId: string, options?: {
502
+ includeUnavailable?: boolean;
503
+ }): Promise<unknown>;
504
+ getPerformanceAdvisors(projectId: string, options?: {
505
+ includeUnavailable?: boolean;
506
+ }): Promise<unknown>;
507
+ getHealthAdvisors?(projectId: string, options?: {
508
+ includeUnavailable?: boolean;
509
+ }): Promise<unknown>;
504
510
  };
505
511
  declare const apiKeyTypeSchema: z.ZodEnum<{
506
512
  legacy: "legacy";
@@ -515,10 +521,14 @@ type ApiKey = {
515
521
  id?: string;
516
522
  disabled?: boolean;
517
523
  };
524
+ type GenerateTypescriptTypesOptions = {
525
+ /** Schemas to generate types for. Omitted means the API default (`public`). */
526
+ schemas?: string[];
527
+ };
518
528
  type DevelopmentOperations = {
519
529
  getProjectUrl(projectId: string): Promise<string>;
520
530
  getPublishableKeys(projectId: string): Promise<ApiKey[]>;
521
- generateTypescriptTypes(projectId: string): Promise<GenerateTypescriptTypesResult>;
531
+ generateTypescriptTypes(projectId: string, options?: GenerateTypescriptTypesOptions): Promise<GenerateTypescriptTypesResult>;
522
532
  };
523
533
  type StorageOperations = {
524
534
  getStorageConfig(projectId: string): Promise<StorageConfig>;
@@ -579,4 +589,4 @@ type SupabasePlatform = {
579
589
  feedback?: FeedbackOperations;
580
590
  };
581
591
 
582
- export { apiKeyTypeSchema as $, type ExecuteSqlOptions as A, type Branch as B, type CreateProjectOptions as C, type DeployEdgeFunctionOptions as D, type EdgeFunction as E, type ApplyMigrationOptions as F, type LogsService as G, type GetLogsOptions as H, type GenerateTypescriptTypesResult as I, type StorageConfig as J, type StorageBucket as K, type ListMigrationsResult as L, type Migration as M, type NotebookCell as N, type Organization as O, type Project as P, type QueryLogsOptions as Q, ResultTooLargeError as R, type SupabasePlatform as S, type CreateNotebookOptions as T, type Notebook as U, type NotebookWithContent as V, type DatabaseOperations as W, type AccountOperations as X, type EdgeFunctionsOperations as Y, type LogsDialect as Z, type DebuggingOperations as _, type SuccessResponse as a, type ApiKeyType as a0, type ApiKey as a1, type DevelopmentOperations as a2, type StorageOperations as a3, type BranchingOperations as a4, type SecretOperations as a5, type NotebookOperations as a6, type FeedbackOperations as a7, storageConfigSchema as b, branchSchema as c, edgeFunctionWithBodySchema as d, edgeFunctionSchema as e, createProjectOptionsSchema as f, createBranchOptionsSchema as g, deployEdgeFunctionOptionsSchema as h, executeSqlOptionsSchema as i, applyMigrationOptionsSchema as j, getLogsOptionsSchema as k, logsServiceSchema as l, migrationSchema as m, generateTypescriptTypesResultSchema as n, organizationSchema as o, projectSchema as p, queryLogsOptionsSchema as q, resetBranchOptionsSchema as r, storageBucketSchema as s, notebookCellSchema as t, createNotebookOptionsSchema as u, notebookSchema as v, notebookWithContentSchema as w, type EdgeFunctionWithBody as x, type CreateBranchOptions as y, type ResetBranchOptions as z };
592
+ export { apiKeyTypeSchema as $, type ExecuteSqlOptions as A, type Branch as B, type CreateProjectOptions as C, type DeployEdgeFunctionOptions as D, type EdgeFunction as E, type ApplyMigrationOptions as F, type LogsService as G, type GetLogsOptions as H, type GenerateTypescriptTypesResult as I, type StorageConfig as J, type StorageBucket as K, type ListMigrationsResult as L, type Migration as M, type NotebookCell as N, type Organization as O, type Project as P, type QueryLogsOptions as Q, ResultTooLargeError as R, type SupabasePlatform as S, type CreateNotebookOptions as T, type Notebook as U, type NotebookWithContent as V, type DatabaseOperations as W, type AccountOperations as X, type EdgeFunctionsOperations as Y, type LogsDialect as Z, type DebuggingOperations as _, type SuccessResponse as a, type ApiKeyType as a0, type ApiKey as a1, type GenerateTypescriptTypesOptions as a2, type DevelopmentOperations as a3, type StorageOperations as a4, type BranchingOperations as a5, type SecretOperations as a6, type NotebookOperations as a7, type FeedbackOperations as a8, storageConfigSchema as b, branchSchema as c, edgeFunctionWithBodySchema as d, edgeFunctionSchema as e, createProjectOptionsSchema as f, createBranchOptionsSchema as g, deployEdgeFunctionOptionsSchema as h, executeSqlOptionsSchema as i, applyMigrationOptionsSchema as j, getLogsOptionsSchema as k, logsServiceSchema as l, migrationSchema as m, generateTypescriptTypesResultSchema as n, organizationSchema as o, projectSchema as p, queryLogsOptionsSchema as q, resetBranchOptionsSchema as r, storageBucketSchema as s, notebookCellSchema as t, createNotebookOptionsSchema as u, notebookSchema as v, notebookWithContentSchema as w, type EdgeFunctionWithBody as x, type CreateBranchOptions as y, type ResetBranchOptions as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@supabase/mcp-server-supabase",
3
3
  "mcpName": "com.supabase/mcp",
4
- "version": "0.19.0",
4
+ "version": "0.20.0",
5
5
  "description": "MCP server for interacting with Supabase",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "gqlmin": "^0.3.1",
43
43
  "graphql": "^16.11.0",
44
44
  "openapi-fetch": "^0.13.5",
45
- "@supabase/mcp-utils": "^0.11.0"
45
+ "@supabase/mcp-utils": "^0.11.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@modelcontextprotocol/server": "^2.0.0",
@@ -1,17 +0,0 @@
1
- import{codeBlock as y}from"common-tags";import{resolve as h}from"path/posix";import{fileURLToPath as f}from"url";function T(t,o,n){return`${t}_${o}_${n}`}function S(t){return`/tmp/user_fn_${t}/`}function s(t,o){return t.startsWith(o)?t.slice(o.length):t}function E(t){try{return f(t,{windows:!1})}catch{return t}}function w({deploymentId:t,filename:o}){let n=S(t),r=h(n,o);return r=s(r,n),r=s(r,"source/"),r}var x=["deno.json","deno.jsonc","import_map.json"];function F(t){return x.find(o=>t.some(n=>n.name===o))}var A=y`
2
- import "jsr:@supabase/functions-js/edge-runtime.d.ts";
3
-
4
- Deno.serve(async (req: Request) => {
5
- const data = {
6
- message: "Hello there!"
7
- };
8
-
9
- return new Response(JSON.stringify(data), {
10
- headers: {
11
- 'Content-Type': 'application/json',
12
- 'Connection': 'keep-alive'
13
- }
14
- });
15
- });
16
- `;import{z as e}from"zod/v4";var a=["us-west-1","us-east-1","us-east-2","ca-central-1","eu-west-1","eu-west-2","eu-west-3","eu-central-1","eu-central-2","eu-north-1","ap-south-1","ap-southeast-1","ap-northeast-1","ap-northeast-2","ap-southeast-2","sa-east-1"];var q=e.object({id:e.string(),name:e.string(),owner:e.string(),created_at:e.string(),updated_at:e.string(),public:e.boolean()}),M=e.object({fileSizeLimit:e.number().int().min(0).max(536870912e3),features:e.object({imageTransformation:e.object({enabled:e.boolean()}),s3Protocol:e.object({enabled:e.boolean()})})}),U=e.object({id:e.string(),name:e.string(),plan:e.string().optional(),allowed_release_channels:e.array(e.string()),opt_in_tags:e.array(e.string())}),W=e.object({id:e.string(),ref:e.string(),organization_id:e.string(),organization_slug:e.string(),name:e.string(),status:e.string(),created_at:e.string(),region:e.string()}),G=e.object({id:e.string(),name:e.string(),project_ref:e.string(),parent_project_ref:e.string(),is_default:e.boolean(),git_branch:e.string().optional(),pr_number:e.number().optional(),latest_check_run_id:e.number().optional(),persistent:e.boolean(),status:e.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:e.string(),updated_at:e.string()}),j=e.object({id:e.string(),slug:e.string(),name:e.string(),status:e.string(),version:e.number(),created_at:e.number().optional(),updated_at:e.number().optional(),verify_jwt:e.boolean().optional(),import_map:e.boolean().optional(),import_map_path:e.string().optional(),entrypoint_path:e.string().optional()}),K=j.extend({files:e.array(e.object({name:e.string(),content:e.string()}))}),$=e.object({name:e.string().min(1).max(256),organization_id:e.string(),region:e.enum(a),db_pass:e.string().optional()}),H=e.object({name:e.string().min(1)}),J=e.object({migration_version:e.string().optional()}),Q=e.object({name:e.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/),entrypoint_path:e.string(),import_map_path:e.string().optional(),verify_jwt:e.boolean().optional(),files:e.array(e.object({name:e.string(),content:e.string()}))}),p=class extends Error{name="ResultTooLargeError"},Z=e.object({query:e.string().min(1),parameters:e.array(e.unknown()).optional(),read_only:e.boolean().optional(),max_result_bytes:e.number().int().nonnegative().optional()}),Y=e.object({name:e.string().min(1),query:e.string().min(1)}),V=e.object({version:e.string(),name:e.string().optional()}),_=e.enum(["api","branch-action","postgres","edge-function","edge-function-runtime","auth","storage","realtime"]),X=e.object({service:_,iso_timestamp_start:e.string().optional(),iso_timestamp_end:e.string().optional()}),ee=e.object({sql:e.string().min(1),iso_timestamp_start:e.string().optional(),iso_timestamp_end:e.string().optional(),max_result_bytes:e.number().int().nonnegative().optional()}),te=e.object({types:e.string()}),c=e.object({id:e.number(),username:e.string()}).nullable(),i=e.object({type:e.enum(["bar","line"]),x_column:e.string(),y_series:e.array(e.object({column:e.string()})),scale:e.enum(["linear","log"]),cumulative:e.boolean(),show_labels:e.boolean()}),l=e.object({id:e.string(),type:e.literal("markdown"),text:e.string()}),d=e.object({id:e.string(),type:e.literal("database"),sql:e.string(),row_limit:e.number(),database_identifier:e.string().optional(),title:e.string().optional(),view:e.enum(["table","chart"]).optional(),chart:i.optional()}),u=e.enum(["minute","hour","day","week","month","year"]),O=e.union([e.object({type:e.literal("absolute"),start:e.string(),end:e.string()}),e.object({type:e.literal("relative"),unit:u,amount:e.number()})]),b=e.object({id:e.string(),type:e.literal("log"),sql:e.string(),time_range:O,title:e.string().optional(),view:e.enum(["table","chart"]).optional(),chart:i.optional()}),P=e.discriminatedUnion("type",[l,d,b]),g=i.extend({y_series:e.array(i.shape.y_series.element.strict())}).strict(),m=e.string().trim().min(1),k=e.discriminatedUnion("type",[l.omit({id:!0}).strict(),d.omit({id:!0}).extend({sql:m,row_limit:e.number().int().positive(),database_identifier:e.string().min(1).optional(),chart:g.optional()}).strict(),b.omit({id:!0}).extend({sql:m,time_range:e.discriminatedUnion("type",[e.object({type:e.literal("absolute"),start:e.iso.datetime({offset:!0}),end:e.iso.datetime({offset:!0})}).strict().refine(t=>Date.parse(t.end)>Date.parse(t.start),{message:"The end must be later than the start of the range.",path:["end"]}),e.object({type:e.literal("relative"),unit:u,amount:e.number().int().positive()}).strict()]),chart:g.optional()}).strict()]),oe=e.object({name:e.string().trim().min(1),description:e.string().optional(),content:e.object({cells:e.array(k)})}),I=e.object({id:e.string(),name:e.string(),description:e.string().nullable(),favorite:e.boolean(),inserted_at:e.string(),updated_at:e.string(),owner:c,updated_by:c}),ne=I.extend({content:e.object({schema_version:e.number(),cells:e.array(P)})}),re=e.enum(["legacy","publishable"]);export{T as a,E as b,w as c,x as d,F as e,A as f,a as g,q as h,M as i,U as j,W as k,G as l,j as m,K as n,$ as o,H as p,J as q,Q as r,p as s,Z as t,Y as u,V as v,_ as w,X as x,ee as y,te as z,P as A,oe as B,I as C,ne as D,re as E};
17
- //# sourceMappingURL=chunk-3BFHAE72.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/edge-function.ts","../src/platform/types.ts","../src/regions.ts"],"sourcesContent":["import { codeBlock } from 'common-tags';\nimport { resolve } from 'node:path/posix';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Gets the deployment ID for an Edge Function.\n */\nexport function getDeploymentId(\n projectId: string,\n functionId: string,\n functionVersion: number\n): string {\n return `${projectId}_${functionId}_${functionVersion}`;\n}\n\n/**\n * Gets the path prefix applied to each file in an Edge Function.\n */\nexport function getPathPrefix(deploymentId: string) {\n return `/tmp/user_fn_${deploymentId}/`;\n}\n\n/**\n * Strips a prefix from a string.\n */\nfunction withoutPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value;\n}\n\n/**\n * Converts a `file://` URL to a path, passing through anything that isn't one.\n * Edge Function paths in metadata may sometimes be a path rather than a URL.\n */\nexport function getFilenameFromUrlOrPath(urlOrPath: string) {\n try {\n return fileURLToPath(urlOrPath, { windows: false });\n } catch {\n return urlOrPath;\n }\n}\n\n/**\n * Strips prefix from edge function file names, accounting for Deno 1 and 2.\n */\nexport function normalizeFilename({\n deploymentId,\n filename,\n}: { deploymentId: string; filename: string }) {\n const pathPrefix = getPathPrefix(deploymentId);\n\n // Deno 2 uses relative filenames, Deno 1 uses absolute. Resolve both to absolute first.\n // Resolve Deno paths the same way on Windows.\n const filenameAbsolute = resolve(pathPrefix, filename);\n\n // Strip prefix(es)\n let filenameWithoutPrefix = filenameAbsolute;\n filenameWithoutPrefix = withoutPrefix(filenameWithoutPrefix, pathPrefix);\n filenameWithoutPrefix = withoutPrefix(filenameWithoutPrefix, 'source/');\n\n return filenameWithoutPrefix;\n}\n\n/**\n * Import map file names detected in an Edge Function's root, in order of\n * precedence: `deno.json` before `deno.jsonc`, as the Supabase CLI does, then\n * the legacy `import_map.json`.\n */\nexport const DEFAULT_IMPORT_MAP_FILENAMES = [\n 'deno.json',\n 'deno.jsonc',\n 'import_map.json',\n] as const;\n\n/**\n * Picks the import map to deploy with when none was given or previously set,\n * independent of the order the files were passed in.\n */\nexport function getDefaultImportMapPath(files: { name: string }[]) {\n return DEFAULT_IMPORT_MAP_FILENAMES.find((filename) =>\n files.some((file) => file.name === filename)\n );\n}\n\nexport const edgeFunctionExample = codeBlock`\n import \"jsr:@supabase/functions-js/edge-runtime.d.ts\";\n\n Deno.serve(async (req: Request) => {\n const data = {\n message: \"Hello there!\"\n };\n \n return new Response(JSON.stringify(data), {\n headers: {\n 'Content-Type': 'application/json',\n 'Connection': 'keep-alive'\n }\n });\n });\n`;\n","import type { InitData } from '@supabase/mcp-utils';\nimport { z } from 'zod/v4';\nimport { AWS_REGION_CODES } from '../regions.js';\n\nexport type SuccessResponse = {\n success: true;\n};\n\nexport const storageBucketSchema = z.object({\n id: z.string(),\n name: z.string(),\n owner: z.string(),\n created_at: z.string(),\n updated_at: z.string(),\n public: z.boolean(),\n});\n\nexport const storageConfigSchema = z.object({\n fileSizeLimit: z.number().int().min(0).max(536_870_912_000), // 500GB\n features: z.object({\n imageTransformation: z.object({ enabled: z.boolean() }),\n s3Protocol: z.object({ enabled: z.boolean() }),\n }),\n});\n\nexport const organizationSchema = z.object({\n id: z.string(),\n name: z.string(),\n plan: z.string().optional(),\n allowed_release_channels: z.array(z.string()),\n opt_in_tags: z.array(z.string()),\n});\n\nexport const projectSchema = z.object({\n id: z.string(),\n ref: z.string(),\n organization_id: z.string(),\n organization_slug: z.string(),\n name: z.string(),\n status: z.string(),\n created_at: z.string(),\n region: z.string(),\n});\n\nexport const branchSchema = z.object({\n id: z.string(),\n name: z.string(),\n project_ref: z.string(),\n parent_project_ref: z.string(),\n is_default: z.boolean(),\n git_branch: z.string().optional(),\n pr_number: z.number().optional(),\n latest_check_run_id: z.number().optional(),\n persistent: z.boolean(),\n status: z.enum([\n 'CREATING_PROJECT',\n 'RUNNING_MIGRATIONS',\n 'MIGRATIONS_PASSED',\n 'MIGRATIONS_FAILED',\n 'FUNCTIONS_DEPLOYED',\n 'FUNCTIONS_FAILED',\n ]),\n created_at: z.string(),\n updated_at: z.string(),\n});\n\nexport const edgeFunctionSchema = z.object({\n id: z.string(),\n slug: z.string(),\n name: z.string(),\n status: z.string(),\n version: z.number(),\n created_at: z.number().optional(),\n updated_at: z.number().optional(),\n verify_jwt: z.boolean().optional(),\n import_map: z.boolean().optional(),\n import_map_path: z.string().optional(),\n entrypoint_path: z.string().optional(),\n});\n\nexport const edgeFunctionWithBodySchema = edgeFunctionSchema.extend({\n files: z.array(\n z.object({\n name: z.string(),\n content: z.string(),\n })\n ),\n});\n\nexport const createProjectOptionsSchema = z.object({\n name: z.string().min(1).max(256),\n organization_id: z.string(),\n region: z.enum(AWS_REGION_CODES),\n db_pass: z.string().optional(),\n});\n\nexport const createBranchOptionsSchema = z.object({\n name: z.string().min(1),\n});\n\nexport const resetBranchOptionsSchema = z.object({\n migration_version: z.string().optional(),\n});\n\nexport const deployEdgeFunctionOptionsSchema = z.object({\n name: z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/),\n entrypoint_path: z.string(),\n import_map_path: z.string().optional(),\n verify_jwt: z.boolean().optional(),\n files: z.array(\n z.object({\n name: z.string(),\n content: z.string(),\n })\n ),\n});\n\nexport class ResultTooLargeError extends Error {\n override name = 'ResultTooLargeError';\n}\n\nexport const executeSqlOptionsSchema = z.object({\n query: z.string().min(1),\n parameters: z.array(z.unknown()).optional(),\n read_only: z.boolean().optional(),\n /**\n * Largest result, in bytes of JSON, the caller will use. Platforms that\n * buffer results in shared server memory should stop reading at this limit\n * and throw an error whose name is 'ResultTooLargeError'. Callers also check\n * the rows they get back.\n */\n max_result_bytes: z.number().int().nonnegative().optional(),\n});\n\nexport const applyMigrationOptionsSchema = z.object({\n name: z.string().min(1),\n query: z.string().min(1),\n});\n\nexport const migrationSchema = z.object({\n version: z.string(),\n name: z.string().optional(),\n});\n\nexport const logsServiceSchema = z.enum([\n 'api',\n 'branch-action',\n 'postgres',\n 'edge-function',\n 'edge-function-runtime',\n 'auth',\n 'storage',\n 'realtime',\n]);\n\nexport const getLogsOptionsSchema = z.object({\n service: logsServiceSchema,\n iso_timestamp_start: z.string().optional(),\n iso_timestamp_end: z.string().optional(),\n});\n\nexport const queryLogsOptionsSchema = z.object({\n sql: z.string().min(1),\n iso_timestamp_start: z.string().optional(),\n iso_timestamp_end: z.string().optional(),\n /**\n * Stop reading the response once it exceeds this many bytes and fail the\n * call with an error whose name is 'ResultTooLargeError'. Omitted means no\n * limit; callers still check the rows they get back.\n */\n max_result_bytes: z.number().int().nonnegative().optional(),\n});\n\nexport const generateTypescriptTypesResultSchema = z.object({\n types: z.string(),\n});\n\nconst notebookUserSchema = z\n .object({\n id: z.number(),\n username: z.string(),\n })\n .nullable();\n\nconst notebookChartConfigSchema = z.object({\n type: z.enum(['bar', 'line']),\n x_column: z.string(),\n y_series: z.array(z.object({ column: z.string() })),\n scale: z.enum(['linear', 'log']),\n cumulative: z.boolean(),\n show_labels: z.boolean(),\n});\n\nconst notebookMarkdownCellSchema = z.object({\n id: z.string(),\n type: z.literal('markdown'),\n text: z.string(),\n});\n\nconst notebookDatabaseCellSchema = z.object({\n id: z.string(),\n type: z.literal('database'),\n sql: z.string(),\n row_limit: z.number(),\n database_identifier: z.string().optional(),\n title: z.string().optional(),\n view: z.enum(['table', 'chart']).optional(),\n chart: notebookChartConfigSchema.optional(),\n});\n\nconst notebookLogTimeUnitSchema = z.enum([\n 'minute',\n 'hour',\n 'day',\n 'week',\n 'month',\n 'year',\n]);\n\nconst notebookLogTimeRangeSchema = z.union([\n z.object({\n type: z.literal('absolute'),\n start: z.string(),\n end: z.string(),\n }),\n z.object({\n type: z.literal('relative'),\n unit: notebookLogTimeUnitSchema,\n amount: z.number(),\n }),\n]);\n\nconst notebookLogCellSchema = z.object({\n id: z.string(),\n type: z.literal('log'),\n sql: z.string(),\n time_range: notebookLogTimeRangeSchema,\n title: z.string().optional(),\n view: z.enum(['table', 'chart']).optional(),\n chart: notebookChartConfigSchema.optional(),\n});\n\nexport const notebookCellSchema = z.discriminatedUnion('type', [\n notebookMarkdownCellSchema,\n notebookDatabaseCellSchema,\n notebookLogCellSchema,\n]);\n\n// Cell keys to create, without server-assigned ids. Stricter than the read\n// schemas above, so a misspelled cell key fails instead of being dropped.\nconst newNotebookChartConfigSchema = notebookChartConfigSchema\n .extend({\n y_series: z.array(\n notebookChartConfigSchema.shape.y_series.element.strict()\n ),\n })\n .strict();\n\nconst newNotebookSqlSchema = z.string().trim().min(1);\n\nconst newNotebookCellSchema = z.discriminatedUnion('type', [\n notebookMarkdownCellSchema.omit({ id: true }).strict(),\n notebookDatabaseCellSchema\n .omit({ id: true })\n .extend({\n sql: newNotebookSqlSchema,\n row_limit: z.number().int().positive(),\n database_identifier: z.string().min(1).optional(),\n chart: newNotebookChartConfigSchema.optional(),\n })\n .strict(),\n notebookLogCellSchema\n .omit({ id: true })\n .extend({\n sql: newNotebookSqlSchema,\n time_range: z.discriminatedUnion('type', [\n z\n .object({\n type: z.literal('absolute'),\n start: z.iso.datetime({ offset: true }),\n end: z.iso.datetime({ offset: true }),\n })\n .strict()\n .refine((range) => Date.parse(range.end) > Date.parse(range.start), {\n message: 'The end must be later than the start of the range.',\n path: ['end'],\n }),\n z\n .object({\n type: z.literal('relative'),\n unit: notebookLogTimeUnitSchema,\n amount: z.number().int().positive(),\n })\n .strict(),\n ]),\n chart: newNotebookChartConfigSchema.optional(),\n })\n .strict(),\n]);\n\nexport const createNotebookOptionsSchema = z.object({\n name: z.string().trim().min(1),\n description: z.string().optional(),\n content: z.object({\n cells: z.array(newNotebookCellSchema),\n }),\n});\n\nexport const notebookSchema = z.object({\n id: z.string(),\n name: z.string(),\n description: z.string().nullable(),\n favorite: z.boolean(),\n inserted_at: z.string(),\n updated_at: z.string(),\n owner: notebookUserSchema,\n updated_by: notebookUserSchema,\n});\n\nexport const notebookWithContentSchema = notebookSchema.extend({\n content: z.object({\n schema_version: z.number(),\n cells: z.array(notebookCellSchema),\n }),\n});\n\nexport type Organization = z.infer<typeof organizationSchema>;\nexport type Project = z.infer<typeof projectSchema>;\nexport type Branch = z.infer<typeof branchSchema>;\nexport type EdgeFunction = z.infer<typeof edgeFunctionSchema>;\nexport type EdgeFunctionWithBody = z.infer<typeof edgeFunctionWithBodySchema>;\n\nexport type CreateProjectOptions = z.infer<typeof createProjectOptionsSchema>;\nexport type CreateBranchOptions = z.infer<typeof createBranchOptionsSchema>;\nexport type ResetBranchOptions = z.infer<typeof resetBranchOptionsSchema>;\nexport type DeployEdgeFunctionOptions = z.infer<\n typeof deployEdgeFunctionOptionsSchema\n>;\n\nexport type ExecuteSqlOptions = z.infer<typeof executeSqlOptionsSchema>;\nexport type ApplyMigrationOptions = z.infer<typeof applyMigrationOptionsSchema>;\nexport type Migration = z.infer<typeof migrationSchema>;\nexport type ListMigrationsResult = z.infer<typeof migrationSchema>;\n\nexport type LogsService = z.infer<typeof logsServiceSchema>;\nexport type GetLogsOptions = z.infer<typeof getLogsOptionsSchema>;\nexport type QueryLogsOptions = z.infer<typeof queryLogsOptionsSchema>;\nexport type GenerateTypescriptTypesResult = z.infer<\n typeof generateTypescriptTypesResultSchema\n>;\n\nexport type StorageConfig = z.infer<typeof storageConfigSchema>;\nexport type StorageBucket = z.infer<typeof storageBucketSchema>;\n\nexport type NotebookCell = z.infer<typeof notebookCellSchema>;\nexport type CreateNotebookOptions = z.infer<typeof createNotebookOptionsSchema>;\nexport type Notebook = z.infer<typeof notebookSchema>;\nexport type NotebookWithContent = z.infer<typeof notebookWithContentSchema>;\n\nexport type DatabaseOperations = {\n executeSql<T>(projectId: string, options: ExecuteSqlOptions): Promise<T[]>;\n listMigrations(projectId: string): Promise<Migration[]>;\n applyMigration(\n projectId: string,\n options: ApplyMigrationOptions\n ): Promise<void>;\n};\n\nexport type AccountOperations = {\n listOrganizations(): Promise<{ id: string; slug: string; name: string }[]>;\n getOrganization(organizationId: string): Promise<Organization>;\n listProjects(): Promise<Project[]>;\n getProject(projectId: string): Promise<Project>;\n createProject(options: CreateProjectOptions): Promise<Project>;\n pauseProject(projectId: string): Promise<void>;\n restoreProject(projectId: string): Promise<void>;\n};\n\nexport type EdgeFunctionsOperations = {\n listEdgeFunctions(projectId: string): Promise<EdgeFunction[]>;\n getEdgeFunction(\n projectId: string,\n functionSlug: string\n ): Promise<EdgeFunctionWithBody>;\n deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ): Promise<Omit<EdgeFunction, 'files'>>;\n};\n\n/**\n * SQL dialect that a platform's logs endpoint speaks. Selects the\n * dialect-appropriate `query_logs` description and `sql` parameter hint so a\n * single tool can roll out across environments that back logs with different\n * engines (hosted ClickHouse vs. self-hosted/CLI BigQuery).\n */\nexport type LogsDialect = 'clickhouse' | 'bigquery';\n\nexport type DebuggingOperations = {\n /**\n * SQL dialect accepted by `queryLogs`. Defaults to `'clickhouse'` when unset,\n * preserving the behavior of platforms that predate this field.\n */\n logsDialect?: LogsDialect;\n getLogs(projectId: string, options: GetLogsOptions): Promise<unknown>;\n queryLogs?(projectId: string, options: QueryLogsOptions): Promise<unknown>;\n getSecurityAdvisors(projectId: string): Promise<unknown>;\n getPerformanceAdvisors(projectId: string): Promise<unknown>;\n getHealthAdvisors?(projectId: string): Promise<unknown>;\n};\n\nexport const apiKeyTypeSchema = z.enum(['legacy', 'publishable']);\nexport type ApiKeyType = z.infer<typeof apiKeyTypeSchema>;\n\nexport type ApiKey = {\n api_key: string;\n name: string;\n type: ApiKeyType;\n description?: string;\n id?: string;\n disabled?: boolean;\n};\n\nexport type DevelopmentOperations = {\n getProjectUrl(projectId: string): Promise<string>;\n getPublishableKeys(projectId: string): Promise<ApiKey[]>;\n generateTypescriptTypes(\n projectId: string\n ): Promise<GenerateTypescriptTypesResult>;\n};\n\nexport type StorageOperations = {\n getStorageConfig(projectId: string): Promise<StorageConfig>;\n updateStorageConfig(projectId: string, config: StorageConfig): Promise<void>;\n listAllBuckets(projectId: string): Promise<StorageBucket[]>;\n};\n\nexport type BranchingOperations = {\n listBranches(projectId: string): Promise<Branch[]>;\n createBranch(\n projectId: string,\n options: CreateBranchOptions\n ): Promise<Branch>;\n deleteBranch(branchId: string): Promise<void>;\n mergeBranch(branchId: string): Promise<void>;\n resetBranch(branchId: string, options: ResetBranchOptions): Promise<void>;\n rebaseBranch(branchId: string): Promise<void>;\n};\n\n/**\n * Returns only the `updated_at` timestamp of the named secret, never its\n * value or digest.\n */\nexport type SecretOperations = {\n getUpdatedAt(projectId: string, name: string): Promise<Date | undefined>;\n};\n\nexport type NotebookOperations = {\n /** Optional for platforms that only support reading notebooks. */\n createNotebook?(\n projectId: string,\n options: CreateNotebookOptions\n ): Promise<NotebookWithContent>;\n listNotebooks(projectId: string): Promise<Notebook[]>;\n getNotebook(\n projectId: string,\n notebookId: string\n ): Promise<NotebookWithContent>;\n deleteNotebook(projectId: string, notebookId: string): Promise<void>;\n};\n\nexport type FeedbackOperations = {\n submit(input: {\n feedback: string;\n projectId?: string;\n clientInfo?: { name: string; version: string };\n }): Promise<{ deleteToken: string }>;\n delete(input: {\n deleteToken: string;\n projectId?: string;\n }): Promise<{ deleted: boolean }>;\n};\n\nexport type SupabasePlatform = {\n init?(info: InitData): Promise<void>;\n account?: AccountOperations;\n database?: DatabaseOperations;\n functions?: EdgeFunctionsOperations;\n debugging?: DebuggingOperations;\n development?: DevelopmentOperations;\n storage?: StorageOperations;\n branching?: BranchingOperations;\n secrets?: SecretOperations;\n notebooks?: NotebookOperations;\n feedback?: FeedbackOperations;\n};\n","export const AWS_REGION_CODES = [\n 'us-west-1',\n 'us-east-1',\n 'us-east-2',\n 'ca-central-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'eu-central-1',\n 'eu-central-2',\n 'eu-north-1',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-southeast-2',\n 'sa-east-1',\n] as const;\n"],"mappings":"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","names":["codeBlock","resolve","fileURLToPath","getDeploymentId","projectId","functionId","functionVersion","getPathPrefix","deploymentId","withoutPrefix","value","prefix","getFilenameFromUrlOrPath","urlOrPath","normalizeFilename","filename","pathPrefix","filenameWithoutPrefix","DEFAULT_IMPORT_MAP_FILENAMES","getDefaultImportMapPath","files","file","edgeFunctionExample","z","AWS_REGION_CODES","storageBucketSchema","z","storageConfigSchema","organizationSchema","projectSchema","branchSchema","edgeFunctionSchema","edgeFunctionWithBodySchema","createProjectOptionsSchema","AWS_REGION_CODES","createBranchOptionsSchema","resetBranchOptionsSchema","deployEdgeFunctionOptionsSchema","ResultTooLargeError","executeSqlOptionsSchema","applyMigrationOptionsSchema","migrationSchema","logsServiceSchema","getLogsOptionsSchema","queryLogsOptionsSchema","generateTypescriptTypesResultSchema","notebookUserSchema","notebookChartConfigSchema","notebookMarkdownCellSchema","notebookDatabaseCellSchema","notebookLogTimeUnitSchema","notebookLogTimeRangeSchema","notebookLogCellSchema","notebookCellSchema","newNotebookChartConfigSchema","newNotebookSqlSchema","newNotebookCellSchema","range","createNotebookOptionsSchema","notebookSchema","notebookWithContentSchema","apiKeyTypeSchema"]}
@@ -1,17 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;var _commontags = require('common-tags');var _posix = require('path/posix');var _url = require('url');function T(t,o,n){return`${t}_${o}_${n}`}function S(t){return`/tmp/user_fn_${t}/`}function s(t,o){return t.startsWith(o)?t.slice(o.length):t}function E(t){try{return _url.fileURLToPath.call(void 0, t,{windows:!1})}catch (e2){return t}}function w({deploymentId:t,filename:o}){let n=S(t),r=_posix.resolve.call(void 0, n,o);return r=s(r,n),r=s(r,"source/"),r}var x=["deno.json","deno.jsonc","import_map.json"];function F(t){return x.find(o=>t.some(n=>n.name===o))}var A=_commontags.codeBlock`
2
- import "jsr:@supabase/functions-js/edge-runtime.d.ts";
3
-
4
- Deno.serve(async (req: Request) => {
5
- const data = {
6
- message: "Hello there!"
7
- };
8
-
9
- return new Response(JSON.stringify(data), {
10
- headers: {
11
- 'Content-Type': 'application/json',
12
- 'Connection': 'keep-alive'
13
- }
14
- });
15
- });
16
- `;var _v4 = require('zod/v4');var a=["us-west-1","us-east-1","us-east-2","ca-central-1","eu-west-1","eu-west-2","eu-west-3","eu-central-1","eu-central-2","eu-north-1","ap-south-1","ap-southeast-1","ap-northeast-1","ap-northeast-2","ap-southeast-2","sa-east-1"];var q=_v4.z.object({id:_v4.z.string(),name:_v4.z.string(),owner:_v4.z.string(),created_at:_v4.z.string(),updated_at:_v4.z.string(),public:_v4.z.boolean()}),M= exports.i =_v4.z.object({fileSizeLimit:_v4.z.number().int().min(0).max(536870912e3),features:_v4.z.object({imageTransformation:_v4.z.object({enabled:_v4.z.boolean()}),s3Protocol:_v4.z.object({enabled:_v4.z.boolean()})})}),U= exports.j =_v4.z.object({id:_v4.z.string(),name:_v4.z.string(),plan:_v4.z.string().optional(),allowed_release_channels:_v4.z.array(_v4.z.string()),opt_in_tags:_v4.z.array(_v4.z.string())}),W= exports.k =_v4.z.object({id:_v4.z.string(),ref:_v4.z.string(),organization_id:_v4.z.string(),organization_slug:_v4.z.string(),name:_v4.z.string(),status:_v4.z.string(),created_at:_v4.z.string(),region:_v4.z.string()}),G= exports.l =_v4.z.object({id:_v4.z.string(),name:_v4.z.string(),project_ref:_v4.z.string(),parent_project_ref:_v4.z.string(),is_default:_v4.z.boolean(),git_branch:_v4.z.string().optional(),pr_number:_v4.z.number().optional(),latest_check_run_id:_v4.z.number().optional(),persistent:_v4.z.boolean(),status:_v4.z.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:_v4.z.string(),updated_at:_v4.z.string()}),j= exports.m =_v4.z.object({id:_v4.z.string(),slug:_v4.z.string(),name:_v4.z.string(),status:_v4.z.string(),version:_v4.z.number(),created_at:_v4.z.number().optional(),updated_at:_v4.z.number().optional(),verify_jwt:_v4.z.boolean().optional(),import_map:_v4.z.boolean().optional(),import_map_path:_v4.z.string().optional(),entrypoint_path:_v4.z.string().optional()}),K= exports.n =j.extend({files:_v4.z.array(_v4.z.object({name:_v4.z.string(),content:_v4.z.string()}))}),$= exports.o =_v4.z.object({name:_v4.z.string().min(1).max(256),organization_id:_v4.z.string(),region:_v4.z.enum(a),db_pass:_v4.z.string().optional()}),H= exports.p =_v4.z.object({name:_v4.z.string().min(1)}),J= exports.q =_v4.z.object({migration_version:_v4.z.string().optional()}),Q= exports.r =_v4.z.object({name:_v4.z.string().regex(/^[A-Za-z][A-Za-z0-9_-]*$/),entrypoint_path:_v4.z.string(),import_map_path:_v4.z.string().optional(),verify_jwt:_v4.z.boolean().optional(),files:_v4.z.array(_v4.z.object({name:_v4.z.string(),content:_v4.z.string()}))}),p= exports.s = (_class =class extends Error{constructor(...args) { super(...args); _class.prototype.__init.call(this); }__init() {this.name="ResultTooLargeError"}}, _class),Z= exports.t =_v4.z.object({query:_v4.z.string().min(1),parameters:_v4.z.array(_v4.z.unknown()).optional(),read_only:_v4.z.boolean().optional(),max_result_bytes:_v4.z.number().int().nonnegative().optional()}),Y= exports.u =_v4.z.object({name:_v4.z.string().min(1),query:_v4.z.string().min(1)}),V= exports.v =_v4.z.object({version:_v4.z.string(),name:_v4.z.string().optional()}),_= exports.w =_v4.z.enum(["api","branch-action","postgres","edge-function","edge-function-runtime","auth","storage","realtime"]),X= exports.x =_v4.z.object({service:_,iso_timestamp_start:_v4.z.string().optional(),iso_timestamp_end:_v4.z.string().optional()}),ee= exports.y =_v4.z.object({sql:_v4.z.string().min(1),iso_timestamp_start:_v4.z.string().optional(),iso_timestamp_end:_v4.z.string().optional(),max_result_bytes:_v4.z.number().int().nonnegative().optional()}),te= exports.z =_v4.z.object({types:_v4.z.string()}),c=_v4.z.object({id:_v4.z.number(),username:_v4.z.string()}).nullable(),i=_v4.z.object({type:_v4.z.enum(["bar","line"]),x_column:_v4.z.string(),y_series:_v4.z.array(_v4.z.object({column:_v4.z.string()})),scale:_v4.z.enum(["linear","log"]),cumulative:_v4.z.boolean(),show_labels:_v4.z.boolean()}),l=_v4.z.object({id:_v4.z.string(),type:_v4.z.literal("markdown"),text:_v4.z.string()}),d=_v4.z.object({id:_v4.z.string(),type:_v4.z.literal("database"),sql:_v4.z.string(),row_limit:_v4.z.number(),database_identifier:_v4.z.string().optional(),title:_v4.z.string().optional(),view:_v4.z.enum(["table","chart"]).optional(),chart:i.optional()}),u=_v4.z.enum(["minute","hour","day","week","month","year"]),O=_v4.z.union([_v4.z.object({type:_v4.z.literal("absolute"),start:_v4.z.string(),end:_v4.z.string()}),_v4.z.object({type:_v4.z.literal("relative"),unit:u,amount:_v4.z.number()})]),b=_v4.z.object({id:_v4.z.string(),type:_v4.z.literal("log"),sql:_v4.z.string(),time_range:O,title:_v4.z.string().optional(),view:_v4.z.enum(["table","chart"]).optional(),chart:i.optional()}),P= exports.A =_v4.z.discriminatedUnion("type",[l,d,b]),g=i.extend({y_series:_v4.z.array(i.shape.y_series.element.strict())}).strict(),m=_v4.z.string().trim().min(1),k=_v4.z.discriminatedUnion("type",[l.omit({id:!0}).strict(),d.omit({id:!0}).extend({sql:m,row_limit:_v4.z.number().int().positive(),database_identifier:_v4.z.string().min(1).optional(),chart:g.optional()}).strict(),b.omit({id:!0}).extend({sql:m,time_range:_v4.z.discriminatedUnion("type",[_v4.z.object({type:_v4.z.literal("absolute"),start:_v4.z.iso.datetime({offset:!0}),end:_v4.z.iso.datetime({offset:!0})}).strict().refine(t=>Date.parse(t.end)>Date.parse(t.start),{message:"The end must be later than the start of the range.",path:["end"]}),_v4.z.object({type:_v4.z.literal("relative"),unit:u,amount:_v4.z.number().int().positive()}).strict()]),chart:g.optional()}).strict()]),oe= exports.B =_v4.z.object({name:_v4.z.string().trim().min(1),description:_v4.z.string().optional(),content:_v4.z.object({cells:_v4.z.array(k)})}),I= exports.C =_v4.z.object({id:_v4.z.string(),name:_v4.z.string(),description:_v4.z.string().nullable(),favorite:_v4.z.boolean(),inserted_at:_v4.z.string(),updated_at:_v4.z.string(),owner:c,updated_by:c}),ne= exports.D =I.extend({content:_v4.z.object({schema_version:_v4.z.number(),cells:_v4.z.array(P)})}),re= exports.E =_v4.z.enum(["legacy","publishable"]);exports.a = T; exports.b = E; exports.c = w; exports.d = x; exports.e = F; exports.f = A; exports.g = a; exports.h = q; exports.i = M; exports.j = U; exports.k = W; exports.l = G; exports.m = j; exports.n = K; exports.o = $; exports.p = H; exports.q = J; exports.r = Q; exports.s = p; exports.t = Z; exports.u = Y; exports.v = V; exports.w = _; exports.x = X; exports.y = ee; exports.z = te; exports.A = P; exports.B = oe; exports.C = I; exports.D = ne; exports.E = re;
17
- //# sourceMappingURL=chunk-6QB2YXYQ.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/edge-function.ts","../src/regions.ts"],"names":["getDeploymentId","projectId","functionId","functionVersion"],"mappings":"AAAA,8HAA0B,mCACF,0BACM,SAKdA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACQ,CACR,MAAO,CAAA,EAAA;AAuE0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AC1EjC","file":"/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/chunk-6QB2YXYQ.cjs","sourcesContent":["import { codeBlock } from 'common-tags';\nimport { resolve } from 'node:path/posix';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Gets the deployment ID for an Edge Function.\n */\nexport function getDeploymentId(\n projectId: string,\n functionId: string,\n functionVersion: number\n): string {\n return `${projectId}_${functionId}_${functionVersion}`;\n}\n\n/**\n * Gets the path prefix applied to each file in an Edge Function.\n */\nexport function getPathPrefix(deploymentId: string) {\n return `/tmp/user_fn_${deploymentId}/`;\n}\n\n/**\n * Strips a prefix from a string.\n */\nfunction withoutPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value;\n}\n\n/**\n * Converts a `file://` URL to a path, passing through anything that isn't one.\n * Edge Function paths in metadata may sometimes be a path rather than a URL.\n */\nexport function getFilenameFromUrlOrPath(urlOrPath: string) {\n try {\n return fileURLToPath(urlOrPath, { windows: false });\n } catch {\n return urlOrPath;\n }\n}\n\n/**\n * Strips prefix from edge function file names, accounting for Deno 1 and 2.\n */\nexport function normalizeFilename({\n deploymentId,\n filename,\n}: { deploymentId: string; filename: string }) {\n const pathPrefix = getPathPrefix(deploymentId);\n\n // Deno 2 uses relative filenames, Deno 1 uses absolute. Resolve both to absolute first.\n // Resolve Deno paths the same way on Windows.\n const filenameAbsolute = resolve(pathPrefix, filename);\n\n // Strip prefix(es)\n let filenameWithoutPrefix = filenameAbsolute;\n filenameWithoutPrefix = withoutPrefix(filenameWithoutPrefix, pathPrefix);\n filenameWithoutPrefix = withoutPrefix(filenameWithoutPrefix, 'source/');\n\n return filenameWithoutPrefix;\n}\n\n/**\n * Import map file names detected in an Edge Function's root, in order of\n * precedence: `deno.json` before `deno.jsonc`, as the Supabase CLI does, then\n * the legacy `import_map.json`.\n */\nexport const DEFAULT_IMPORT_MAP_FILENAMES = [\n 'deno.json',\n 'deno.jsonc',\n 'import_map.json',\n] as const;\n\n/**\n * Picks the import map to deploy with when none was given or previously set,\n * independent of the order the files were passed in.\n */\nexport function getDefaultImportMapPath(files: { name: string }[]) {\n return DEFAULT_IMPORT_MAP_FILENAMES.find((filename) =>\n files.some((file) => file.name === filename)\n );\n}\n\nexport const edgeFunctionExample = codeBlock`\n import \"jsr:@supabase/functions-js/edge-runtime.d.ts\";\n\n Deno.serve(async (req: Request) => {\n const data = {\n message: \"Hello there!\"\n };\n \n return new Response(JSON.stringify(data), {\n headers: {\n 'Content-Type': 'application/json',\n 'Connection': 'keep-alive'\n }\n });\n });\n`;\n","export const AWS_REGION_CODES = [\n 'us-west-1',\n 'us-east-1',\n 'us-east-2',\n 'ca-central-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'eu-central-1',\n 'eu-central-2',\n 'eu-north-1',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-southeast-2',\n 'sa-east-1',\n] as const;\n"]}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkC4YUF27Ucjs = require('./chunk-C4YUF27U.cjs');var _chunk6QB2YXYQcjs = require('./chunk-6QB2YXYQ.cjs');var _multipartparser = require('@mjackson/multipart-parser');var _openapifetch = require('openapi-fetch'); var _openapifetch2 = _interopRequireDefault(_openapifetch);var _v4 = require('zod/v4');function F(i,c,d={}){return _openapifetch2.default.call(void 0, {baseUrl:i,headers:{Authorization:`Bearer ${c}`,...d}})}var Q=_v4.z.object({message:_v4.z.string()}),Z=/^ref: /;function o(i,c){if("error"in i){if(i.response.status===401)throw new Error("Unauthorized. Please provide a valid access token to the MCP server via the --access-token flag or SUPABASE_ACCESS_TOKEN.");let{data:d}=Q.safeParse(i.error);throw d?i.response.status===400&&Z.test(d.message)?new Error(`${d.message.replace(/\.$/,"")}. Copy the ref exactly as returned by list_projects (id) or list_branches (project_ref), depending on whether you're working with the main project or a branch; do not retype or shorten it.`):new Error(d.message):new Error(c)}}function T(i,c,d){if("error"in i&&i.response.status===403){let{data:l}=Q.safeParse(i.error),u=(_nullishCoalesce(_optionalChain([l, 'optionalAccess', _2 => _2.message]), () => (c))).replace(/\.$/,"");throw new Error(`${u}. Access to project '${d}' was denied. If this project exists, your access token may be scoped to a different organization: re-authenticate with the MCP server and select the organization that owns this project.`)}o(i,c)}var _mcputils = require('@supabase/mcp-utils');function C(i,c,d={}){return _openapifetch2.default.call(void 0, {baseUrl:i,headers:{Authorization:`Bearer ${c}`,...d}})}var se=_v4.z.object({error:_v4.z.object({message:_v4.z.string()})});function S(i,c){if("error"in i){if(i.response.status===401)throw new Error("Unauthorized. Please provide a valid access token to the MCP server via the --access-token flag or SUPABASE_ACCESS_TOKEN.");let{data:d}=se.safeParse(i.error);if(d){let{message:l}=d.error,{status:u}=i.response;throw u<500&&u!==429?new (0, _mcputils.ToolCallerError)(l):new Error(l)}throw new Error(c)}}var ae="ABCDEFGHIJKLMNOPQRSTUVWXYZ",re="abcdefghijklmnopqrstuvwxyz",ne="0123456789",oe="!@#$%^&*()_+~`|}{[]:;?><,./-=",W=({length:i=10,numbers:c=!1,symbols:d=!1,uppercase:l=!0,lowercase:u=!0}={})=>{let r="";if(l&&(r+=ae),u&&(r+=re),c&&(r+=ne),d&&(r+=oe),r.length===0)throw new Error("at least one character set must be selected");let m=new Uint32Array(i);crypto.getRandomValues(m);let E="";for(let O=0;O<i;O++){let P=m[O]%r.length;E+=r.charAt(P)}return E};var{version:ce}=_chunkC4YUF27Ucjs.a;var de=["log_data_api_error_rate_high","log_auth_error_rate_high","log_storage_error_rate_high","log_edge_function_error_rate_high"],le=new Set(["project_not_active","advisor_check_unavailable"]);function Ge(i){let{accessToken:c,apiUrl:d}=i,l=_nullishCoalesce(d, () => ("https://api.supabase.com")),u,r=F(l,c),m=C(l,c),E={async listOrganizations(){let t=await r.GET("/v1/organizations");return o(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await r.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return o(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await r.GET("/v1/projects");return o(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await r.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return o(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:s,region:a,db_pass:n}=_chunk6QB2YXYQcjs.o.parse(t),p=await r.POST("/v1/projects",{body:{name:e,region:a,organization_slug:s,db_pass:_nullishCoalesce(n, () => (W({length:16,numbers:!0,uppercase:!0,lowercase:!0})))}});return o(p,"Failed to create project"),p.data},async pauseProject(t){let e=await r.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});o(e,"Failed to pause project")},async restoreProject(t){let e=await r.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});o(e,"Failed to restore project")}},O={async executeSql(t,e){let{query:s,parameters:a,read_only:n}=_chunk6QB2YXYQcjs.t.parse(e),p=await r.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:s,parameters:a,read_only:n}});return T(p,"Failed to execute SQL query",t),p.data},async listMigrations(t){let e=await r.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return T(e,"Failed to fetch migrations",t),e.data},async applyMigration(t,e){let{name:s,query:a}=_chunk6QB2YXYQcjs.u.parse(e),n=await r.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:s,query:a}});T(n,"Failed to apply migration",t)}},P={logsDialect:"clickhouse",async getLogs(t,e){let{service:s,iso_timestamp_start:a,iso_timestamp_end:n}=_chunk6QB2YXYQcjs.x.parse(e),p=_chunkC4YUF27Ucjs.b.call(void 0, s),g=await r.GET("/v1/projects/{ref}/analytics/endpoints/logs",{params:{path:{ref:t},query:{sql:p,iso_timestamp_start:a,iso_timestamp_end:n}}});return o(g,"Failed to fetch logs"),g.data},async queryLogs(t,e){let{sql:s,iso_timestamp_start:a,iso_timestamp_end:n}=_chunk6QB2YXYQcjs.y.parse(e),p=await r.GET("/v1/projects/{ref}/analytics/endpoints/logs",{params:{path:{ref:t},query:{sql:s,iso_timestamp_start:a,iso_timestamp_end:n}}});return o(p,"Failed to query logs"),p.data},async getSecurityAdvisors(t){let e=await r.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return o(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await r.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return o(e,"Failed to fetch performance advisors"),e.data},async getHealthAdvisors(t){let e=await m.POST("/v2/projects/{ref}/advisors/run",{params:{path:{ref:t}},body:{data:{type:"project_advisors",attributes:{lints:de.map(a=>({name:a}))}}}});S(e,"Failed to fetch health advisors");let s=e.data.data.attributes;return{...s,lints:s.lints.filter(({name:a})=>!le.has(a))}}},J={async getProjectUrl(t){let e=new URL(l);return`https://${t}.${me(e.hostname)}`},async getPublishableKeys(t){let e=await r.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:"false"}}});o(e,"Failed to fetch API keys");let s;try{let n=await r.GET("/v1/projects/{ref}/api-keys/legacy",{params:{path:{ref:t}}});n.response.ok&&(s=_nullishCoalesce(_optionalChain([n, 'access', _3 => _3.data, 'optionalAccess', _4 => _4.enabled]), () => (!0)))}catch (e2){s=void 0}let a=_nullishCoalesce(_optionalChain([e, 'access', _5 => _5.data, 'optionalAccess', _6 => _6.filter, 'call', _7 => _7(n=>n.name==="anon"||n.type==="publishable")]), () => ([]));if(a.length===0)throw new Error("No client-safe API keys (anon or publishable) found. Please create a publishable key in your project settings.");return a.map(n=>({api_key:n.api_key,name:n.name,type:n.type==="publishable"?"publishable":"legacy",...s!==void 0&&{disabled:n.type==="legacy"&&!s},description:_nullishCoalesce(n.description, () => (void 0)),id:_nullishCoalesce(n.id, () => (void 0))}))},async generateTypescriptTypes(t){let e=await r.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return o(e,"Failed to fetch TypeScript types"),e.data}},M={async listEdgeFunctions(t){let e=await r.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return o(e,"Failed to fetch Edge Functions"),e.data.map(s=>{let a=_chunk6QB2YXYQcjs.a.call(void 0, t,s.id,s.version),n=s.entrypoint_path?_chunk6QB2YXYQcjs.c.call(void 0, {deploymentId:a,filename:_chunk6QB2YXYQcjs.b.call(void 0, s.entrypoint_path)}):void 0,p=s.import_map_path?_chunk6QB2YXYQcjs.c.call(void 0, {deploymentId:a,filename:_chunk6QB2YXYQcjs.b.call(void 0, s.import_map_path)}):void 0;return{...s,entrypoint_path:n,import_map_path:p}})},async getEdgeFunction(t,e){let s=await r.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(s.error)throw s.error;o(s,"Failed to fetch Edge Function");let a=s.data,n=_chunk6QB2YXYQcjs.a.call(void 0, t,a.id,a.version),p=a.entrypoint_path?_chunk6QB2YXYQcjs.c.call(void 0, {deploymentId:n,filename:_chunk6QB2YXYQcjs.b.call(void 0, a.entrypoint_path)}):void 0,g=a.import_map_path?_chunk6QB2YXYQcjs.c.call(void 0, {deploymentId:n,filename:_chunk6QB2YXYQcjs.b.call(void 0, a.import_map_path)}):void 0,f=await r.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});o(f,"Failed to fetch Edge Function files");let h=f.response.headers.get("content-type");if(!h||!h.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${h}. Expected multipart/form-data.`);let y=_multipartparser.getMultipartBoundary.call(void 0, h);if(!y)throw new Error("No multipart boundary found in response headers");if(!f.data)throw new Error("No data received from Edge Function body");let b=[],j=_multipartparser.parseMultipartStream.call(void 0, f.data,{boundary:y});for await(let _ of j)_.isFile&&_.filename&&b.push({name:_chunk6QB2YXYQcjs.c.call(void 0, {deploymentId:n,filename:_.filename}),content:_.text});return{...a,entrypoint_path:p,import_map_path:g,files:b}},async deployEdgeFunction(t,e){let{name:s,entrypoint_path:a,import_map_path:n,verify_jwt:p,files:g}=_chunk6QB2YXYQcjs.r.parse(e),f;try{f=await M.getEdgeFunction(t,s)}catch (e3){}n??=_nullishCoalesce(_optionalChain([f, 'optionalAccess', _8 => _8.import_map_path]), () => (_chunk6QB2YXYQcjs.e.call(void 0, g)));let h=await r.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:s}},body:{metadata:{name:s,entrypoint_path:a,import_map_path:n,verify_jwt:p},file:g},bodySerializer(y){let b=new FormData,j=new Blob([JSON.stringify(y.metadata)],{type:"application/json"});return b.append("metadata",j),_optionalChain([y, 'access', _9 => _9.file, 'optionalAccess', _10 => _10.forEach, 'call', _11 => _11(_=>{let k=_,X=new Blob([k.content],{type:"application/typescript"});b.append("file",X,k.name)})]),b}});return o(h,"Failed to deploy Edge Function"),h.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");let s={"User-Agent":`supabase-mcp/${ce} (${e.name}/${e.version})`};r=F(l,c,s),m=C(l,c,s)},account:E,database:O,debugging:P,development:J,functions:M,branching:{async listBranches(t){let e=await r.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(o(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:s}=_chunk6QB2YXYQcjs.p.parse(e),a=await r.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:s}});return o(a,"Failed to create branch"),a.data},async deleteBranch(t){let e=await r.DELETE("/v1/branches/{branch_id_or_ref}",{params:{path:{branch_id_or_ref:t}}});o(e,"Failed to delete branch")},async mergeBranch(t){let e=await r.POST("/v1/branches/{branch_id_or_ref}/merge",{params:{path:{branch_id_or_ref:t}},body:{}});o(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:s}=_chunk6QB2YXYQcjs.q.parse(e),a=await r.POST("/v1/branches/{branch_id_or_ref}/reset",{params:{path:{branch_id_or_ref:t}},body:{migration_version:s}});o(a,"Failed to reset branch")},async rebaseBranch(t){let e=await r.POST("/v1/branches/{branch_id_or_ref}/push",{params:{path:{branch_id_or_ref:t}},body:{}});o(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await r.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return o(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await r.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return o(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let s=await r.PATCH("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}},body:{fileSizeLimit:e.fileSizeLimit,features:{imageTransformation:{enabled:e.features.imageTransformation.enabled},s3Protocol:{enabled:e.features.s3Protocol.enabled}}}});o(s,"Failed to update storage config")}},secrets:{async getUpdatedAt(t,e){let s=await r.GET("/v1/projects/{ref}/secrets",{params:{path:{ref:t}}});o(s,"Failed to fetch secrets");let a=s.data.find(n=>n.name===e);if(!(!a||!a.updated_at))return new Date(a.updated_at)}},notebooks:{async createNotebook(t,e){let s=_chunk6QB2YXYQcjs.B.parse(e),a=await m.POST("/v2/projects/{ref}/notebooks",{params:{path:{ref:t}},body:{data:{type:"notebook",attributes:s}}});S(a,"Failed to create notebook");let{id:n,attributes:p}=a.data.data;return{id:n,...p}},async listNotebooks(t){let e=[],s;do{let a=await m.GET("/v2/projects/{ref}/notebooks",{params:{path:{ref:t},query:s?{page:{after:s}}:void 0}});S(a,"Failed to retrieve project's notebooks"),e.push(...a.data.data.map(({id:n,attributes:p})=>({id:n,...p}))),s=ue(a.data.links.next)}while(s);return e},async getNotebook(t,e){let s=await m.GET("/v2/projects/{ref}/notebooks/{id}",{params:{path:{ref:t,id:e}}});S(s,"Failed to retrieve notebook");let{id:a,attributes:n}=s.data.data;return{id:a,...n}},async deleteNotebook(t,e){let s=await m.DELETE("/v2/projects/{ref}/notebooks/{id}",{params:{path:{ref:t,id:e}}});S(s,"Failed to delete notebook")}},feedback:_chunkC4YUF27Ucjs.d.call(void 0, {environment:new URL(l).origin==="https://api.supabase.com"?"production":"staging",async getUserId(){return u??=await _asyncNullishCoalesce((await r.GET("/v1/profile",{signal:AbortSignal.timeout(5e3)})).response.headers.get("X-Gotrue-Id"), async () => (void 0)),u}})}}function ue(i){return i?_nullishCoalesce(new URL(i,"https://supabase.com").searchParams.get("page[after]"), () => (void 0)):void 0}function me(i){switch(i){case"api.supabase.com":return"supabase.co";case"api.supabase.green":return"supabase.green";default:return"supabase.red"}}exports.a = Ge;
2
- //# sourceMappingURL=chunk-DG3LSIFH.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/chunk-DG3LSIFH.cjs","../src/platform/api-platform.ts","../src/management-api/index.ts"],"names":["createManagementApiClient","baseUrl","accessToken","headers","createClient"],"mappings":"AAAA,87BAAsD,wDAAwH,6DCGvK,yGCCA,4BAMW,SAGFA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAAkC,CAAC,CAAA,CACnC,CACA,OAAOC,oCAAAA,CACL,OAAA,CAAAH,CAAAA,CACA,OAAA,CAAS,CACP,aAAA,CAAe,CAAA,OAAA,EAAUC,CAAW,CAAA,CAAA","file":"/home/runner/work/mcp/mcp/packages/mcp-server-supabase/dist/chunk-DG3LSIFH.cjs","sourcesContent":[null,"import {\n getMultipartBoundary,\n parseMultipartStream,\n} from '@mjackson/multipart-parser';\nimport type { InitData } from '@supabase/mcp-utils';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport {\n getDefaultImportMapPath,\n getDeploymentId,\n getFilenameFromUrlOrPath,\n normalizeFilename,\n} from '../edge-function.js';\nimport { getClickHouseLogQuery } from '../logs.js';\nimport {\n assertProjectScopedSuccess,\n assertSuccess,\n createManagementApiClient,\n} from '../management-api/index.js';\nimport {\n assertSuccessV2,\n createManagementApiV2Client,\n} from '../management-api-v2/index.js';\nimport type { components as ManagementApiV2Components } from '../management-api-v2/types.js';\nimport { generatePassword } from '../password.js';\nimport { createFeedbackOperations } from './feedback.js';\nimport {\n applyMigrationOptionsSchema,\n createNotebookOptionsSchema,\n createBranchOptionsSchema,\n createProjectOptionsSchema,\n deployEdgeFunctionOptionsSchema,\n executeSqlOptionsSchema,\n getLogsOptionsSchema,\n queryLogsOptionsSchema,\n resetBranchOptionsSchema,\n type AccountOperations,\n type ApiKey,\n type ApiKeyType,\n type ApplyMigrationOptions,\n type BranchingOperations,\n type CreateBranchOptions,\n type CreateProjectOptions,\n type DatabaseOperations,\n type DebuggingOperations,\n type DeployEdgeFunctionOptions,\n type DevelopmentOperations,\n type SuccessResponse,\n type EdgeFunction,\n type EdgeFunctionsOperations,\n type EdgeFunctionWithBody,\n type ExecuteSqlOptions,\n type GetLogsOptions,\n type Notebook,\n type NotebookOperations,\n type QueryLogsOptions,\n type ResetBranchOptions,\n type SecretOperations,\n type StorageConfig,\n type StorageOperations,\n type SupabasePlatform,\n} from './index.js';\n\nconst { version } = packageJson;\n\nconst SUCCESS_RESPONSE: SuccessResponse = { success: true };\n\ntype HealthAdvisorName =\n ManagementApiV2Components['schemas']['V2RunProjectAdvisorsBody']['data']['attributes']['lints'][number]['name'];\n\nconst healthAdvisorNames = [\n 'log_data_api_error_rate_high',\n 'log_auth_error_rate_high',\n 'log_storage_error_rate_high',\n 'log_edge_function_error_rate_high',\n] as const satisfies readonly HealthAdvisorName[];\n\nconst hiddenHealthAdvisorResultNames: ReadonlySet<string> = new Set([\n 'project_not_active',\n 'advisor_check_unavailable',\n]);\n\nexport type SupabaseApiPlatformOptions = {\n /**\n * The access token for the Supabase Management API.\n */\n accessToken: string;\n\n /**\n * The API URL for the Supabase Management API.\n */\n apiUrl?: string;\n};\n\n/**\n * Creates a Supabase platform implementation using the Supabase Management API.\n */\nexport function createSupabaseApiPlatform(\n options: SupabaseApiPlatformOptions\n): SupabasePlatform {\n const { accessToken, apiUrl } = options;\n\n const managementApiUrl = apiUrl ?? 'https://api.supabase.com';\n\n let userId: string | undefined;\n\n let managementApiClient = createManagementApiClient(\n managementApiUrl,\n accessToken\n );\n let managementApiV2Client = createManagementApiV2Client(\n managementApiUrl,\n accessToken\n );\n\n const account: AccountOperations = {\n async listOrganizations() {\n const response = await managementApiClient.GET('/v1/organizations');\n\n assertSuccess(response, 'Failed to fetch organizations');\n\n return response.data;\n },\n async getOrganization(organizationId: string) {\n const response = await managementApiClient.GET(\n '/v1/organizations/{slug}',\n {\n params: {\n path: {\n slug: organizationId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch organization');\n\n return response.data;\n },\n async listProjects() {\n const response = await managementApiClient.GET('/v1/projects');\n\n assertSuccess(response, 'Failed to fetch projects');\n\n return response.data;\n },\n async getProject(projectId: string) {\n const response = await managementApiClient.GET('/v1/projects/{ref}', {\n params: {\n path: {\n ref: projectId,\n },\n },\n });\n assertSuccess(response, 'Failed to fetch project');\n return response.data;\n },\n async createProject(options: CreateProjectOptions) {\n const { name, organization_id, region, db_pass } =\n createProjectOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST('/v1/projects', {\n body: {\n name,\n region,\n organization_slug: organization_id,\n db_pass:\n db_pass ??\n generatePassword({\n length: 16,\n numbers: true,\n uppercase: true,\n lowercase: true,\n }),\n },\n });\n\n assertSuccess(response, 'Failed to create project');\n\n return response.data;\n },\n async pauseProject(projectId: string) {\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/pause',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to pause project');\n },\n async restoreProject(projectId: string) {\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/restore',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to restore project');\n },\n };\n\n const database: DatabaseOperations = {\n async executeSql<T>(projectId: string, options: ExecuteSqlOptions) {\n const { query, parameters, read_only } =\n executeSqlOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/database/query',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n query,\n parameters,\n read_only,\n },\n }\n );\n\n assertProjectScopedSuccess(\n response,\n 'Failed to execute SQL query',\n projectId\n );\n\n return response.data as unknown as T[];\n },\n async listMigrations(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/database/migrations',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertProjectScopedSuccess(\n response,\n 'Failed to fetch migrations',\n projectId\n );\n\n return response.data;\n },\n async applyMigration(projectId: string, options: ApplyMigrationOptions) {\n const { name, query } = applyMigrationOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/database/migrations',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n name,\n query,\n },\n }\n );\n\n assertProjectScopedSuccess(\n response,\n 'Failed to apply migration',\n projectId\n );\n\n // Intentionally don't return the result of the migration\n // to avoid prompt injection attacks. If the migration failed,\n // it will throw an error.\n },\n };\n\n const debugging: DebuggingOperations = {\n logsDialect: 'clickhouse',\n async getLogs(projectId: string, options: GetLogsOptions) {\n const { service, iso_timestamp_start, iso_timestamp_end } =\n getLogsOptionsSchema.parse(options);\n\n const sql = getClickHouseLogQuery(service);\n\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/analytics/endpoints/logs',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n sql,\n iso_timestamp_start,\n iso_timestamp_end,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch logs');\n\n return response.data;\n },\n async queryLogs(projectId: string, options: QueryLogsOptions) {\n const { sql, iso_timestamp_start, iso_timestamp_end } =\n queryLogsOptionsSchema.parse(options);\n\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/analytics/endpoints/logs',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n sql,\n iso_timestamp_start,\n iso_timestamp_end,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to query logs');\n\n return response.data;\n },\n async getSecurityAdvisors(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/advisors/security',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch security advisors');\n\n return response.data;\n },\n async getPerformanceAdvisors(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/advisors/performance',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch performance advisors');\n\n return response.data;\n },\n async getHealthAdvisors(projectId: string) {\n const response = await managementApiV2Client.POST(\n '/v2/projects/{ref}/advisors/run',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n data: {\n type: 'project_advisors',\n attributes: {\n lints: healthAdvisorNames.map((name) => ({ name })),\n },\n },\n },\n }\n );\n\n assertSuccessV2(response, 'Failed to fetch health advisors');\n\n const attributes = response.data.data.attributes;\n\n return {\n ...attributes,\n lints: attributes.lints.filter(\n ({ name }) => !hiddenHealthAdvisorResultNames.has(name)\n ),\n };\n },\n };\n\n const development: DevelopmentOperations = {\n async getProjectUrl(projectId: string): Promise<string> {\n const apiUrl = new URL(managementApiUrl);\n return `https://${projectId}.${getProjectDomain(apiUrl.hostname)}`;\n },\n async getPublishableKeys(projectId: string): Promise<ApiKey[]> {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/api-keys',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n reveal: 'false',\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch API keys');\n\n // Try to check if legacy JWT-based keys are enabled\n // If this fails, we'll continue without the disabled field\n let legacyKeysEnabled: boolean | undefined = undefined;\n try {\n const legacyKeysResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/api-keys/legacy',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n if (legacyKeysResponse.response.ok) {\n legacyKeysEnabled = legacyKeysResponse.data?.enabled ?? true;\n }\n } catch (error) {\n // If we can't fetch legacy key status, continue without it\n legacyKeysEnabled = undefined;\n }\n\n // Filter for client-safe keys: legacy 'anon' or publishable type\n const clientKeys =\n response.data?.filter(\n (key) => key.name === 'anon' || key.type === 'publishable'\n ) ?? [];\n\n if (clientKeys.length === 0) {\n throw new Error(\n 'No client-safe API keys (anon or publishable) found. Please create a publishable key in your project settings.'\n );\n }\n\n return clientKeys.map((key) => ({\n api_key: key.api_key!,\n name: key.name,\n type: (key.type === 'publishable'\n ? 'publishable'\n : 'legacy') satisfies ApiKeyType,\n // Only include disabled field if we successfully fetched legacy key status\n ...(legacyKeysEnabled !== undefined && {\n disabled: key.type === 'legacy' && !legacyKeysEnabled,\n }),\n description: key.description ?? undefined,\n id: key.id ?? undefined,\n }));\n },\n async generateTypescriptTypes(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/types/typescript',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch TypeScript types');\n\n return response.data;\n },\n };\n\n const functions: EdgeFunctionsOperations = {\n async listEdgeFunctions(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/functions',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch Edge Functions');\n\n return response.data.map((edgeFunction) => {\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: getFilenameFromUrlOrPath(edgeFunction.entrypoint_path),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: getFilenameFromUrlOrPath(edgeFunction.import_map_path),\n })\n : undefined;\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n };\n });\n },\n async getEdgeFunction(projectId: string, functionSlug: string) {\n const functionResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n }\n );\n\n if (functionResponse.error) {\n throw functionResponse.error;\n }\n\n assertSuccess(functionResponse, 'Failed to fetch Edge Function');\n\n const edgeFunction = functionResponse.data;\n\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: getFilenameFromUrlOrPath(edgeFunction.entrypoint_path),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: getFilenameFromUrlOrPath(edgeFunction.import_map_path),\n })\n : undefined;\n\n const bodyResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}/body',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n headers: {\n Accept: 'multipart/form-data',\n },\n parseAs: 'stream',\n }\n );\n\n assertSuccess(bodyResponse, 'Failed to fetch Edge Function files');\n\n const contentType = bodyResponse.response.headers.get('content-type');\n\n if (!contentType || !contentType.startsWith('multipart/form-data')) {\n throw new Error(\n `Unexpected content type: ${contentType}. Expected multipart/form-data.`\n );\n }\n\n const boundary = getMultipartBoundary(contentType);\n\n if (!boundary) {\n throw new Error('No multipart boundary found in response headers');\n }\n\n if (!bodyResponse.data) {\n throw new Error('No data received from Edge Function body');\n }\n\n const files: EdgeFunctionWithBody['files'] = [];\n const parts = parseMultipartStream(bodyResponse.data, { boundary });\n\n for await (const part of parts) {\n if (part.isFile && part.filename) {\n files.push({\n name: normalizeFilename({\n deploymentId,\n filename: part.filename,\n }),\n content: part.text,\n });\n }\n }\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n files,\n };\n },\n async deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ) {\n let {\n name,\n entrypoint_path,\n import_map_path,\n verify_jwt,\n files: inputFiles,\n } = deployEdgeFunctionOptionsSchema.parse(options);\n\n let existingEdgeFunction: EdgeFunction | undefined;\n try {\n existingEdgeFunction = await functions.getEdgeFunction(projectId, name);\n } catch (error) {}\n\n // Use existing import map path or file name heuristic if not provided\n import_map_path ??=\n existingEdgeFunction?.import_map_path ??\n getDefaultImportMapPath(inputFiles);\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/functions/deploy',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: { slug: name },\n },\n body: {\n metadata: {\n name,\n entrypoint_path,\n import_map_path,\n verify_jwt,\n },\n file: inputFiles as any, // We need to pass file name and content to our serializer\n },\n bodySerializer(body) {\n const formData = new FormData();\n\n const blob = new Blob([JSON.stringify(body.metadata)], {\n type: 'application/json',\n });\n formData.append('metadata', blob);\n\n body.file?.forEach((f: any) => {\n const file: { name: string; content: string } = f;\n const blob = new Blob([file.content], {\n type: 'application/typescript',\n });\n formData.append('file', blob, file.name);\n });\n\n return formData;\n },\n }\n );\n\n assertSuccess(response, 'Failed to deploy Edge Function');\n\n return response.data;\n },\n };\n\n const branching: BranchingOperations = {\n async listBranches(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/branches',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n // There are no branches if branching is disabled\n if (response.response.status === 422) return [];\n assertSuccess(response, 'Failed to list branches');\n\n return response.data;\n },\n async createBranch(projectId: string, options: CreateBranchOptions) {\n const { name } = createBranchOptionsSchema.parse(options);\n\n const createBranchResponse = await managementApiClient.POST(\n '/v1/projects/{ref}/branches',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n branch_name: name,\n },\n }\n );\n\n assertSuccess(createBranchResponse, 'Failed to create branch');\n\n return createBranchResponse.data;\n },\n async deleteBranch(branchId: string) {\n const response = await managementApiClient.DELETE(\n '/v1/branches/{branch_id_or_ref}',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to delete branch');\n },\n async mergeBranch(branchId: string) {\n const response = await managementApiClient.POST(\n '/v1/branches/{branch_id_or_ref}/merge',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n body: {},\n }\n );\n\n assertSuccess(response, 'Failed to merge branch');\n },\n async resetBranch(branchId: string, options: ResetBranchOptions) {\n const { migration_version } = resetBranchOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/branches/{branch_id_or_ref}/reset',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n body: {\n migration_version,\n },\n }\n );\n\n assertSuccess(response, 'Failed to reset branch');\n },\n async rebaseBranch(branchId: string) {\n const response = await managementApiClient.POST(\n '/v1/branches/{branch_id_or_ref}/push',\n {\n params: {\n path: {\n branch_id_or_ref: branchId,\n },\n },\n body: {},\n }\n );\n\n assertSuccess(response, 'Failed to rebase branch');\n },\n };\n\n const storage: StorageOperations = {\n // Storage methods\n async listAllBuckets(project_id: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/storage/buckets',\n {\n params: {\n path: {\n ref: project_id,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to list storage buckets');\n\n return response.data;\n },\n\n async getStorageConfig(project_id: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/config/storage',\n {\n params: {\n path: {\n ref: project_id,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to get storage config');\n\n return response.data;\n },\n\n async updateStorageConfig(projectId: string, config: StorageConfig) {\n const response = await managementApiClient.PATCH(\n '/v1/projects/{ref}/config/storage',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n fileSizeLimit: config.fileSizeLimit,\n features: {\n imageTransformation: {\n enabled: config.features.imageTransformation.enabled,\n },\n s3Protocol: {\n enabled: config.features.s3Protocol.enabled,\n },\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to update storage config');\n },\n };\n\n const secrets: SecretOperations = {\n async getUpdatedAt(projectId: string, name: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/secrets',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch secrets');\n\n const secret = response.data.find((s) => s.name === name);\n if (!secret || !secret.updated_at) {\n return undefined;\n }\n\n return new Date(secret.updated_at);\n },\n };\n\n const notebooks: NotebookOperations = {\n async createNotebook(projectId, options) {\n const attributes = createNotebookOptionsSchema.parse(options);\n const response = await managementApiV2Client.POST(\n '/v2/projects/{ref}/notebooks',\n {\n params: { path: { ref: projectId } },\n body: { data: { type: 'notebook', attributes } },\n }\n );\n\n assertSuccessV2(response, 'Failed to create notebook');\n\n const { id, attributes: notebook } = response.data.data;\n return { id, ...notebook };\n },\n async listNotebooks(projectId: string) {\n const notebooks: Notebook[] = [];\n let cursor: string | undefined;\n\n do {\n const response = await managementApiV2Client.GET(\n '/v2/projects/{ref}/notebooks',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: cursor ? { page: { after: cursor } } : undefined,\n },\n }\n );\n\n assertSuccessV2(response, \"Failed to retrieve project's notebooks\");\n\n notebooks.push(\n ...response.data.data.map(({ id, attributes }) => ({\n id,\n ...attributes,\n }))\n );\n\n cursor = getNextNotebooksCursor(response.data.links.next);\n } while (cursor);\n\n return notebooks;\n },\n async getNotebook(projectId: string, notebookId: string) {\n const response = await managementApiV2Client.GET(\n '/v2/projects/{ref}/notebooks/{id}',\n {\n params: {\n path: {\n ref: projectId,\n id: notebookId,\n },\n },\n }\n );\n\n assertSuccessV2(response, 'Failed to retrieve notebook');\n\n const { id, attributes } = response.data.data;\n\n return { id, ...attributes };\n },\n async deleteNotebook(projectId: string, notebookId: string) {\n const response = await managementApiV2Client.DELETE(\n '/v2/projects/{ref}/notebooks/{id}',\n { params: { path: { ref: projectId, id: notebookId } } }\n );\n\n assertSuccessV2(response, 'Failed to delete notebook');\n },\n };\n\n const platform: SupabasePlatform = {\n async init(info: InitData) {\n const { clientInfo } = info;\n if (!clientInfo) {\n throw new Error('Client info is required');\n }\n\n // Re-initialize the management API clients with the user agent\n const userAgentHeaders = {\n 'User-Agent': `supabase-mcp/${version} (${clientInfo.name}/${clientInfo.version})`,\n };\n managementApiClient = createManagementApiClient(\n managementApiUrl,\n accessToken,\n userAgentHeaders\n );\n managementApiV2Client = createManagementApiV2Client(\n managementApiUrl,\n accessToken,\n userAgentHeaders\n );\n },\n account,\n database,\n debugging,\n development,\n functions,\n branching,\n storage,\n secrets,\n notebooks,\n feedback: createFeedbackOperations({\n // Staging, local, and custom API URLs keep their feedback out of production\n environment:\n new URL(managementApiUrl).origin === 'https://api.supabase.com'\n ? 'production'\n : 'staging',\n async getUserId() {\n // X-Gotrue-Id is set on every response, see how CLI uses this too: https://github.com/supabase/cli/blob/8a549dffa6bc5c88069c61c1f55ef55ad9b82ae2/apps/cli/src/command-internal/identity-stitch.ts#L10-L20\n userId ??=\n (\n await managementApiClient.GET('/v1/profile', {\n signal: AbortSignal.timeout(5_000),\n })\n ).response.headers.get('X-Gotrue-Id') ?? undefined;\n return userId;\n },\n }),\n };\n\n return platform;\n}\n\n/**\n * Extracts the `page[after]` cursor from a JSON:API `links.next` URL path\n * (e.g. `/v2/projects/{ref}/notebooks?page[size]=10&page[after]=<cursor>`).\n */\nfunction getNextNotebooksCursor(next: string | null | undefined) {\n if (!next) {\n return undefined;\n }\n\n const url = new URL(next, 'https://supabase.com');\n return url.searchParams.get('page[after]') ?? undefined;\n}\n\nfunction getProjectDomain(apiHostname: string) {\n switch (apiHostname) {\n case 'api.supabase.com':\n return 'supabase.co';\n case 'api.supabase.green':\n return 'supabase.green';\n default:\n return 'supabase.red';\n }\n}\n","import createClient, {\n type Client,\n type FetchResponse,\n type ParseAsResponse,\n} from 'openapi-fetch';\nimport type {\n MediaType,\n ResponseObjectMap,\n SuccessResponse,\n} from 'openapi-typescript-helpers';\nimport { z } from 'zod/v4';\nimport type { paths } from './types.js';\n\nexport function createManagementApiClient(\n baseUrl: string,\n accessToken: string,\n headers: Record<string, string> = {}\n) {\n return createClient<paths>({\n baseUrl,\n headers: {\n Authorization: `Bearer ${accessToken}`,\n ...headers,\n },\n });\n}\n\nexport type ManagementApiClient = Client<paths>;\n\nexport type SuccessResponseType<\n T extends Record<string | number, any>,\n Options,\n Media extends MediaType,\n> = {\n data: ParseAsResponse<SuccessResponse<ResponseObjectMap<T>, Media>, Options>;\n error?: never;\n response: Response;\n};\n\nconst errorSchema = z.object({\n message: z.string(),\n});\n\n// The API prefixes validation errors with the field name, e.g. `ref: ref must be exactly 20 characters long`.\nconst malformedRefMessagePattern = /^ref: /;\n\nexport function assertSuccess<\n T extends Record<string | number, any>,\n Options,\n Media extends MediaType,\n>(\n response: FetchResponse<T, Options, Media>,\n fallbackMessage: string\n): asserts response is SuccessResponseType<T, Options, Media> {\n if ('error' in response) {\n if (response.response.status === 401) {\n throw new Error(\n 'Unauthorized. Please provide a valid access token to the MCP server via the --access-token flag or SUPABASE_ACCESS_TOKEN.'\n );\n }\n\n const { data: errorContent } = errorSchema.safeParse(response.error);\n\n if (errorContent) {\n if (\n response.response.status === 400 &&\n malformedRefMessagePattern.test(errorContent.message)\n ) {\n throw new Error(\n `${errorContent.message.replace(/\\.$/, '')}. Copy the ref exactly as returned by list_projects (id) or list_branches (project_ref), depending on whether you're working with the main project or a branch; do not retype or shorten it.`\n );\n }\n\n throw new Error(errorContent.message);\n }\n\n throw new Error(fallbackMessage);\n }\n}\n\n/**\n * Asserts success for project-scoped endpoints, mapping 403 responses to an\n * actionable message. A permission error on a specific project most commonly\n * means the access token is scoped to an organization that doesn't own the\n * project (e.g. the wrong organization was selected during OAuth login).\n *\n * Currently applied only to database operations (see AI-178). Before adopting\n * for other endpoints, check that a 403 there isn't better explained by plan\n * or role restrictions, where org-selection advice would mislead.\n */\nexport function assertProjectScopedSuccess<\n T extends Record<string | number, any>,\n Options,\n Media extends MediaType,\n>(\n response: FetchResponse<T, Options, Media>,\n fallbackMessage: string,\n projectId: string\n): asserts response is SuccessResponseType<T, Options, Media> {\n if ('error' in response && response.response.status === 403) {\n const { data: errorContent } = errorSchema.safeParse(response.error);\n const apiMessage = (errorContent?.message ?? fallbackMessage).replace(\n /\\.$/,\n ''\n );\n\n throw new Error(\n `${apiMessage}. Access to project '${projectId}' was denied. If this project exists, your access token may be scoped to a different organization: re-authenticate with the MCP server and select the organization that owns this project.`\n );\n }\n\n assertSuccess(response, fallbackMessage);\n}\n"]}