@supabase/mcp-server-supabase 0.5.0-alpha.1 → 0.5.0-alpha.3

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 (38) hide show
  1. package/LICENSE +201 -0
  2. package/dist/chunk-A5YYSXLT.js +2 -0
  3. package/dist/chunk-A5YYSXLT.js.map +1 -0
  4. package/dist/{chunk-LL3OYJR7.cjs → chunk-L6VODEGU.cjs} +2 -2
  5. package/dist/chunk-L6VODEGU.cjs.map +1 -0
  6. package/dist/chunk-MMFJ65OS.cjs +2 -0
  7. package/dist/chunk-MMFJ65OS.cjs.map +1 -0
  8. package/dist/{chunk-YFZN5EJN.js → chunk-PX45KCZA.js} +2 -2
  9. package/dist/chunk-PX45KCZA.js.map +1 -0
  10. package/dist/chunk-TFXIAEEH.js +310 -0
  11. package/dist/chunk-TFXIAEEH.js.map +1 -0
  12. package/dist/chunk-YABXOKUT.cjs +310 -0
  13. package/dist/chunk-YABXOKUT.cjs.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.cts +3 -3
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +1 -1
  18. package/dist/platform/api-platform.cjs +1 -1
  19. package/dist/platform/api-platform.js +1 -1
  20. package/dist/platform/index.cjs +1 -1
  21. package/dist/platform/index.d.cts +3 -3
  22. package/dist/platform/index.d.ts +3 -3
  23. package/dist/platform/index.js +1 -1
  24. package/dist/transports/stdio.cjs +1 -1
  25. package/dist/transports/stdio.cjs.map +1 -1
  26. package/dist/transports/stdio.js +1 -1
  27. package/dist/transports/stdio.js.map +1 -1
  28. package/package.json +21 -16
  29. package/dist/chunk-3ZRWMUMF.js +0 -311
  30. package/dist/chunk-3ZRWMUMF.js.map +0 -1
  31. package/dist/chunk-4ET572GE.cjs +0 -311
  32. package/dist/chunk-4ET572GE.cjs.map +0 -1
  33. package/dist/chunk-LL3OYJR7.cjs.map +0 -1
  34. package/dist/chunk-W2V6ITSZ.js +0 -2
  35. package/dist/chunk-W2V6ITSZ.js.map +0 -1
  36. package/dist/chunk-X63UTBYC.cjs +0 -2
  37. package/dist/chunk-X63UTBYC.cjs.map +0 -1
  38. package/dist/chunk-YFZN5EJN.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Supabase
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ import{g as R,h as C,i as x,j as B,k as M,l as G,n as D}from"./chunk-PX45KCZA.js";import{a as _,d as j,e as A}from"./chunk-TFXIAEEH.js";import{getMultipartBoundary as J,parseMultipartStream as V}from"@mjackson/multipart-parser";import{relative as P}from"path/posix";import{fileURLToPath as q}from"url";import L from"openapi-fetch";import{z as k}from"zod";function v(i,g,l={}){return L({baseUrl:i,headers:{Authorization:`Bearer ${g}`,...l}})}var $=k.object({message:k.string()});function r(i,g){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:l}=$.safeParse(i.error);throw l?new Error(l.message):new Error(g)}}var H="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N="abcdefghijklmnopqrstuvwxyz",I="0123456789",K="!@#$%^&*()_+~`|}{[]:;?><,./-=",U=({length:i=10,numbers:g=!1,symbols:l=!1,uppercase:y=!0,lowercase:a=!0}={})=>{let d="";if(y&&(d+=H),a&&(d+=N),g&&(d+=I),l&&(d+=K),d.length===0)throw new Error("at least one character set must be selected");let w=new Uint32Array(i);crypto.getRandomValues(w);let O="";for(let h=0;h<i;h++){let b=w[h]%d.length;O+=d.charAt(b)}return O};var{version:W}=_;function le(i){let{accessToken:g,apiUrl:l}=i,y=l??"https://api.supabase.com",a=v(y,g),d={async listOrganizations(){let t=await a.GET("/v1/organizations");return r(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await a.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return r(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await a.GET("/v1/projects");return r(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await a.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return r(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:s,region:n,db_pass:o}=R.parse(t),p=await a.POST("/v1/projects",{body:{name:e,region:n,organization_id:s,db_pass:o??U({length:16,numbers:!0,uppercase:!0,lowercase:!0})}});return r(p,"Failed to create project"),p.data},async pauseProject(t){let e=await a.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});r(e,"Failed to pause project")},async restoreProject(t){let e=await a.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});r(e,"Failed to restore project")}},w={async executeSql(t,e){let{query:s,read_only:n}=M.parse(e),o=await a.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:s,read_only:n}});return r(o,"Failed to execute SQL query"),o.data},async listMigrations(t){let e=await a.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return r(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:s,query:n}=G.parse(e),o=await a.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:s,query:n}});r(o,"Failed to apply migration")}},O={async getLogs(t,e){let{sql:s,iso_timestamp_start:n,iso_timestamp_end:o}=D.parse(e),p=await a.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:s,iso_timestamp_start:n,iso_timestamp_end:o}}});return r(p,"Failed to fetch logs"),p.data},async getSecurityAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return r(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return r(e,"Failed to fetch performance advisors"),e.data}},h={async getProjectUrl(t){let e=new URL(y);return`https://${t}.${Q(e.hostname)}`},async getAnonKey(t){let e=await a.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});r(e,"Failed to fetch API keys");let s=e.data?.find(n=>n.name==="anon");if(!s?.api_key)throw new Error("Anonymous key not found");return s.api_key},async generateTypescriptTypes(t){let e=await a.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return r(e,"Failed to fetch TypeScript types"),e.data}},b={async listEdgeFunctions(t){let e=await a.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return r(e,"Failed to fetch Edge Functions"),await Promise.all(e.data.map(async s=>await b.getEdgeFunction(t,s.slug)))},async getEdgeFunction(t,e){let s=await a.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(s.error)throw s.error;r(s,"Failed to fetch Edge Function");let n=s.data,o=j(t,n.id,n.version),p=A(o),E=n.entrypoint_path?P(p,q(n.entrypoint_path,{windows:!1})):void 0,F=n.import_map_path?P(p,q(n.import_map_path,{windows:!1})):void 0,m=await a.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});r(m,"Failed to fetch Edge Function files");let c=m.response.headers.get("content-type");if(!c||!c.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${c}. Expected multipart/form-data.`);let f=J(c);if(!f)throw new Error("No multipart boundary found in response headers");if(!m.data)throw new Error("No data received from Edge Function body");let S=[],T=V(m.data,{boundary:f});for await(let u of T)u.isFile&&u.filename&&S.push({name:P(p,u.filename),content:u.text});return{...n,entrypoint_path:E,import_map_path:F,files:S}},async deployEdgeFunction(t,e){let{name:s,entrypoint_path:n,import_map_path:o,files:p}=B.parse(e),E;try{E=await b.getEdgeFunction(t,s)}catch{}let F=p.find(c=>["deno.json","import_map.json"].includes(c.name));o??=E?.import_map_path??F?.name;let m=await a.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:s}},body:{metadata:{name:s,entrypoint_path:n,import_map_path:o},file:p},bodySerializer(c){let f=new FormData,S=new Blob([JSON.stringify(c.metadata)],{type:"application/json"});return f.append("metadata",S),c.file?.forEach(T=>{let u=T,z=new Blob([u.content],{type:"application/typescript"});f.append("file",z,u.name)}),f}});return r(m,"Failed to deploy Edge Function"),m.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");a=v(y,g,{"User-Agent":`supabase-mcp/${W} (${e.name}/${e.version})`})},account:d,database:w,debugging:O,development:h,functions:b,branching:{async listBranches(t){let e=await a.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(r(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:s}=C.parse(e),n=await a.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:s}});return r(n,"Failed to create branch"),n.data},async deleteBranch(t){let e=await a.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});r(e,"Failed to delete branch")},async mergeBranch(t){let e=await a.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:s}=x.parse(e),n=await a.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:s}});r(n,"Failed to reset branch")},async rebaseBranch(t){let e=await a.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await a.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return r(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await a.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return r(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let s=await a.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}}}});return r(s,"Failed to update storage config"),s.data}}}}function Q(i){switch(i){case"api.supabase.com":return"supabase.co";case"api.supabase.green":return"supabase.green";default:return"supabase.red"}}export{le as a};
2
+ //# sourceMappingURL=chunk-A5YYSXLT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/platform/api-platform.ts","../src/management-api/index.ts","../src/password.ts"],"sourcesContent":["import {\n getMultipartBoundary,\n parseMultipartStream,\n} from '@mjackson/multipart-parser';\nimport type { InitData } from '@supabase/mcp-utils';\nimport { relative } from 'node:path/posix';\nimport { fileURLToPath } from 'node:url';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { getDeploymentId, getPathPrefix } from '../edge-function.js';\nimport {\n assertSuccess,\n createManagementApiClient,\n} from '../management-api/index.js';\nimport { generatePassword } from '../password.js';\nimport {\n applyMigrationOptionsSchema,\n createBranchOptionsSchema,\n createProjectOptionsSchema,\n deployEdgeFunctionOptionsSchema,\n executeSqlOptionsSchema,\n getLogsOptionsSchema,\n resetBranchOptionsSchema,\n type AccountOperations,\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 EdgeFunction,\n type EdgeFunctionsOperations,\n type ExecuteSqlOptions,\n type GetLogsOptions,\n type ResetBranchOptions,\n type StorageConfig,\n type StorageOperations,\n type SupabasePlatform,\n} from './index.js';\n\nconst { version } = packageJson;\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 managementApiClient = createManagementApiClient(\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_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, read_only } = 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 read_only,\n },\n }\n );\n\n assertSuccess(response, 'Failed to execute SQL query');\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 assertSuccess(response, 'Failed to fetch migrations');\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 assertSuccess(response, 'Failed to apply migration');\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 async getLogs(projectId: string, options: GetLogsOptions) {\n const { sql, iso_timestamp_start, iso_timestamp_end } =\n getLogsOptionsSchema.parse(options);\n\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/analytics/endpoints/logs.all',\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 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 };\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 getAnonKey(projectId: string): Promise<string> {\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 const anonKey = response.data?.find((key) => key.name === 'anon');\n\n if (!anonKey?.api_key) {\n throw new Error('Anonymous key not found');\n }\n\n return anonKey.api_key;\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 // Fetch files for each Edge Function\n return await Promise.all(\n response.data.map(async (listedFunction) => {\n return await functions.getEdgeFunction(\n projectId,\n listedFunction.slug\n );\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 pathPrefix = getPathPrefix(deploymentId);\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? relative(\n pathPrefix,\n fileURLToPath(edgeFunction.entrypoint_path, { windows: false })\n )\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? relative(\n pathPrefix,\n fileURLToPath(edgeFunction.import_map_path, { windows: false })\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: EdgeFunction['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: relative(pathPrefix, part.filename),\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 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 const import_map_file = inputFiles.find((file) =>\n ['deno.json', 'import_map.json'].includes(file.name)\n );\n\n // Use existing import map path or file name heuristic if not provided\n import_map_path ??=\n existingEdgeFunction?.import_map_path ?? import_map_file?.name;\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 },\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}',\n {\n params: {\n path: {\n branch_id: 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}/merge',\n {\n params: {\n path: {\n branch_id: 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}/reset',\n {\n params: {\n path: {\n branch_id: 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}/push',\n {\n params: {\n path: {\n branch_id: 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 return response.data;\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 client with the user agent\n managementApiClient = createManagementApiClient(\n managementApiUrl,\n accessToken,\n {\n 'User-Agent': `supabase-mcp/${version} (${clientInfo.name}/${clientInfo.version})`,\n }\n );\n },\n account,\n database,\n debugging,\n development,\n functions,\n branching,\n storage,\n };\n\n return platform;\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';\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\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 throw new Error(errorContent.message);\n }\n\n throw new Error(fallbackMessage);\n }\n}\n","const UPPERCASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst LOWERCASE_CHARS = 'abcdefghijklmnopqrstuvwxyz';\nconst NUMBER_CHARS = '0123456789';\nconst SYMBOL_CHARS = '!@#$%^&*()_+~`|}{[]:;?><,./-=';\n\nexport type GeneratePasswordOptions = {\n length?: number;\n numbers?: boolean;\n uppercase?: boolean;\n lowercase?: boolean;\n symbols?: boolean;\n};\n\n/**\n * Generates a cryptographically secure random password.\n *\n * @returns The generated password\n */\nexport const generatePassword = ({\n length = 10,\n numbers = false,\n symbols = false,\n uppercase = true,\n lowercase = true,\n} = {}) => {\n // Build the character set based on options\n let chars = '';\n if (uppercase) {\n chars += UPPERCASE_CHARS;\n }\n if (lowercase) {\n chars += LOWERCASE_CHARS;\n }\n if (numbers) {\n chars += NUMBER_CHARS;\n }\n if (symbols) {\n chars += SYMBOL_CHARS;\n }\n\n if (chars.length === 0) {\n throw new Error('at least one character set must be selected');\n }\n\n const randomValues = new Uint32Array(length);\n crypto.getRandomValues(randomValues);\n\n // Map random values to our character set\n let password = '';\n for (let i = 0; i < length; i++) {\n const randomIndex = randomValues[i]! % chars.length;\n password += chars.charAt(randomIndex);\n }\n\n return password;\n};\n"],"mappings":"wIAAA,OACE,wBAAAA,EACA,wBAAAC,MACK,6BAEP,OAAS,YAAAC,MAAgB,aACzB,OAAS,iBAAAC,MAAqB,MCN9B,OAAOC,MAIA,gBAMP,OAAS,KAAAC,MAAS,MAGX,SAASC,EACdC,EACAC,EACAC,EAAkC,CAAC,EACnC,CACA,OAAOL,EAAoB,CACzB,QAAAG,EACA,QAAS,CACP,cAAe,UAAUC,CAAW,GACpC,GAAGC,CACL,CACF,CAAC,CACH,CAcA,IAAMC,EAAcL,EAAE,OAAO,CAC3B,QAASA,EAAE,OAAO,CACpB,CAAC,EAEM,SAASM,EAKdC,EACAC,EAC4D,CAC5D,GAAI,UAAWD,EAAU,CACvB,GAAIA,EAAS,SAAS,SAAW,IAC/B,MAAM,IAAI,MACR,2HACF,EAGF,GAAM,CAAE,KAAME,CAAa,EAAIJ,EAAY,UAAUE,EAAS,KAAK,EAEnE,MAAIE,EACI,IAAI,MAAMA,EAAa,OAAO,EAGhC,IAAI,MAAMD,CAAe,CACjC,CACF,CClEA,IAAME,EAAkB,6BAClBC,EAAkB,6BAClBC,EAAe,aACfC,EAAe,gCAeRC,EAAmB,CAAC,CAC/B,OAAAC,EAAS,GACT,QAAAC,EAAU,GACV,QAAAC,EAAU,GACV,UAAAC,EAAY,GACZ,UAAAC,EAAY,EACd,EAAI,CAAC,IAAM,CAET,IAAIC,EAAQ,GAcZ,GAbIF,IACFE,GAASV,GAEPS,IACFC,GAAST,GAEPK,IACFI,GAASR,GAEPK,IACFG,GAASP,GAGPO,EAAM,SAAW,EACnB,MAAM,IAAI,MAAM,6CAA6C,EAG/D,IAAMC,EAAe,IAAI,YAAYN,CAAM,EAC3C,OAAO,gBAAgBM,CAAY,EAGnC,IAAIC,EAAW,GACf,QAASC,EAAI,EAAGA,EAAIR,EAAQQ,IAAK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BAAqB,CACnB,QAASA,EAAO,SAAS,oBAAoB,OAC/C,EACA,WAAY,CACV,QAASA,EAAO,SAAS,WAAW,OACtC,CACF,CACF,CACF,CACF,EAEA,OAAA7D,EAAcD,EAAU,iCAAiC,EAElDA,EAAS,IAClB,CACF,CAyBA,CAGF,CAEA,SAASqB,EAAiB0C,EAAqB,CAC7C,OAAQA,EAAa,CACnB,IAAK,mBACH,MAAO,cACT,IAAK,qBACH,MAAO,iBACT,QACE,MAAO,cACX,CACF","names":["getMultipartBoundary","parseMultipartStream","relative","fileURLToPath","createClient","z","createManagementApiClient","baseUrl","accessToken","headers","errorSchema","assertSuccess","response","fallbackMessage","errorContent","UPPERCASE_CHARS","LOWERCASE_CHARS","NUMBER_CHARS","SYMBOL_CHARS","generatePassword","length","numbers","symbols","uppercase","lowercase","chars","randomValues","password","i","randomIndex","version","package_default","createSupabaseApiPlatform","options","accessToken","apiUrl","managementApiUrl","managementApiClient","createManagementApiClient","account","response","assertSuccess","organizationId","projectId","name","organization_id","region","db_pass","createProjectOptionsSchema","generatePassword","database","query","read_only","executeSqlOptionsSchema","applyMigrationOptionsSchema","debugging","sql","iso_timestamp_start","iso_timestamp_end","getLogsOptionsSchema","development","getProjectDomain","anonKey","key","functions","listedFunction","functionSlug","functionResponse","edgeFunction","deploymentId","getDeploymentId","pathPrefix","getPathPrefix","entrypoint_path","relative","fileURLToPath","import_map_path","bodyResponse","contentType","boundary","getMultipartBoundary","files","parts","parseMultipartStream","part","inputFiles","deployEdgeFunctionOptionsSchema","existingEdgeFunction","import_map_file","file","body","formData","blob","f","info","clientInfo","createBranchOptionsSchema","createBranchResponse","branchId","migration_version","resetBranchOptionsSchema","project_id","config","apiHostname"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4ET572GEcjs = require('./chunk-4ET572GE.cjs');var _zod = require('zod');var r=_zod.z.object({id:_zod.z.string(),name:_zod.z.string(),owner:_zod.z.string(),created_at:_zod.z.string(),updated_at:_zod.z.string(),public:_zod.z.boolean()}),i= exports.b =_zod.z.object({fileSizeLimit:_zod.z.number(),features:_zod.z.object({imageTransformation:_zod.z.object({enabled:_zod.z.boolean()}),s3Protocol:_zod.z.object({enabled:_zod.z.boolean()})})}),s= exports.c =_zod.z.object({id:_zod.z.string(),name:_zod.z.string(),plan:_zod.z.string().optional(),allowed_release_channels:_zod.z.array(_zod.z.string()),opt_in_tags:_zod.z.array(_zod.z.string())}),a= exports.d =_zod.z.object({id:_zod.z.string(),organization_id:_zod.z.string(),name:_zod.z.string(),status:_zod.z.string(),created_at:_zod.z.string(),region:_zod.z.string()}),p= exports.e =_zod.z.object({id:_zod.z.string(),name:_zod.z.string(),project_ref:_zod.z.string(),parent_project_ref:_zod.z.string(),is_default:_zod.z.boolean(),git_branch:_zod.z.string().optional(),pr_number:_zod.z.number().optional(),latest_check_run_id:_zod.z.number().optional(),persistent:_zod.z.boolean(),status:_zod.z.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:_zod.z.string(),updated_at:_zod.z.string()}),c= exports.f =_zod.z.object({id:_zod.z.string(),slug:_zod.z.string(),name:_zod.z.string(),status:_zod.z.string(),version:_zod.z.number(),created_at:_zod.z.number().optional(),updated_at:_zod.z.number().optional(),verify_jwt:_zod.z.boolean().optional(),import_map:_zod.z.boolean().optional(),import_map_path:_zod.z.string().optional(),entrypoint_path:_zod.z.string().optional(),files:_zod.z.array(_zod.z.object({name:_zod.z.string(),content:_zod.z.string()}))}),g= exports.g =_zod.z.object({name:_zod.z.string(),organization_id:_zod.z.string(),region:_zod.z.enum(_chunk4ET572GEcjs.c).optional(),db_pass:_zod.z.string().optional()}),m= exports.h =_zod.z.object({name:_zod.z.string()}),d= exports.i =_zod.z.object({migration_version:_zod.z.string().optional()}),l= exports.j =_zod.z.object({name:_zod.z.string(),entrypoint_path:_zod.z.string(),import_map_path:_zod.z.string().optional(),files:_zod.z.array(_zod.z.object({name:_zod.z.string(),content:_zod.z.string()}))}),y= exports.k =_zod.z.object({query:_zod.z.string(),read_only:_zod.z.boolean().optional()}),u= exports.l =_zod.z.object({name:_zod.z.string(),query:_zod.z.string()}),h= exports.m =_zod.z.object({version:_zod.z.string(),name:_zod.z.string().optional()}),f= exports.n =_zod.z.object({sql:_zod.z.string(),iso_timestamp_start:_zod.z.string().optional(),iso_timestamp_end:_zod.z.string().optional()}),j= exports.o =_zod.z.object({types:_zod.z.string()});exports.a = r; exports.b = i; exports.c = s; exports.d = a; exports.e = p; exports.f = c; exports.g = g; exports.h = m; exports.i = d; exports.j = l; exports.k = y; exports.l = u; exports.m = h; exports.n = f; exports.o = j;
2
- //# sourceMappingURL=chunk-LL3OYJR7.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYABXOKUTcjs = require('./chunk-YABXOKUT.cjs');var _zod = require('zod');var r=_zod.z.object({id:_zod.z.string(),name:_zod.z.string(),owner:_zod.z.string(),created_at:_zod.z.string(),updated_at:_zod.z.string(),public:_zod.z.boolean()}),i= exports.b =_zod.z.object({fileSizeLimit:_zod.z.number(),features:_zod.z.object({imageTransformation:_zod.z.object({enabled:_zod.z.boolean()}),s3Protocol:_zod.z.object({enabled:_zod.z.boolean()})})}),s= exports.c =_zod.z.object({id:_zod.z.string(),name:_zod.z.string(),plan:_zod.z.string().optional(),allowed_release_channels:_zod.z.array(_zod.z.string()),opt_in_tags:_zod.z.array(_zod.z.string())}),a= exports.d =_zod.z.object({id:_zod.z.string(),organization_id:_zod.z.string(),name:_zod.z.string(),status:_zod.z.string(),created_at:_zod.z.string(),region:_zod.z.string()}),p= exports.e =_zod.z.object({id:_zod.z.string(),name:_zod.z.string(),project_ref:_zod.z.string(),parent_project_ref:_zod.z.string(),is_default:_zod.z.boolean(),git_branch:_zod.z.string().optional(),pr_number:_zod.z.number().optional(),latest_check_run_id:_zod.z.number().optional(),persistent:_zod.z.boolean(),status:_zod.z.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:_zod.z.string(),updated_at:_zod.z.string()}),c= exports.f =_zod.z.object({id:_zod.z.string(),slug:_zod.z.string(),name:_zod.z.string(),status:_zod.z.string(),version:_zod.z.number(),created_at:_zod.z.number().optional(),updated_at:_zod.z.number().optional(),verify_jwt:_zod.z.boolean().optional(),import_map:_zod.z.boolean().optional(),import_map_path:_zod.z.string().optional(),entrypoint_path:_zod.z.string().optional(),files:_zod.z.array(_zod.z.object({name:_zod.z.string(),content:_zod.z.string()}))}),g= exports.g =_zod.z.object({name:_zod.z.string(),organization_id:_zod.z.string(),region:_zod.z.enum(_chunkYABXOKUTcjs.c),db_pass:_zod.z.string().optional()}),m= exports.h =_zod.z.object({name:_zod.z.string()}),d= exports.i =_zod.z.object({migration_version:_zod.z.string().optional()}),l= exports.j =_zod.z.object({name:_zod.z.string(),entrypoint_path:_zod.z.string(),import_map_path:_zod.z.string().optional(),files:_zod.z.array(_zod.z.object({name:_zod.z.string(),content:_zod.z.string()}))}),y= exports.k =_zod.z.object({query:_zod.z.string(),read_only:_zod.z.boolean().optional()}),u= exports.l =_zod.z.object({name:_zod.z.string(),query:_zod.z.string()}),h= exports.m =_zod.z.object({version:_zod.z.string(),name:_zod.z.string().optional()}),f= exports.n =_zod.z.object({sql:_zod.z.string(),iso_timestamp_start:_zod.z.string().optional(),iso_timestamp_end:_zod.z.string().optional()}),j= exports.o =_zod.z.object({types:_zod.z.string()});exports.a = r; exports.b = i; exports.c = s; exports.d = a; exports.e = p; exports.f = c; exports.g = g; exports.h = m; exports.i = d; exports.j = l; exports.k = y; exports.l = u; exports.m = h; exports.n = f; exports.o = j;
2
+ //# sourceMappingURL=chunk-L6VODEGU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/chunk-L6VODEGU.cjs","../src/platform/types.ts"],"names":["storageBucketSchema","z","storageConfigSchema","organizationSchema","projectSchema","branchSchema","edgeFunctionSchema","createProjectOptionsSchema","AWS_REGION_CODES","createBranchOptionsSchema","resetBranchOptionsSchema","deployEdgeFunctionOptionsSchema","executeSqlOptionsSchema","applyMigrationOptionsSchema","migrationSchema","getLogsOptionsSchema","generateTypescriptTypesResultSchema"],"mappings":"AAAA,iIAAwC,0BCCtB,IAGLA,CAAAA,CAAsBC,MAAAA,CAAE,MAAA,CAAO,CAC1C,EAAA,CAAIA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACb,IAAA,CAAMA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACf,KAAA,CAAOA,MAAAA,CAAE,MAAA,CAAO,CAAA,CAChB,UAAA,CAAYA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACrB,UAAA,CAAYA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACrB,MAAA,CAAQA,MAAAA,CAAE,OAAA,CAAQ,CACpB,CAAC,CAAA,CAEYC,CAAAA,aAAsBD,MAAAA,CAAE,MAAA,CAAO,CAC1C,aAAA,CAAeA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACxB,QAAA,CAAUA,MAAAA,CAAE,MAAA,CAAO,CACjB,mBAAA,CAAqBA,MAAAA,CAAE,MAAA,CAAO,CAAE,OAAA,CAASA,MAAAA,CAAE,OAAA,CAAQ,CAAE,CAAC,CAAA,CACtD,UAAA,CAAYA,MAAAA,CAAE,MAAA,CAAO,CAAE,OAAA,CAASA,MAAAA,CAAE,OAAA,CAAQ,CAAE,CAAC,CAC/C,CAAC,CACH,CAAC,CAAA,CAEYE,CAAAA,aAAqBF,MAAAA,CAAE,MAAA,CAAO,CACzC,EAAA,CAAIA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACb,IAAA,CAAMA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACf,IAAA,CAAMA,M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A,aAAkBb,MAAAA,CAAE,MAAA,CAAO,CACtC,OAAA,CAASA,MAAAA,CAAE,MAAA,CAAO,CAAA,CAClB,IAAA,CAAMA,MAAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAC5B,CAAC,CAAA,CAEYc,CAAAA,aAAuBd,MAAAA,CAAE,MAAA,CAAO,CAC3C,GAAA,CAAKA,MAAAA,CAAE,MAAA,CAAO,CAAA,CACd,mBAAA,CAAqBA,MAAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CACzC,iBAAA,CAAmBA,MAAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CACzC,CAAC,CAAA,CAEYe,CAAAA,aAAsCf,MAAAA,CAAE,MAAA,CAAO,CAC1D,KAAA,CAAOA,MAAAA,CAAE,MAAA,CAAO,CAClB,CAAC,CAAA,CAAA,gOAAA","file":"/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/chunk-L6VODEGU.cjs","sourcesContent":[null,"import type { InitData } from '@supabase/mcp-utils';\nimport { z } from 'zod';\nimport { AWS_REGION_CODES } from '../regions.js';\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(),\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 organization_id: 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 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(),\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(),\n});\n\nexport const resetBranchOptionsSchema = z.object({\n migration_version: z.string().optional(),\n});\n\nexport const deployEdgeFunctionOptionsSchema = z.object({\n name: z.string(),\n entrypoint_path: z.string(),\n import_map_path: z.string().optional(),\n files: z.array(\n z.object({\n name: z.string(),\n content: z.string(),\n })\n ),\n});\n\nexport const executeSqlOptionsSchema = z.object({\n query: z.string(),\n read_only: z.boolean().optional(),\n});\n\nexport const applyMigrationOptionsSchema = z.object({\n name: z.string(),\n query: z.string(),\n});\n\nexport const migrationSchema = z.object({\n version: z.string(),\n name: z.string().optional(),\n});\n\nexport const getLogsOptionsSchema = z.object({\n sql: z.string(),\n iso_timestamp_start: z.string().optional(),\n iso_timestamp_end: z.string().optional(),\n});\n\nexport const generateTypescriptTypesResultSchema = z.object({\n types: z.string(),\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>;\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 GetLogsOptions = z.infer<typeof getLogsOptionsSchema>;\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 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<Pick<Organization, 'id' | 'name'>[]>;\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<EdgeFunction>;\n deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ): Promise<Omit<EdgeFunction, 'files'>>;\n};\n\nexport type DebuggingOperations = {\n getLogs(projectId: string, options: GetLogsOptions): Promise<unknown>;\n getSecurityAdvisors(projectId: string): Promise<unknown>;\n getPerformanceAdvisors(projectId: string): Promise<unknown>;\n};\n\nexport type DevelopmentOperations = {\n getProjectUrl(projectId: string): Promise<string>;\n getAnonKey(projectId: string): Promise<string>;\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\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};\n"]}
@@ -0,0 +1,2 @@
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(); } } 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 _chunkL6VODEGUcjs = require('./chunk-L6VODEGU.cjs');var _chunkYABXOKUTcjs = require('./chunk-YABXOKUT.cjs');var _multipartparser = require('@mjackson/multipart-parser');var _posix = require('path/posix');var _url = require('url');var _openapifetch = require('openapi-fetch'); var _openapifetch2 = _interopRequireDefault(_openapifetch);var _zod = require('zod');function v(i,g,l={}){return _openapifetch2.default.call(void 0, {baseUrl:i,headers:{Authorization:`Bearer ${g}`,...l}})}var $=_zod.z.object({message:_zod.z.string()});function r(i,g){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:l}=$.safeParse(i.error);throw l?new Error(l.message):new Error(g)}}var H="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N="abcdefghijklmnopqrstuvwxyz",I="0123456789",K="!@#$%^&*()_+~`|}{[]:;?><,./-=",U=({length:i=10,numbers:g=!1,symbols:l=!1,uppercase:y=!0,lowercase:a=!0}={})=>{let d="";if(y&&(d+=H),a&&(d+=N),g&&(d+=I),l&&(d+=K),d.length===0)throw new Error("at least one character set must be selected");let w=new Uint32Array(i);crypto.getRandomValues(w);let O="";for(let h=0;h<i;h++){let b=w[h]%d.length;O+=d.charAt(b)}return O};var{version:W}=_chunkYABXOKUTcjs.a;function le(i){let{accessToken:g,apiUrl:l}=i,y=_nullishCoalesce(l, () => ("https://api.supabase.com")),a=v(y,g),d={async listOrganizations(){let t=await a.GET("/v1/organizations");return r(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await a.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return r(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await a.GET("/v1/projects");return r(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await a.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return r(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:s,region:n,db_pass:o}=_chunkL6VODEGUcjs.g.parse(t),p=await a.POST("/v1/projects",{body:{name:e,region:n,organization_id:s,db_pass:_nullishCoalesce(o, () => (U({length:16,numbers:!0,uppercase:!0,lowercase:!0})))}});return r(p,"Failed to create project"),p.data},async pauseProject(t){let e=await a.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});r(e,"Failed to pause project")},async restoreProject(t){let e=await a.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});r(e,"Failed to restore project")}},w={async executeSql(t,e){let{query:s,read_only:n}=_chunkL6VODEGUcjs.k.parse(e),o=await a.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:s,read_only:n}});return r(o,"Failed to execute SQL query"),o.data},async listMigrations(t){let e=await a.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return r(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:s,query:n}=_chunkL6VODEGUcjs.l.parse(e),o=await a.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:s,query:n}});r(o,"Failed to apply migration")}},O={async getLogs(t,e){let{sql:s,iso_timestamp_start:n,iso_timestamp_end:o}=_chunkL6VODEGUcjs.n.parse(e),p=await a.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:s,iso_timestamp_start:n,iso_timestamp_end:o}}});return r(p,"Failed to fetch logs"),p.data},async getSecurityAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return r(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return r(e,"Failed to fetch performance advisors"),e.data}},h={async getProjectUrl(t){let e=new URL(y);return`https://${t}.${Q(e.hostname)}`},async getAnonKey(t){let e=await a.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});r(e,"Failed to fetch API keys");let s=_optionalChain([e, 'access', _2 => _2.data, 'optionalAccess', _3 => _3.find, 'call', _4 => _4(n=>n.name==="anon")]);if(!_optionalChain([s, 'optionalAccess', _5 => _5.api_key]))throw new Error("Anonymous key not found");return s.api_key},async generateTypescriptTypes(t){let e=await a.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return r(e,"Failed to fetch TypeScript types"),e.data}},b={async listEdgeFunctions(t){let e=await a.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return r(e,"Failed to fetch Edge Functions"),await Promise.all(e.data.map(async s=>await b.getEdgeFunction(t,s.slug)))},async getEdgeFunction(t,e){let s=await a.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(s.error)throw s.error;r(s,"Failed to fetch Edge Function");let n=s.data,o=_chunkYABXOKUTcjs.d.call(void 0, t,n.id,n.version),p=_chunkYABXOKUTcjs.e.call(void 0, o),E=n.entrypoint_path?_posix.relative.call(void 0, p,_url.fileURLToPath.call(void 0, n.entrypoint_path,{windows:!1})):void 0,F=n.import_map_path?_posix.relative.call(void 0, p,_url.fileURLToPath.call(void 0, n.import_map_path,{windows:!1})):void 0,m=await a.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});r(m,"Failed to fetch Edge Function files");let c=m.response.headers.get("content-type");if(!c||!c.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${c}. Expected multipart/form-data.`);let f=_multipartparser.getMultipartBoundary.call(void 0, c);if(!f)throw new Error("No multipart boundary found in response headers");if(!m.data)throw new Error("No data received from Edge Function body");let S=[],T=_multipartparser.parseMultipartStream.call(void 0, m.data,{boundary:f});for await(let u of T)u.isFile&&u.filename&&S.push({name:_posix.relative.call(void 0, p,u.filename),content:u.text});return{...n,entrypoint_path:E,import_map_path:F,files:S}},async deployEdgeFunction(t,e){let{name:s,entrypoint_path:n,import_map_path:o,files:p}=_chunkL6VODEGUcjs.j.parse(e),E;try{E=await b.getEdgeFunction(t,s)}catch (e2){}let F=p.find(c=>["deno.json","import_map.json"].includes(c.name));o??=_nullishCoalesce(_optionalChain([E, 'optionalAccess', _6 => _6.import_map_path]), () => (_optionalChain([F, 'optionalAccess', _7 => _7.name])));let m=await a.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:s}},body:{metadata:{name:s,entrypoint_path:n,import_map_path:o},file:p},bodySerializer(c){let f=new FormData,S=new Blob([JSON.stringify(c.metadata)],{type:"application/json"});return f.append("metadata",S),_optionalChain([c, 'access', _8 => _8.file, 'optionalAccess', _9 => _9.forEach, 'call', _10 => _10(T=>{let u=T,z=new Blob([u.content],{type:"application/typescript"});f.append("file",z,u.name)})]),f}});return r(m,"Failed to deploy Edge Function"),m.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");a=v(y,g,{"User-Agent":`supabase-mcp/${W} (${e.name}/${e.version})`})},account:d,database:w,debugging:O,development:h,functions:b,branching:{async listBranches(t){let e=await a.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(r(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:s}=_chunkL6VODEGUcjs.h.parse(e),n=await a.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:s}});return r(n,"Failed to create branch"),n.data},async deleteBranch(t){let e=await a.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});r(e,"Failed to delete branch")},async mergeBranch(t){let e=await a.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:s}=_chunkL6VODEGUcjs.i.parse(e),n=await a.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:s}});r(n,"Failed to reset branch")},async rebaseBranch(t){let e=await a.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await a.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return r(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await a.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return r(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let s=await a.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}}}});return r(s,"Failed to update storage config"),s.data}}}}function Q(i){switch(i){case"api.supabase.com":return"supabase.co";case"api.supabase.green":return"supabase.green";default:return"supabase.red"}}exports.a = le;
2
+ //# sourceMappingURL=chunk-MMFJ65OS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/chunk-MMFJ65OS.cjs","../src/platform/api-platform.ts","../src/management-api/index.ts"],"names":["createManagementApiClient","baseUrl","accessToken","headers","createClient"],"mappings":"AAAA,y0BAAkF,wDAAuD,6DCGlI,mCAEkB,0BACK,yGCFvB,0BAMW,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":"/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/chunk-MMFJ65OS.cjs","sourcesContent":[null,"import {\n getMultipartBoundary,\n parseMultipartStream,\n} from '@mjackson/multipart-parser';\nimport type { InitData } from '@supabase/mcp-utils';\nimport { relative } from 'node:path/posix';\nimport { fileURLToPath } from 'node:url';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { getDeploymentId, getPathPrefix } from '../edge-function.js';\nimport {\n assertSuccess,\n createManagementApiClient,\n} from '../management-api/index.js';\nimport { generatePassword } from '../password.js';\nimport {\n applyMigrationOptionsSchema,\n createBranchOptionsSchema,\n createProjectOptionsSchema,\n deployEdgeFunctionOptionsSchema,\n executeSqlOptionsSchema,\n getLogsOptionsSchema,\n resetBranchOptionsSchema,\n type AccountOperations,\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 EdgeFunction,\n type EdgeFunctionsOperations,\n type ExecuteSqlOptions,\n type GetLogsOptions,\n type ResetBranchOptions,\n type StorageConfig,\n type StorageOperations,\n type SupabasePlatform,\n} from './index.js';\n\nconst { version } = packageJson;\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 managementApiClient = createManagementApiClient(\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_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, read_only } = 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 read_only,\n },\n }\n );\n\n assertSuccess(response, 'Failed to execute SQL query');\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 assertSuccess(response, 'Failed to fetch migrations');\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 assertSuccess(response, 'Failed to apply migration');\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 async getLogs(projectId: string, options: GetLogsOptions) {\n const { sql, iso_timestamp_start, iso_timestamp_end } =\n getLogsOptionsSchema.parse(options);\n\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/analytics/endpoints/logs.all',\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 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 };\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 getAnonKey(projectId: string): Promise<string> {\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 const anonKey = response.data?.find((key) => key.name === 'anon');\n\n if (!anonKey?.api_key) {\n throw new Error('Anonymous key not found');\n }\n\n return anonKey.api_key;\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 // Fetch files for each Edge Function\n return await Promise.all(\n response.data.map(async (listedFunction) => {\n return await functions.getEdgeFunction(\n projectId,\n listedFunction.slug\n );\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 pathPrefix = getPathPrefix(deploymentId);\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? relative(\n pathPrefix,\n fileURLToPath(edgeFunction.entrypoint_path, { windows: false })\n )\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? relative(\n pathPrefix,\n fileURLToPath(edgeFunction.import_map_path, { windows: false })\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: EdgeFunction['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: relative(pathPrefix, part.filename),\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 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 const import_map_file = inputFiles.find((file) =>\n ['deno.json', 'import_map.json'].includes(file.name)\n );\n\n // Use existing import map path or file name heuristic if not provided\n import_map_path ??=\n existingEdgeFunction?.import_map_path ?? import_map_file?.name;\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 },\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}',\n {\n params: {\n path: {\n branch_id: 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}/merge',\n {\n params: {\n path: {\n branch_id: 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}/reset',\n {\n params: {\n path: {\n branch_id: 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}/push',\n {\n params: {\n path: {\n branch_id: 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 return response.data;\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 client with the user agent\n managementApiClient = createManagementApiClient(\n managementApiUrl,\n accessToken,\n {\n 'User-Agent': `supabase-mcp/${version} (${clientInfo.name}/${clientInfo.version})`,\n }\n );\n },\n account,\n database,\n debugging,\n development,\n functions,\n branching,\n storage,\n };\n\n return platform;\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';\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\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 throw new Error(errorContent.message);\n }\n\n throw new Error(fallbackMessage);\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{c as e}from"./chunk-3ZRWMUMF.js";import{z as t}from"zod";var r=t.object({id:t.string(),name:t.string(),owner:t.string(),created_at:t.string(),updated_at:t.string(),public:t.boolean()}),i=t.object({fileSizeLimit:t.number(),features:t.object({imageTransformation:t.object({enabled:t.boolean()}),s3Protocol:t.object({enabled:t.boolean()})})}),s=t.object({id:t.string(),name:t.string(),plan:t.string().optional(),allowed_release_channels:t.array(t.string()),opt_in_tags:t.array(t.string())}),a=t.object({id:t.string(),organization_id:t.string(),name:t.string(),status:t.string(),created_at:t.string(),region:t.string()}),p=t.object({id:t.string(),name:t.string(),project_ref:t.string(),parent_project_ref:t.string(),is_default:t.boolean(),git_branch:t.string().optional(),pr_number:t.number().optional(),latest_check_run_id:t.number().optional(),persistent:t.boolean(),status:t.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:t.string(),updated_at:t.string()}),c=t.object({id:t.string(),slug:t.string(),name:t.string(),status:t.string(),version:t.number(),created_at:t.number().optional(),updated_at:t.number().optional(),verify_jwt:t.boolean().optional(),import_map:t.boolean().optional(),import_map_path:t.string().optional(),entrypoint_path:t.string().optional(),files:t.array(t.object({name:t.string(),content:t.string()}))}),g=t.object({name:t.string(),organization_id:t.string(),region:t.enum(e).optional(),db_pass:t.string().optional()}),m=t.object({name:t.string()}),d=t.object({migration_version:t.string().optional()}),l=t.object({name:t.string(),entrypoint_path:t.string(),import_map_path:t.string().optional(),files:t.array(t.object({name:t.string(),content:t.string()}))}),y=t.object({query:t.string(),read_only:t.boolean().optional()}),u=t.object({name:t.string(),query:t.string()}),h=t.object({version:t.string(),name:t.string().optional()}),f=t.object({sql:t.string(),iso_timestamp_start:t.string().optional(),iso_timestamp_end:t.string().optional()}),j=t.object({types:t.string()});export{r as a,i as b,s as c,a as d,p as e,c as f,g,m as h,d as i,l as j,y as k,u as l,h as m,f as n,j as o};
2
- //# sourceMappingURL=chunk-YFZN5EJN.js.map
1
+ import{c as e}from"./chunk-TFXIAEEH.js";import{z as t}from"zod";var r=t.object({id:t.string(),name:t.string(),owner:t.string(),created_at:t.string(),updated_at:t.string(),public:t.boolean()}),i=t.object({fileSizeLimit:t.number(),features:t.object({imageTransformation:t.object({enabled:t.boolean()}),s3Protocol:t.object({enabled:t.boolean()})})}),s=t.object({id:t.string(),name:t.string(),plan:t.string().optional(),allowed_release_channels:t.array(t.string()),opt_in_tags:t.array(t.string())}),a=t.object({id:t.string(),organization_id:t.string(),name:t.string(),status:t.string(),created_at:t.string(),region:t.string()}),p=t.object({id:t.string(),name:t.string(),project_ref:t.string(),parent_project_ref:t.string(),is_default:t.boolean(),git_branch:t.string().optional(),pr_number:t.number().optional(),latest_check_run_id:t.number().optional(),persistent:t.boolean(),status:t.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:t.string(),updated_at:t.string()}),c=t.object({id:t.string(),slug:t.string(),name:t.string(),status:t.string(),version:t.number(),created_at:t.number().optional(),updated_at:t.number().optional(),verify_jwt:t.boolean().optional(),import_map:t.boolean().optional(),import_map_path:t.string().optional(),entrypoint_path:t.string().optional(),files:t.array(t.object({name:t.string(),content:t.string()}))}),g=t.object({name:t.string(),organization_id:t.string(),region:t.enum(e),db_pass:t.string().optional()}),m=t.object({name:t.string()}),d=t.object({migration_version:t.string().optional()}),l=t.object({name:t.string(),entrypoint_path:t.string(),import_map_path:t.string().optional(),files:t.array(t.object({name:t.string(),content:t.string()}))}),y=t.object({query:t.string(),read_only:t.boolean().optional()}),u=t.object({name:t.string(),query:t.string()}),h=t.object({version:t.string(),name:t.string().optional()}),f=t.object({sql:t.string(),iso_timestamp_start:t.string().optional(),iso_timestamp_end:t.string().optional()}),j=t.object({types:t.string()});export{r as a,i as b,s as c,a as d,p as e,c as f,g,m as h,d as i,l as j,y as k,u as l,h as m,f as n,j as o};
2
+ //# sourceMappingURL=chunk-PX45KCZA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/platform/types.ts"],"sourcesContent":["import type { InitData } from '@supabase/mcp-utils';\nimport { z } from 'zod';\nimport { AWS_REGION_CODES } from '../regions.js';\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(),\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 organization_id: 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 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(),\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(),\n});\n\nexport const resetBranchOptionsSchema = z.object({\n migration_version: z.string().optional(),\n});\n\nexport const deployEdgeFunctionOptionsSchema = z.object({\n name: z.string(),\n entrypoint_path: z.string(),\n import_map_path: z.string().optional(),\n files: z.array(\n z.object({\n name: z.string(),\n content: z.string(),\n })\n ),\n});\n\nexport const executeSqlOptionsSchema = z.object({\n query: z.string(),\n read_only: z.boolean().optional(),\n});\n\nexport const applyMigrationOptionsSchema = z.object({\n name: z.string(),\n query: z.string(),\n});\n\nexport const migrationSchema = z.object({\n version: z.string(),\n name: z.string().optional(),\n});\n\nexport const getLogsOptionsSchema = z.object({\n sql: z.string(),\n iso_timestamp_start: z.string().optional(),\n iso_timestamp_end: z.string().optional(),\n});\n\nexport const generateTypescriptTypesResultSchema = z.object({\n types: z.string(),\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>;\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 GetLogsOptions = z.infer<typeof getLogsOptionsSchema>;\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 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<Pick<Organization, 'id' | 'name'>[]>;\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<EdgeFunction>;\n deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ): Promise<Omit<EdgeFunction, 'files'>>;\n};\n\nexport type DebuggingOperations = {\n getLogs(projectId: string, options: GetLogsOptions): Promise<unknown>;\n getSecurityAdvisors(projectId: string): Promise<unknown>;\n getPerformanceAdvisors(projectId: string): Promise<unknown>;\n};\n\nexport type DevelopmentOperations = {\n getProjectUrl(projectId: string): Promise<string>;\n getAnonKey(projectId: string): Promise<string>;\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\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};\n"],"mappings":"wCACA,OAAS,KAAAA,MAAS,MAGX,IAAMC,EAAsBC,EAAE,OAAO,CAC1C,GAAIA,EAAE,OAAO,EACb,KAAMA,EAAE,OAAO,EACf,MAAOA,EAAE,OAAO,EAChB,WAAYA,EAAE,OAAO,EACrB,WAAYA,EAAE,OAAO,EACrB,OAAQA,EAAE,QAAQ,CACpB,CAAC,EAEYC,EAAsBD,EAAE,OAAO,CAC1C,cAAeA,EAAE,OAAO,EACxB,SAAUA,EAAE,OAAO,CACjB,oBAAqBA,EAAE,OAAO,CAAE,QAASA,EAAE,QAAQ,CAAE,CAAC,EACtD,WAAYA,EAAE,OAAO,CAAE,QAASA,EAAE,QAAQ,CAAE,CAAC,CAC/C,CAAC,CACH,CAAC,EAEYE,EAAqBF,EAAE,OAAO,CACzC,GAAIA,EAAE,OAAO,EACb,KAAMA,EAAE,OAAO,EACf,KAAMA,EAAE,OAAO,EAAE,SAAS,EAC1B,yBAA0BA,EAAE,MAAMA,EAAE,OAAO,CAAC,EAC5C,YAAaA,EAAE,MAAMA,EAAE,OAAO,CAAC,CACjC,CAAC,EAEYG,EAAgBH,EAAE,OAAO,CACpC,GAAIA,EAAE,OAAO,EACb,gBAAiBA,EAAE,OAAO,EAC1B,KAAMA,EAAE,OAAO,EACf,OAAQA,EAAE,OAAO,EACjB,WAAYA,EAAE,OAAO,EACrB,OAAQA,EAAE,OAAO,CACnB,CAAC,EAEYI,EAAeJ,EAAE,OAAO,CACnC,GAAIA,EAAE,OAAO,EACb,KAAMA,EAAE,OAAO,EACf,YAAaA,EAAE,OAAO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EAAE,OAAO,EAAE,SAAS,EACrC,MAAOA,EAAE,MACPA,EAAE,OAAO,CACP,KAAMA,EAAE,OAAO,EACf,QAASA,EAAE,OAAO,CACpB,CAAC,CACH,CACF,CAAC,EAEYW,EAA0BX,EAAE,OAAO,CAC9C,MAAOA,EAAE,OAAO,EAChB,UAAWA,EAAE,QAAQ,EAAE,SAAS,CAClC,CAAC,EAEYY,EAA8BZ,EAAE,OAAO,CAClD,KAAMA,EAAE,OAAO,EACf,MAAOA,EAAE,OAAO,CAClB,CAAC,EAEYa,EAAkBb,EAAE,OAAO,CACtC,QAASA,EAAE,OAAO,EAClB,KAAMA,EAAE,OAAO,EAAE,SAAS,CAC5B,CAAC,EAEYc,EAAuBd,EAAE,OAAO,CAC3C,IAAKA,EAAE,OAAO,EACd,oBAAqBA,EAAE,OAAO,EAAE,SAAS,EACzC,kBAAmBA,EAAE,OAAO,EAAE,SAAS,CACzC,CAAC,EAEYe,EAAsCf,EAAE,OAAO,CAC1D,MAAOA,EAAE,OAAO,CAClB,CAAC","names":["z","storageBucketSchema","z","storageConfigSchema","organizationSchema","projectSchema","branchSchema","edgeFunctionSchema","createProjectOptionsSchema","AWS_REGION_CODES","createBranchOptionsSchema","resetBranchOptionsSchema","deployEdgeFunctionOptionsSchema","executeSqlOptionsSchema","applyMigrationOptionsSchema","migrationSchema","getLogsOptionsSchema","generateTypescriptTypesResultSchema"]}