@supabase/mcp-server-supabase 0.5.2 → 0.5.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CY4GX7KZ.js → chunk-3J2AEDI5.js} +5 -5
- package/dist/chunk-3J2AEDI5.js.map +1 -0
- package/dist/chunk-BGSQAZQP.js +2 -0
- package/dist/chunk-BGSQAZQP.js.map +1 -0
- package/dist/{chunk-QJ2BFGOR.cjs → chunk-HRZSO3WO.cjs} +5 -5
- package/dist/chunk-HRZSO3WO.cjs.map +1 -0
- package/dist/chunk-NO7CTD4L.cjs +2 -0
- package/dist/chunk-NO7CTD4L.cjs.map +1 -0
- package/dist/chunk-QZQOI6WA.cjs +2 -0
- package/dist/chunk-QZQOI6WA.cjs.map +1 -0
- package/dist/chunk-SVCJN2UU.js +2 -0
- package/dist/chunk-SVCJN2UU.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/platform/api-platform.cjs +1 -1
- package/dist/platform/api-platform.cjs.map +1 -1
- package/dist/platform/api-platform.js +1 -1
- package/dist/platform/index.cjs +1 -1
- package/dist/platform/index.cjs.map +1 -1
- package/dist/platform/index.d.cts +41 -2
- package/dist/platform/index.d.ts +41 -2
- package/dist/platform/index.js +1 -1
- package/dist/transports/stdio.cjs +1 -1
- package/dist/transports/stdio.cjs.map +1 -1
- package/dist/transports/stdio.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CXRJDOVS.js +0 -2
- package/dist/chunk-CXRJDOVS.js.map +0 -1
- package/dist/chunk-CY4GX7KZ.js.map +0 -1
- package/dist/chunk-O4HE2BKY.js +0 -2
- package/dist/chunk-O4HE2BKY.js.map +0 -1
- package/dist/chunk-QJ2BFGOR.cjs.map +0 -1
- package/dist/chunk-TO5M2T7V.cjs +0 -2
- package/dist/chunk-TO5M2T7V.cjs.map +0 -1
- package/dist/chunk-V7ARYUGJ.cjs +0 -2
- package/dist/chunk-V7ARYUGJ.cjs.map +0 -1
|
@@ -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 _chunkNO7CTD4Lcjs = require('./chunk-NO7CTD4L.cjs');var _chunkHRZSO3WOcjs = require('./chunk-HRZSO3WO.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 A(p,m,l={}){return _openapifetch2.default.call(void 0, {baseUrl:p,headers:{Authorization:`Bearer ${m}`,...l}})}var $=_zod.z.object({message:_zod.z.string()});function s(p,m){if("error"in p){if(p.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(p.error);throw l?new Error(l.message):new Error(m)}}var H="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N="abcdefghijklmnopqrstuvwxyz",I="0123456789",W="!@#$%^&*()_+~`|}{[]:;?><,./-=",q=({length:p=10,numbers:m=!1,symbols:l=!1,uppercase:y=!0,lowercase:r=!0}={})=>{let d="";if(y&&(d+=H),r&&(d+=N),m&&(d+=I),l&&(d+=W),d.length===0)throw new Error("at least one character set must be selected");let O=new Uint32Array(p);crypto.getRandomValues(O);let E="";for(let b=0;b<p;b++){let S=O[b]%d.length;E+=d.charAt(S)}return E};var{version:V}=_chunkHRZSO3WOcjs.a;function le(p){let{accessToken:m,apiUrl:l}=p,y=_nullishCoalesce(l, () => ("https://api.supabase.com")),r=A(y,m),d={async listOrganizations(){let t=await r.GET("/v1/organizations");return s(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await r.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return s(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await r.GET("/v1/projects");return s(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await r.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return s(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:a,region:n,db_pass:o}=_chunkNO7CTD4Lcjs.h.parse(t),i=await r.POST("/v1/projects",{body:{name:e,region:n,organization_id:a,db_pass:_nullishCoalesce(o, () => (q({length:16,numbers:!0,uppercase:!0,lowercase:!0})))}});return s(i,"Failed to create project"),i.data},async pauseProject(t){let e=await r.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});s(e,"Failed to pause project")},async restoreProject(t){let e=await r.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});s(e,"Failed to restore project")}},O={async executeSql(t,e){let{query:a,read_only:n}=_chunkNO7CTD4Lcjs.l.parse(e),o=await r.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:a,read_only:n}});return s(o,"Failed to execute SQL query"),o.data},async listMigrations(t){let e=await r.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return s(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:a,query:n}=_chunkNO7CTD4Lcjs.m.parse(e),o=await r.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:a,query:n}});s(o,"Failed to apply migration")}},E={async getLogs(t,e){let{sql:a,iso_timestamp_start:n,iso_timestamp_end:o}=_chunkNO7CTD4Lcjs.o.parse(e),i=await r.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:a,iso_timestamp_start:n,iso_timestamp_end:o}}});return s(i,"Failed to fetch logs"),i.data},async getSecurityAdvisors(t){let e=await r.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return s(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await r.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return s(e,"Failed to fetch performance advisors"),e.data}},b={async getProjectUrl(t){let e=new URL(y);return`https://${t}.${Q(e.hostname)}`},async getAnonKey(t){let e=await r.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});s(e,"Failed to fetch API keys");let a=_optionalChain([e, 'access', _2 => _2.data, 'optionalAccess', _3 => _3.find, 'call', _4 => _4(n=>n.name==="anon")]);if(!_optionalChain([a, 'optionalAccess', _5 => _5.api_key]))throw new Error("Anonymous key not found");return a.api_key},async generateTypescriptTypes(t){let e=await r.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return s(e,"Failed to fetch TypeScript types"),e.data}},S={async listEdgeFunctions(t){let e=await r.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return s(e,"Failed to fetch Edge Functions"),e.data.map(a=>{let n=_chunkHRZSO3WOcjs.e.call(void 0, t,a.id,a.version),o=_chunkHRZSO3WOcjs.f.call(void 0, n),i=a.entrypoint_path?_posix.relative.call(void 0, o,_url.fileURLToPath.call(void 0, a.entrypoint_path,{windows:!1})):void 0,u=a.import_map_path?_posix.relative.call(void 0, o,_url.fileURLToPath.call(void 0, a.import_map_path,{windows:!1})):void 0;return{...a,entrypoint_path:i,import_map_path:u}})},async getEdgeFunction(t,e){let a=await r.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(a.error)throw a.error;s(a,"Failed to fetch Edge Function");let n=a.data,o=_chunkHRZSO3WOcjs.e.call(void 0, t,n.id,n.version),i=_chunkHRZSO3WOcjs.f.call(void 0, o),u=n.entrypoint_path?_posix.relative.call(void 0, i,_url.fileURLToPath.call(void 0, n.entrypoint_path,{windows:!1})):void 0,T=n.import_map_path?_posix.relative.call(void 0, i,_url.fileURLToPath.call(void 0, n.import_map_path,{windows:!1})):void 0,f=await r.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});s(f,"Failed to fetch Edge Function files");let c=f.response.headers.get("content-type");if(!c||!c.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${c}. Expected multipart/form-data.`);let h=_multipartparser.getMultipartBoundary.call(void 0, c);if(!h)throw new Error("No multipart boundary found in response headers");if(!f.data)throw new Error("No data received from Edge Function body");let _=[],P=_multipartparser.parseMultipartStream.call(void 0, f.data,{boundary:h});for await(let g of P)g.isFile&&g.filename&&_.push({name:_posix.relative.call(void 0, i,g.filename),content:g.text});return{...n,entrypoint_path:u,import_map_path:T,files:_}},async deployEdgeFunction(t,e){let{name:a,entrypoint_path:n,import_map_path:o,files:i}=_chunkNO7CTD4Lcjs.k.parse(e),u;try{u=await S.getEdgeFunction(t,a)}catch (e2){}let T=i.find(c=>["deno.json","import_map.json"].includes(c.name));o??=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _6 => _6.import_map_path]), () => (_optionalChain([T, 'optionalAccess', _7 => _7.name])));let f=await r.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:a}},body:{metadata:{name:a,entrypoint_path:n,import_map_path:o},file:i},bodySerializer(c){let h=new FormData,_=new Blob([JSON.stringify(c.metadata)],{type:"application/json"});return h.append("metadata",_),_optionalChain([c, 'access', _8 => _8.file, 'optionalAccess', _9 => _9.forEach, 'call', _10 => _10(P=>{let g=P,z=new Blob([g.content],{type:"application/typescript"});h.append("file",z,g.name)})]),h}});return s(f,"Failed to deploy Edge Function"),f.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");r=A(y,m,{"User-Agent":`supabase-mcp/${V} (${e.name}/${e.version})`})},account:d,database:O,debugging:E,development:b,functions:S,branching:{async listBranches(t){let e=await r.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(s(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:a}=_chunkNO7CTD4Lcjs.i.parse(e),n=await r.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:a}});return s(n,"Failed to create branch"),n.data},async deleteBranch(t){let e=await r.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});s(e,"Failed to delete branch")},async mergeBranch(t){let e=await r.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});s(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:a}=_chunkNO7CTD4Lcjs.j.parse(e),n=await r.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:a}});s(n,"Failed to reset branch")},async rebaseBranch(t){let e=await r.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});s(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await r.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return s(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await r.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return s(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let a=await r.PATCH("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}},body:{fileSizeLimit:e.fileSizeLimit,features:{imageTransformation:{enabled:e.features.imageTransformation.enabled},s3Protocol:{enabled:e.features.s3Protocol.enabled}}}});return s(a,"Failed to update storage config"),a.data}}}}function Q(p){switch(p){case"api.supabase.com":return"supabase.co";case"api.supabase.green":return"supabase.green";default:return"supabase.red"}}exports.a = le;
|
|
2
|
+
//# sourceMappingURL=chunk-QZQOI6WA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/chunk-QZQOI6WA.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/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/chunk-QZQOI6WA.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 EdgeFunctionWithBody,\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 return response.data.map((edgeFunction) => {\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 return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n };\n });\n },\n async getEdgeFunction(projectId: string, functionSlug: string) {\n const functionResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n }\n );\n\n if (functionResponse.error) {\n throw functionResponse.error;\n }\n\n assertSuccess(functionResponse, 'Failed to fetch Edge Function');\n\n const edgeFunction = functionResponse.data;\n\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const 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: EdgeFunctionWithBody['files'] = [];\n const parts = parseMultipartStream(bodyResponse.data, { boundary });\n\n for await (const part of parts) {\n if (part.isFile && part.filename) {\n files.push({\n name: 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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as C,i as x,j as B,k as M,l as G,m as D,o as k}from"./chunk-BGSQAZQP.js";import{a as R,e as F,f as j}from"./chunk-3J2AEDI5.js";import{getMultipartBoundary as K,parseMultipartStream as J}from"@mjackson/multipart-parser";import{relative as w}from"path/posix";import{fileURLToPath as v}from"url";import L from"openapi-fetch";import{z as U}from"zod";function A(p,m,l={}){return L({baseUrl:p,headers:{Authorization:`Bearer ${m}`,...l}})}var $=U.object({message:U.string()});function s(p,m){if("error"in p){if(p.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(p.error);throw l?new Error(l.message):new Error(m)}}var H="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N="abcdefghijklmnopqrstuvwxyz",I="0123456789",W="!@#$%^&*()_+~`|}{[]:;?><,./-=",q=({length:p=10,numbers:m=!1,symbols:l=!1,uppercase:y=!0,lowercase:r=!0}={})=>{let d="";if(y&&(d+=H),r&&(d+=N),m&&(d+=I),l&&(d+=W),d.length===0)throw new Error("at least one character set must be selected");let O=new Uint32Array(p);crypto.getRandomValues(O);let E="";for(let b=0;b<p;b++){let S=O[b]%d.length;E+=d.charAt(S)}return E};var{version:V}=R;function le(p){let{accessToken:m,apiUrl:l}=p,y=l??"https://api.supabase.com",r=A(y,m),d={async listOrganizations(){let t=await r.GET("/v1/organizations");return s(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await r.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return s(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await r.GET("/v1/projects");return s(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await r.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return s(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:a,region:n,db_pass:o}=C.parse(t),i=await r.POST("/v1/projects",{body:{name:e,region:n,organization_id:a,db_pass:o??q({length:16,numbers:!0,uppercase:!0,lowercase:!0})}});return s(i,"Failed to create project"),i.data},async pauseProject(t){let e=await r.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});s(e,"Failed to pause project")},async restoreProject(t){let e=await r.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});s(e,"Failed to restore project")}},O={async executeSql(t,e){let{query:a,read_only:n}=G.parse(e),o=await r.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:a,read_only:n}});return s(o,"Failed to execute SQL query"),o.data},async listMigrations(t){let e=await r.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return s(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:a,query:n}=D.parse(e),o=await r.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:a,query:n}});s(o,"Failed to apply migration")}},E={async getLogs(t,e){let{sql:a,iso_timestamp_start:n,iso_timestamp_end:o}=k.parse(e),i=await r.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:a,iso_timestamp_start:n,iso_timestamp_end:o}}});return s(i,"Failed to fetch logs"),i.data},async getSecurityAdvisors(t){let e=await r.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return s(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await r.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return s(e,"Failed to fetch performance advisors"),e.data}},b={async getProjectUrl(t){let e=new URL(y);return`https://${t}.${Q(e.hostname)}`},async getAnonKey(t){let e=await r.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});s(e,"Failed to fetch API keys");let a=e.data?.find(n=>n.name==="anon");if(!a?.api_key)throw new Error("Anonymous key not found");return a.api_key},async generateTypescriptTypes(t){let e=await r.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return s(e,"Failed to fetch TypeScript types"),e.data}},S={async listEdgeFunctions(t){let e=await r.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return s(e,"Failed to fetch Edge Functions"),e.data.map(a=>{let n=F(t,a.id,a.version),o=j(n),i=a.entrypoint_path?w(o,v(a.entrypoint_path,{windows:!1})):void 0,u=a.import_map_path?w(o,v(a.import_map_path,{windows:!1})):void 0;return{...a,entrypoint_path:i,import_map_path:u}})},async getEdgeFunction(t,e){let a=await r.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(a.error)throw a.error;s(a,"Failed to fetch Edge Function");let n=a.data,o=F(t,n.id,n.version),i=j(o),u=n.entrypoint_path?w(i,v(n.entrypoint_path,{windows:!1})):void 0,T=n.import_map_path?w(i,v(n.import_map_path,{windows:!1})):void 0,f=await r.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});s(f,"Failed to fetch Edge Function files");let c=f.response.headers.get("content-type");if(!c||!c.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${c}. Expected multipart/form-data.`);let h=K(c);if(!h)throw new Error("No multipart boundary found in response headers");if(!f.data)throw new Error("No data received from Edge Function body");let _=[],P=J(f.data,{boundary:h});for await(let g of P)g.isFile&&g.filename&&_.push({name:w(i,g.filename),content:g.text});return{...n,entrypoint_path:u,import_map_path:T,files:_}},async deployEdgeFunction(t,e){let{name:a,entrypoint_path:n,import_map_path:o,files:i}=M.parse(e),u;try{u=await S.getEdgeFunction(t,a)}catch{}let T=i.find(c=>["deno.json","import_map.json"].includes(c.name));o??=u?.import_map_path??T?.name;let f=await r.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:a}},body:{metadata:{name:a,entrypoint_path:n,import_map_path:o},file:i},bodySerializer(c){let h=new FormData,_=new Blob([JSON.stringify(c.metadata)],{type:"application/json"});return h.append("metadata",_),c.file?.forEach(P=>{let g=P,z=new Blob([g.content],{type:"application/typescript"});h.append("file",z,g.name)}),h}});return s(f,"Failed to deploy Edge Function"),f.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");r=A(y,m,{"User-Agent":`supabase-mcp/${V} (${e.name}/${e.version})`})},account:d,database:O,debugging:E,development:b,functions:S,branching:{async listBranches(t){let e=await r.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(s(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:a}=x.parse(e),n=await r.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:a}});return s(n,"Failed to create branch"),n.data},async deleteBranch(t){let e=await r.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});s(e,"Failed to delete branch")},async mergeBranch(t){let e=await r.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});s(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:a}=B.parse(e),n=await r.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:a}});s(n,"Failed to reset branch")},async rebaseBranch(t){let e=await r.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});s(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await r.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return s(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await r.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return s(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let a=await r.PATCH("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}},body:{fileSizeLimit:e.fileSizeLimit,features:{imageTransformation:{enabled:e.features.imageTransformation.enabled},s3Protocol:{enabled:e.features.s3Protocol.enabled}}}});return s(a,"Failed to update storage config"),a.data}}}}function Q(p){switch(p){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-SVCJN2UU.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 EdgeFunctionWithBody,\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 return response.data.map((edgeFunction) => {\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 return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n };\n });\n },\n async getEdgeFunction(projectId: string, functionSlug: string) {\n const functionResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n }\n );\n\n if (functionResponse.error) {\n throw functionResponse.error;\n }\n\n assertSuccess(functionResponse, 'Failed to fetch Edge Function');\n\n const edgeFunction = functionResponse.data;\n\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const 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: EdgeFunctionWithBody['files'] = [];\n const parts = parseMultipartStream(bodyResponse.data, { boundary });\n\n for await (const part of parts) {\n if (part.isFile && part.filename) {\n files.push({\n name: 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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EAAU,gCAAgC,EAEjDA,EAAS,IAClB,EAEA,MAAM,iBAAiB4D,EAAoB,CACzC,IAAM5D,EAAW,MAAMH,EAAoB,IACzC,oCACA,CACE,OAAQ,CACN,KAAM,CACJ,IAAK+D,CACP,CACF,CACF,CACF,EAEA,OAAA3D,EAAcD,EAAU,8BAA8B,EAE/CA,EAAS,IAClB,EAEA,MAAM,oBAAoBG,EAAmB0D,EAAuB,CAClE,IAAM7D,EAAW,MAAMH,EAAoB,MACzC,oCACA,CACE,OAAQ,CACN,KAAM,CACJ,IAAKM,CACP,CACF,EACA,KAAM,CACJ,cAAe0D,EAAO,cACtB,SAAU,CACR,oBAAqB,CACnB,QAASA,EAAO,SAAS,oBAAoB,OAC/C,EACA,WAAY,CACV,QAASA,EAAO,SAAS,WAAW,OACtC,CACF,CACF,CACF,CACF,EAEA,OAAA5D,EAAcD,EAAU,iCAAiC,EAElDA,EAAS,IAClB,CACF,CAyBA,CAGF,CAEA,SAASqB,EAAiByC,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","edgeFunction","deploymentId","getDeploymentId","pathPrefix","getPathPrefix","entrypoint_path","relative","fileURLToPath","import_map_path","functionSlug","functionResponse","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"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHRZSO3WOcjs = require('./chunk-HRZSO3WO.cjs');var a=_chunkHRZSO3WOcjs.a.version;exports.createSupabaseMcpServer = _chunkHRZSO3WOcjs.g; exports.currentFeatureGroupSchema = _chunkHRZSO3WOcjs.b; exports.featureGroupSchema = _chunkHRZSO3WOcjs.c; exports.version = a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/index.cjs","../src/index.ts"],"names":["version","package_default"],"mappings":"AAAA,iIAA6D,ICYhDA,CAAAA,CAAUC,mBAAAA,CAAY,OAAA,CAAA,sLAAA","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/index.cjs","sourcesContent":[null,"import packageJson from '../package.json' with { type: 'json' };\n\nexport type { SupabasePlatform } from './platform/index.js';\nexport {\n createSupabaseMcpServer,\n type SupabaseMcpServerOptions,\n} from './server.js';\nexport {\n featureGroupSchema,\n currentFeatureGroupSchema,\n type FeatureGroup,\n} from './types.js';\nexport const version = packageJson.version;\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,b as r,c as o,g as p}from"./chunk-
|
|
1
|
+
import{a as e,b as r,c as o,g as p}from"./chunk-3J2AEDI5.js";var a=e.version;export{p as createSupabaseMcpServer,r as currentFeatureGroupSchema,o as featureGroupSchema,a as version};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQZQOI6WAcjs = require('../chunk-QZQOI6WA.cjs');require('../chunk-NO7CTD4L.cjs');require('../chunk-HRZSO3WO.cjs');exports.createSupabaseApiPlatform = _chunkQZQOI6WAcjs.a;
|
|
2
2
|
//# sourceMappingURL=api-platform.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/api-platform.cjs"],"names":[],"mappings":"AAAA,kIAAoC,iCAA8B,iCAA8B,wDAAuC","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/api-platform.cjs"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-SVCJN2UU.js";import"../chunk-BGSQAZQP.js";import"../chunk-3J2AEDI5.js";export{a as createSupabaseApiPlatform};
|
|
2
2
|
//# sourceMappingURL=api-platform.js.map
|
package/dist/platform/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNO7CTD4Lcjs = require('../chunk-NO7CTD4L.cjs');require('../chunk-HRZSO3WO.cjs');exports.applyMigrationOptionsSchema = _chunkNO7CTD4Lcjs.m; exports.branchSchema = _chunkNO7CTD4Lcjs.e; exports.createBranchOptionsSchema = _chunkNO7CTD4Lcjs.i; exports.createProjectOptionsSchema = _chunkNO7CTD4Lcjs.h; exports.deployEdgeFunctionOptionsSchema = _chunkNO7CTD4Lcjs.k; exports.edgeFunctionSchema = _chunkNO7CTD4Lcjs.f; exports.edgeFunctionWithBodySchema = _chunkNO7CTD4Lcjs.g; exports.executeSqlOptionsSchema = _chunkNO7CTD4Lcjs.l; exports.generateTypescriptTypesResultSchema = _chunkNO7CTD4Lcjs.p; exports.getLogsOptionsSchema = _chunkNO7CTD4Lcjs.o; exports.migrationSchema = _chunkNO7CTD4Lcjs.n; exports.organizationSchema = _chunkNO7CTD4Lcjs.c; exports.projectSchema = _chunkNO7CTD4Lcjs.d; exports.resetBranchOptionsSchema = _chunkNO7CTD4Lcjs.j; exports.storageBucketSchema = _chunkNO7CTD4Lcjs.a; exports.storageConfigSchema = _chunkNO7CTD4Lcjs.b;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/index.cjs"],"names":[],"mappings":"AAAA,kIAAkE,iCAA8B,81BAAuc","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/index.cjs"}
|
|
@@ -169,6 +169,44 @@ declare const edgeFunctionSchema: z.ZodObject<{
|
|
|
169
169
|
import_map: z.ZodOptional<z.ZodBoolean>;
|
|
170
170
|
import_map_path: z.ZodOptional<z.ZodString>;
|
|
171
171
|
entrypoint_path: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
status: string;
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
version: number;
|
|
177
|
+
slug: string;
|
|
178
|
+
created_at?: number | undefined;
|
|
179
|
+
updated_at?: number | undefined;
|
|
180
|
+
verify_jwt?: boolean | undefined;
|
|
181
|
+
import_map?: boolean | undefined;
|
|
182
|
+
import_map_path?: string | undefined;
|
|
183
|
+
entrypoint_path?: string | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
status: string;
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
version: number;
|
|
189
|
+
slug: string;
|
|
190
|
+
created_at?: number | undefined;
|
|
191
|
+
updated_at?: number | undefined;
|
|
192
|
+
verify_jwt?: boolean | undefined;
|
|
193
|
+
import_map?: boolean | undefined;
|
|
194
|
+
import_map_path?: string | undefined;
|
|
195
|
+
entrypoint_path?: string | undefined;
|
|
196
|
+
}>;
|
|
197
|
+
declare const edgeFunctionWithBodySchema: z.ZodObject<{
|
|
198
|
+
id: z.ZodString;
|
|
199
|
+
slug: z.ZodString;
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
status: z.ZodString;
|
|
202
|
+
version: z.ZodNumber;
|
|
203
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
verify_jwt: z.ZodOptional<z.ZodBoolean>;
|
|
206
|
+
import_map: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
+
import_map_path: z.ZodOptional<z.ZodString>;
|
|
208
|
+
entrypoint_path: z.ZodOptional<z.ZodString>;
|
|
209
|
+
} & {
|
|
172
210
|
files: z.ZodArray<z.ZodObject<{
|
|
173
211
|
name: z.ZodString;
|
|
174
212
|
content: z.ZodString;
|
|
@@ -327,6 +365,7 @@ type Organization = z.infer<typeof organizationSchema>;
|
|
|
327
365
|
type Project = z.infer<typeof projectSchema>;
|
|
328
366
|
type Branch = z.infer<typeof branchSchema>;
|
|
329
367
|
type EdgeFunction = z.infer<typeof edgeFunctionSchema>;
|
|
368
|
+
type EdgeFunctionWithBody = z.infer<typeof edgeFunctionWithBodySchema>;
|
|
330
369
|
type CreateProjectOptions = z.infer<typeof createProjectOptionsSchema>;
|
|
331
370
|
type CreateBranchOptions = z.infer<typeof createBranchOptionsSchema>;
|
|
332
371
|
type ResetBranchOptions = z.infer<typeof resetBranchOptionsSchema>;
|
|
@@ -355,7 +394,7 @@ type AccountOperations = {
|
|
|
355
394
|
};
|
|
356
395
|
type EdgeFunctionsOperations = {
|
|
357
396
|
listEdgeFunctions(projectId: string): Promise<EdgeFunction[]>;
|
|
358
|
-
getEdgeFunction(projectId: string, functionSlug: string): Promise<
|
|
397
|
+
getEdgeFunction(projectId: string, functionSlug: string): Promise<EdgeFunctionWithBody>;
|
|
359
398
|
deployEdgeFunction(projectId: string, options: DeployEdgeFunctionOptions): Promise<Omit<EdgeFunction, 'files'>>;
|
|
360
399
|
};
|
|
361
400
|
type DebuggingOperations = {
|
|
@@ -392,4 +431,4 @@ type SupabasePlatform = {
|
|
|
392
431
|
branching?: BranchingOperations;
|
|
393
432
|
};
|
|
394
433
|
|
|
395
|
-
export { type AccountOperations, type ApplyMigrationOptions, type Branch, type BranchingOperations, type CreateBranchOptions, type CreateProjectOptions, type DatabaseOperations, type DebuggingOperations, type DeployEdgeFunctionOptions, type DevelopmentOperations, type EdgeFunction, type EdgeFunctionsOperations, type ExecuteSqlOptions, type GenerateTypescriptTypesResult, type GetLogsOptions, type ListMigrationsResult, type Migration, type Organization, type Project, type ResetBranchOptions, type StorageBucket, type StorageConfig, type StorageOperations, type SupabasePlatform, applyMigrationOptionsSchema, branchSchema, createBranchOptionsSchema, createProjectOptionsSchema, deployEdgeFunctionOptionsSchema, edgeFunctionSchema, executeSqlOptionsSchema, generateTypescriptTypesResultSchema, getLogsOptionsSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
|
|
434
|
+
export { type AccountOperations, type ApplyMigrationOptions, type Branch, type BranchingOperations, type CreateBranchOptions, type CreateProjectOptions, type DatabaseOperations, type DebuggingOperations, type DeployEdgeFunctionOptions, type DevelopmentOperations, type EdgeFunction, type EdgeFunctionWithBody, type EdgeFunctionsOperations, type ExecuteSqlOptions, type GenerateTypescriptTypesResult, type GetLogsOptions, type ListMigrationsResult, type Migration, type Organization, type Project, type ResetBranchOptions, type StorageBucket, type StorageConfig, type StorageOperations, type SupabasePlatform, applyMigrationOptionsSchema, branchSchema, createBranchOptionsSchema, createProjectOptionsSchema, deployEdgeFunctionOptionsSchema, edgeFunctionSchema, edgeFunctionWithBodySchema, executeSqlOptionsSchema, generateTypescriptTypesResultSchema, getLogsOptionsSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -169,6 +169,44 @@ declare const edgeFunctionSchema: z.ZodObject<{
|
|
|
169
169
|
import_map: z.ZodOptional<z.ZodBoolean>;
|
|
170
170
|
import_map_path: z.ZodOptional<z.ZodString>;
|
|
171
171
|
entrypoint_path: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
status: string;
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
version: number;
|
|
177
|
+
slug: string;
|
|
178
|
+
created_at?: number | undefined;
|
|
179
|
+
updated_at?: number | undefined;
|
|
180
|
+
verify_jwt?: boolean | undefined;
|
|
181
|
+
import_map?: boolean | undefined;
|
|
182
|
+
import_map_path?: string | undefined;
|
|
183
|
+
entrypoint_path?: string | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
status: string;
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
version: number;
|
|
189
|
+
slug: string;
|
|
190
|
+
created_at?: number | undefined;
|
|
191
|
+
updated_at?: number | undefined;
|
|
192
|
+
verify_jwt?: boolean | undefined;
|
|
193
|
+
import_map?: boolean | undefined;
|
|
194
|
+
import_map_path?: string | undefined;
|
|
195
|
+
entrypoint_path?: string | undefined;
|
|
196
|
+
}>;
|
|
197
|
+
declare const edgeFunctionWithBodySchema: z.ZodObject<{
|
|
198
|
+
id: z.ZodString;
|
|
199
|
+
slug: z.ZodString;
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
status: z.ZodString;
|
|
202
|
+
version: z.ZodNumber;
|
|
203
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
verify_jwt: z.ZodOptional<z.ZodBoolean>;
|
|
206
|
+
import_map: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
+
import_map_path: z.ZodOptional<z.ZodString>;
|
|
208
|
+
entrypoint_path: z.ZodOptional<z.ZodString>;
|
|
209
|
+
} & {
|
|
172
210
|
files: z.ZodArray<z.ZodObject<{
|
|
173
211
|
name: z.ZodString;
|
|
174
212
|
content: z.ZodString;
|
|
@@ -327,6 +365,7 @@ type Organization = z.infer<typeof organizationSchema>;
|
|
|
327
365
|
type Project = z.infer<typeof projectSchema>;
|
|
328
366
|
type Branch = z.infer<typeof branchSchema>;
|
|
329
367
|
type EdgeFunction = z.infer<typeof edgeFunctionSchema>;
|
|
368
|
+
type EdgeFunctionWithBody = z.infer<typeof edgeFunctionWithBodySchema>;
|
|
330
369
|
type CreateProjectOptions = z.infer<typeof createProjectOptionsSchema>;
|
|
331
370
|
type CreateBranchOptions = z.infer<typeof createBranchOptionsSchema>;
|
|
332
371
|
type ResetBranchOptions = z.infer<typeof resetBranchOptionsSchema>;
|
|
@@ -355,7 +394,7 @@ type AccountOperations = {
|
|
|
355
394
|
};
|
|
356
395
|
type EdgeFunctionsOperations = {
|
|
357
396
|
listEdgeFunctions(projectId: string): Promise<EdgeFunction[]>;
|
|
358
|
-
getEdgeFunction(projectId: string, functionSlug: string): Promise<
|
|
397
|
+
getEdgeFunction(projectId: string, functionSlug: string): Promise<EdgeFunctionWithBody>;
|
|
359
398
|
deployEdgeFunction(projectId: string, options: DeployEdgeFunctionOptions): Promise<Omit<EdgeFunction, 'files'>>;
|
|
360
399
|
};
|
|
361
400
|
type DebuggingOperations = {
|
|
@@ -392,4 +431,4 @@ type SupabasePlatform = {
|
|
|
392
431
|
branching?: BranchingOperations;
|
|
393
432
|
};
|
|
394
433
|
|
|
395
|
-
export { type AccountOperations, type ApplyMigrationOptions, type Branch, type BranchingOperations, type CreateBranchOptions, type CreateProjectOptions, type DatabaseOperations, type DebuggingOperations, type DeployEdgeFunctionOptions, type DevelopmentOperations, type EdgeFunction, type EdgeFunctionsOperations, type ExecuteSqlOptions, type GenerateTypescriptTypesResult, type GetLogsOptions, type ListMigrationsResult, type Migration, type Organization, type Project, type ResetBranchOptions, type StorageBucket, type StorageConfig, type StorageOperations, type SupabasePlatform, applyMigrationOptionsSchema, branchSchema, createBranchOptionsSchema, createProjectOptionsSchema, deployEdgeFunctionOptionsSchema, edgeFunctionSchema, executeSqlOptionsSchema, generateTypescriptTypesResultSchema, getLogsOptionsSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
|
|
434
|
+
export { type AccountOperations, type ApplyMigrationOptions, type Branch, type BranchingOperations, type CreateBranchOptions, type CreateProjectOptions, type DatabaseOperations, type DebuggingOperations, type DeployEdgeFunctionOptions, type DevelopmentOperations, type EdgeFunction, type EdgeFunctionWithBody, type EdgeFunctionsOperations, type ExecuteSqlOptions, type GenerateTypescriptTypesResult, type GetLogsOptions, type ListMigrationsResult, type Migration, type Organization, type Project, type ResetBranchOptions, type StorageBucket, type StorageConfig, type StorageOperations, type SupabasePlatform, applyMigrationOptionsSchema, branchSchema, createBranchOptionsSchema, createProjectOptionsSchema, deployEdgeFunctionOptionsSchema, edgeFunctionSchema, edgeFunctionWithBodySchema, executeSqlOptionsSchema, generateTypescriptTypesResultSchema, getLogsOptionsSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
|
package/dist/platform/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"../chunk-BGSQAZQP.js";import"../chunk-3J2AEDI5.js";export{m as applyMigrationOptionsSchema,e as branchSchema,i as createBranchOptionsSchema,h as createProjectOptionsSchema,k as deployEdgeFunctionOptionsSchema,f as edgeFunctionSchema,g as edgeFunctionWithBodySchema,l as executeSqlOptionsSchema,p as generateTypescriptTypesResultSchema,o as getLogsOptionsSchema,n as migrationSchema,c as organizationSchema,d as projectSchema,j as resetBranchOptionsSchema,a as storageBucketSchema,b as storageConfigSchema};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var
|
|
2
|
+
"use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkQZQOI6WAcjs = require('../chunk-QZQOI6WA.cjs');require('../chunk-NO7CTD4L.cjs');var _chunkHRZSO3WOcjs = require('../chunk-HRZSO3WO.cjs');var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');var _util = require('util');function p(r,o=","){return r.split(o).map(e=>e.trim()).filter(e=>e!=="")}var{version:d}=_chunkHRZSO3WOcjs.a;async function g(){let{values:{["access-token"]:r,["project-ref"]:o,["read-only"]:t,["api-url"]:e,["version"]:l,["features"]:s}}=_util.parseArgs.call(void 0, {options:{"access-token":{type:"string"},"project-ref":{type:"string"},"read-only":{type:"boolean",default:!1},"api-url":{type:"string"},version:{type:"boolean"},features:{type:"string"}}});l&&(console.log(d),process.exit(0));let n=_nullishCoalesce(r, () => (process.env.SUPABASE_ACCESS_TOKEN));n||(console.error("Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable"),process.exit(1));let f=s?p(s):void 0,m=_chunkQZQOI6WAcjs.a.call(void 0, {accessToken:n,apiUrl:e}),u=_chunkHRZSO3WOcjs.g.call(void 0, {platform:m,projectId:o,readOnly:t,features:f}),S=new _stdiojs.StdioServerTransport;await u.connect(S)}g().catch(console.error);
|
|
3
3
|
//# sourceMappingURL=stdio.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/transports/stdio.cjs","../../src/transports/stdio.ts","../../src/transports/util.ts"],"names":["parseList","list","delimiter","feature","version","package_default","main","cliAccessToken","projectId","readOnly","apiUrl","showVersion","cliFeatures","parseArgs","accessToken","features","platform","createSupabaseApiPlatform","server","createSupabaseMcpServer","transport","StdioServerTransport"],"mappings":"AAAA;AACA,0KAAyC,iCAA8B,yDAA4C,oECC9E,4BACX,SCGVA,CAAAA,CAAUC,CAAAA,CAAcC,CAAAA,CAAY,GAAA,CAAe,CAEjE,OADcD,CAAAA,CAAK,KAAA,CAAMC,CAAS,CAAA,CAAE,GAAA,CAAKC,CAAAA,EAAYA,CAAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CACtD,MAAA,CAAQA,CAAAA,EAAYA,CAAAA,GAAY,EAAE,CACjD,CDAA,GAAM,CAAE,OAAA,CAAAC,CAAQ,CAAA,CAAIC,mBAAAA,CAEpB,MAAA,SAAeC,CAAAA,CAAAA,CAAO,CACpB,GAAM,CACJ,MAAA,CAAQ,CACN,CAAC,cAAc,CAAA,CAAGC,CAAAA,CAClB,CAAC,aAAa,CAAA,CAAGC,CAAAA,CACjB,CAAC,WAAW,CAAA,CAAGC,CAAAA,CACf,CAAC,SAAS,CAAA,CAAGC,CAAAA,CACb,CAAC,SAAS,CAAA,CAAGC,CAAAA,CACb,CAAC,UAAU,CAAA,CAAGC,CAChB,CACF,CAAA,CAAIC,6BAAAA,CACF,OAAA,CAAS,CACN,cAAA,CAAiB,CAChB,IAAA,CAAM,QACR,CAAA,CACC,aAAA,CAAgB,CACf,IAAA,CAAM,QACR,CAAA,CACC,WAAA,CAAc,CACb,IAAA,CAAM,SAAA,CACN,OAAA,CAAS,CAAA,CACX,CAAA,CACC,SAAA,CAAY,CACX,IAAA,CAAM,QACR,CAAA,CACC,OAAA,CAAY,CACX,IAAA,CAAM,SACR,CAAA,CACC,QAAA,CAAa,CACZ,IAAA,CAAM,QACR,CACF,CACF,CAAC,CAAA,CAEGF,CAAAA,EAAAA,CACF,OAAA,CAAQ,GAAA,CAAIP,CAAO,CAAA,CACnB,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAGhB,IAAMU,CAAAA,kBAAcP,CAAAA,SAAkB,OAAA,CAAQ,GAAA,CAAI,uBAAA,CAE7CO,CAAAA,EAAAA,CACH,OAAA,CAAQ,KAAA,CACN,iIACF,CAAA,CACA,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,CAAA,CAGhB,IAAMC,CAAAA,CAAWH,CAAAA,CAAcZ,CAAAA,CAAUY,CAAW,CAAA,CAAI,KAAA,CAAA,CAElDI,CAAAA,CAAWC,iCAAAA,CACf,WAAA,CAAAH,CAAAA,CACA,MAAA,CAAAJ,CACF,CAAC,CAAA,CAEKQ,CAAAA,CAASC,iCAAAA,CACb,QAAA,CAAAH,CAAAA,CACA,SAAA,CAAAR,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,QAAA,CAAAM,CACF,CAAC,CAAA,CAEKK,CAAAA,CAAY,IAAIC,6BAAAA,CAEtB,MAAMH,CAAAA,CAAO,OAAA,CAAQE,CAAS,CAChC,CAEAd,CAAAA,CAAK,CAAA,CAAE,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/transports/stdio.cjs","sourcesContent":[null,"#!/usr/bin/env node\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { parseArgs } from 'node:util';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { createSupabaseApiPlatform } from '../platform/api-platform.js';\nimport { createSupabaseMcpServer } from '../server.js';\nimport { parseList } from './util.js';\n\nconst { version } = packageJson;\n\nasync function main() {\n const {\n values: {\n ['access-token']: cliAccessToken,\n ['project-ref']: projectId,\n ['read-only']: readOnly,\n ['api-url']: apiUrl,\n ['version']: showVersion,\n ['features']: cliFeatures,\n },\n } = parseArgs({\n options: {\n ['access-token']: {\n type: 'string',\n },\n ['project-ref']: {\n type: 'string',\n },\n ['read-only']: {\n type: 'boolean',\n default: false,\n },\n ['api-url']: {\n type: 'string',\n },\n ['version']: {\n type: 'boolean',\n },\n ['features']: {\n type: 'string',\n },\n },\n });\n\n if (showVersion) {\n console.log(version);\n process.exit(0);\n }\n\n const accessToken = cliAccessToken ?? process.env.SUPABASE_ACCESS_TOKEN;\n\n if (!accessToken) {\n console.error(\n 'Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable'\n );\n process.exit(1);\n }\n\n const features = cliFeatures ? parseList(cliFeatures) : undefined;\n\n const platform = createSupabaseApiPlatform({\n accessToken,\n apiUrl,\n });\n\n const server = createSupabaseMcpServer({\n platform,\n projectId,\n readOnly,\n features,\n });\n\n const transport = new StdioServerTransport();\n\n await server.connect(transport);\n}\n\nmain().catch(console.error);\n","/**\n * Parses a delimited list of items into an array,\n * trimming whitespace and filtering out empty items.\n *\n * Default delimiter is a comma (`,`).\n */\nexport function parseList(list: string, delimiter = ','): string[] {\n const items = list.split(delimiter).map((feature) => feature.trim());\n return items.filter((feature) => feature !== '');\n}\n"]}
|
package/dist/transports/stdio.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as c}from"../chunk-
|
|
2
|
+
import{a as c}from"../chunk-SVCJN2UU.js";import"../chunk-BGSQAZQP.js";import{a,g as i}from"../chunk-3J2AEDI5.js";import{StdioServerTransport as v}from"@modelcontextprotocol/sdk/server/stdio.js";import{parseArgs as y}from"util";function p(r,o=","){return r.split(o).map(e=>e.trim()).filter(e=>e!=="")}var{version:d}=a;async function g(){let{values:{["access-token"]:r,["project-ref"]:o,["read-only"]:t,["api-url"]:e,["version"]:l,["features"]:s}}=y({options:{"access-token":{type:"string"},"project-ref":{type:"string"},"read-only":{type:"boolean",default:!1},"api-url":{type:"string"},version:{type:"boolean"},features:{type:"string"}}});l&&(console.log(d),process.exit(0));let n=r??process.env.SUPABASE_ACCESS_TOKEN;n||(console.error("Please provide a personal access token (PAT) with the --access-token flag or set the SUPABASE_ACCESS_TOKEN environment variable"),process.exit(1));let f=s?p(s):void 0,m=c({accessToken:n,apiUrl:e}),u=i({platform:m,projectId:o,readOnly:t,features:f}),S=new v;await u.connect(S)}g().catch(console.error);
|
|
3
3
|
//# sourceMappingURL=stdio.js.map
|
package/package.json
CHANGED
package/dist/chunk-CXRJDOVS.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./chunk-CY4GX7KZ.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-CXRJDOVS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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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ACF,CAAC,EAEYM,EAA6BN,EAAE,OAAO,CACjD,KAAMA,EAAE,OAAO,EACf,gBAAiBA,EAAE,OAAO,EAC1B,OAAQA,EAAE,KAAKO,CAAgB,EAC/B,QAASP,EAAE,OAAO,EAAE,SAAS,CAC/B,CAAC,EAEYQ,EAA4BR,EAAE,OAAO,CAChD,KAAMA,EAAE,OAAO,CACjB,CAAC,EAEYS,EAA2BT,EAAE,OAAO,CAC/C,kBAAmBA,EAAE,OAAO,EAAE,SAAS,CACzC,CAAC,EAEYU,EAAkCV,EAAE,OAAO,CACtD,KAAMA,EAAE,OAAO,EACf,gBAAiBA,EAAE,OAAO,EAC1B,gBAAiBA,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"]}
|