@supabase/mcp-server-supabase 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/chunk-AAQ4TRSU.cjs +272 -0
  2. package/dist/chunk-AAQ4TRSU.cjs.map +1 -0
  3. package/dist/chunk-EYNWMSPQ.js +272 -0
  4. package/dist/chunk-EYNWMSPQ.js.map +1 -0
  5. package/dist/chunk-LU6L7C36.js +1 -0
  6. package/dist/chunk-LU6L7C36.js.map +1 -0
  7. package/dist/chunk-N4REUSSH.js +40 -0
  8. package/dist/chunk-N4REUSSH.js.map +1 -0
  9. package/dist/chunk-PHWSETKC.cjs +1 -0
  10. package/dist/chunk-PHWSETKC.cjs.map +1 -0
  11. package/dist/chunk-Z3P6IGCZ.cjs +40 -0
  12. package/dist/chunk-Z3P6IGCZ.cjs.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +7 -2
  16. package/dist/index.d.ts +7 -2
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/platform/api-platform.cjs +1 -1
  20. package/dist/platform/api-platform.cjs.map +1 -1
  21. package/dist/platform/api-platform.js +1 -1
  22. package/dist/platform/index.cjs +1 -1
  23. package/dist/platform/index.cjs.map +1 -1
  24. package/dist/platform/index.d.cts +6 -4
  25. package/dist/platform/index.d.ts +6 -4
  26. package/dist/platform/index.js +1 -1
  27. package/dist/transports/stdio.cjs +1 -1
  28. package/dist/transports/stdio.cjs.map +1 -1
  29. package/dist/transports/stdio.js +1 -1
  30. package/package.json +2 -2
  31. package/dist/chunk-4LRODYL5.js +0 -310
  32. package/dist/chunk-4LRODYL5.js.map +0 -1
  33. package/dist/chunk-GPUZG5AH.cjs +0 -310
  34. package/dist/chunk-GPUZG5AH.cjs.map +0 -1
  35. package/dist/chunk-KH3JZGVH.js +0 -2
  36. package/dist/chunk-KH3JZGVH.js.map +0 -1
  37. package/dist/chunk-OUTPUM46.cjs +0 -2
  38. package/dist/chunk-OUTPUM46.cjs.map +0 -1
  39. package/dist/chunk-XE2UPAEC.js +0 -2
  40. package/dist/chunk-XE2UPAEC.js.map +0 -1
  41. package/dist/chunk-ZM7J5K5M.cjs +0 -2
  42. package/dist/chunk-ZM7J5K5M.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,40 @@
1
+ import{a as R,k as C,l as B,m as x,n as M,o as q,p as G,s as k,u as F,v as _}from"./chunk-EYNWMSPQ.js";import{getMultipartBoundary as Q,parseMultipartStream as J}from"@mjackson/multipart-parser";import{fileURLToPath as j}from"url";import{stripIndent as f}from"common-tags";function L(p,i=100){switch(p){case"api":return f`
2
+ select id, identifier, timestamp, event_message, request.method, request.path, response.status_code
3
+ from edge_logs
4
+ cross join unnest(metadata) as m
5
+ cross join unnest(m.request) as request
6
+ cross join unnest(m.response) as response
7
+ order by timestamp desc
8
+ limit ${i}
9
+ `;case"branch-action":return f`
10
+ select workflow_run, workflow_run_logs.timestamp, id, event_message from workflow_run_logs
11
+ order by timestamp desc
12
+ limit ${i}
13
+ `;case"postgres":return f`
14
+ select identifier, postgres_logs.timestamp, id, event_message, parsed.error_severity from postgres_logs
15
+ cross join unnest(metadata) as m
16
+ cross join unnest(m.parsed) as parsed
17
+ order by timestamp desc
18
+ limit ${i}
19
+ `;case"edge-function":return f`
20
+ select id, function_edge_logs.timestamp, event_message, response.status_code, request.method, m.function_id, m.execution_time_ms, m.deployment_id, m.version from function_edge_logs
21
+ cross join unnest(metadata) as m
22
+ cross join unnest(m.response) as response
23
+ cross join unnest(m.request) as request
24
+ order by timestamp desc
25
+ limit ${i}
26
+ `;case"auth":return f`
27
+ select id, auth_logs.timestamp, event_message, metadata.level, metadata.status, metadata.path, metadata.msg as msg, metadata.error from auth_logs
28
+ cross join unnest(metadata) as metadata
29
+ order by timestamp desc
30
+ limit ${i}
31
+ `;case"storage":return f`
32
+ select id, storage_logs.timestamp, event_message from storage_logs
33
+ order by timestamp desc
34
+ limit ${i}
35
+ `;case"realtime":return f`
36
+ select id, realtime_logs.timestamp, event_message from realtime_logs
37
+ order by timestamp desc
38
+ limit ${i}
39
+ `;default:throw new Error(`unsupported log service type: ${p}`)}}import U from"openapi-fetch";import{z as D}from"zod";function P(p,i,d={}){return U({baseUrl:p,headers:{Authorization:`Bearer ${i}`,...d}})}var H=D.object({message:D.string()});function r(p,i){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:d}=H.safeParse(p.error);throw d?new Error(d.message):new Error(i)}}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N="abcdefghijklmnopqrstuvwxyz",W="0123456789",K="!@#$%^&*()_+~`|}{[]:;?><,./-=",$=({length:p=10,numbers:i=!1,symbols:d=!1,uppercase:w=!0,lowercase:a=!0}={})=>{let m="";if(w&&(m+=I),a&&(m+=N),i&&(m+=W),d&&(m+=K),m.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 v=0;v<p;v++){let S=O[v]%m.length;E+=m.charAt(S)}return E};var{version:V}=R;function fe(p){let{accessToken:i,apiUrl:d}=p,w=d??"https://api.supabase.com",a=P(w,i),m={async listOrganizations(){let t=await a.GET("/v1/organizations");return r(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await a.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return r(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await a.GET("/v1/projects");return r(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await a.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return r(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:s,region:n,db_pass:o}=C.parse(t),c=await a.POST("/v1/projects",{body:{name:e,region:n,organization_id:s,db_pass:o??$({length:16,numbers:!0,uppercase:!0,lowercase:!0})}});return r(c,"Failed to create project"),c.data},async pauseProject(t){let e=await a.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});r(e,"Failed to pause project")},async restoreProject(t){let e=await a.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});r(e,"Failed to restore project")}},O={async executeSql(t,e){let{query:s,read_only:n}=q.parse(e),o=await a.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:s,read_only:n}});return r(o,"Failed to execute SQL query"),o.data},async listMigrations(t){let e=await a.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return r(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:s,query:n}=G.parse(e),o=await a.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:s,query:n}});r(o,"Failed to apply migration")}},E={async getLogs(t,e){let{service:s,iso_timestamp_start:n,iso_timestamp_end:o}=k.parse(e),c=L(s),u=await a.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:c,iso_timestamp_start:n,iso_timestamp_end:o}}});return r(u,"Failed to fetch logs"),u.data},async getSecurityAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return r(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return r(e,"Failed to fetch performance advisors"),e.data}},v={async getProjectUrl(t){let e=new URL(w);return`https://${t}.${Y(e.hostname)}`},async getAnonKey(t){let e=await a.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});r(e,"Failed to fetch API keys");let s=e.data?.find(n=>n.name==="anon");if(!s?.api_key)throw new Error("Anonymous key not found");return s.api_key},async generateTypescriptTypes(t){let e=await a.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return r(e,"Failed to fetch TypeScript types"),e.data}},S={async listEdgeFunctions(t){let e=await a.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return r(e,"Failed to fetch Edge Functions"),e.data.map(s=>{let n=F(t,s.id,s.version),o=s.entrypoint_path?_({deploymentId:n,filename:j(s.entrypoint_path,{windows:!1})}):void 0,c=s.import_map_path?_({deploymentId:n,filename:j(s.import_map_path,{windows:!1})}):void 0;return{...s,entrypoint_path:o,import_map_path:c}})},async getEdgeFunction(t,e){let s=await a.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(s.error)throw s.error;r(s,"Failed to fetch Edge Function");let n=s.data,o=F(t,n.id,n.version),c=n.entrypoint_path?_({deploymentId:o,filename:j(n.entrypoint_path,{windows:!1})}):void 0,u=n.import_map_path?_({deploymentId:o,filename:j(n.import_map_path,{windows:!1})}):void 0,y=await a.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});r(y,"Failed to fetch Edge Function files");let g=y.response.headers.get("content-type");if(!g||!g.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${g}. Expected multipart/form-data.`);let l=Q(g);if(!l)throw new Error("No multipart boundary found in response headers");if(!y.data)throw new Error("No data received from Edge Function body");let h=[],T=J(y.data,{boundary:l});for await(let b of T)b.isFile&&b.filename&&h.push({name:_({deploymentId:o,filename:b.filename}),content:b.text});return{...n,entrypoint_path:c,import_map_path:u,files:h}},async deployEdgeFunction(t,e){let{name:s,entrypoint_path:n,import_map_path:o,files:c}=M.parse(e),u;try{u=await S.getEdgeFunction(t,s)}catch{}let y=c.find(l=>["deno.json","import_map.json"].includes(l.name));o??=u?.import_map_path??y?.name;let g=await a.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:s}},body:{metadata:{name:s,entrypoint_path:n,import_map_path:o},file:c},bodySerializer(l){let h=new FormData,T=new Blob([JSON.stringify(l.metadata)],{type:"application/json"});return h.append("metadata",T),l.file?.forEach(b=>{let A=b,z=new Blob([A.content],{type:"application/typescript"});h.append("file",z,A.name)}),h}});return r(g,"Failed to deploy Edge Function"),g.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");a=P(w,i,{"User-Agent":`supabase-mcp/${V} (${e.name}/${e.version})`})},account:m,database:O,debugging:E,development:v,functions:S,branching:{async listBranches(t){let e=await a.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(r(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:s}=B.parse(e),n=await a.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:s}});return r(n,"Failed to create branch"),n.data},async deleteBranch(t){let e=await a.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});r(e,"Failed to delete branch")},async mergeBranch(t){let e=await a.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:s}=x.parse(e),n=await a.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:s}});r(n,"Failed to reset branch")},async rebaseBranch(t){let e=await a.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await a.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return r(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await a.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return r(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let s=await a.PATCH("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}},body:{fileSizeLimit:e.fileSizeLimit,features:{imageTransformation:{enabled:e.features.imageTransformation.enabled},s3Protocol:{enabled:e.features.s3Protocol.enabled}}}});return r(s,"Failed to update storage config"),s.data}}}}function Y(p){switch(p){case"api.supabase.com":return"supabase.co";case"api.supabase.green":return"supabase.green";default:return"supabase.red"}}export{fe as a};
40
+ //# sourceMappingURL=chunk-N4REUSSH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/platform/api-platform.ts","../src/logs.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 { fileURLToPath } from 'node:url';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { getDeploymentId, normalizeFilename } from '../edge-function.js';\nimport { getLogQuery } from '../logs.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 { service, iso_timestamp_start, iso_timestamp_end } =\n getLogsOptionsSchema.parse(options);\n\n const sql = getLogQuery(service);\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 entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.entrypoint_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.import_map_path, {\n windows: false,\n }),\n })\n : undefined;\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n };\n });\n },\n async getEdgeFunction(projectId: string, functionSlug: string) {\n const functionResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n }\n );\n\n if (functionResponse.error) {\n throw functionResponse.error;\n }\n\n assertSuccess(functionResponse, 'Failed to fetch Edge Function');\n\n const edgeFunction = functionResponse.data;\n\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.entrypoint_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.import_map_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const bodyResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}/body',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n headers: {\n Accept: 'multipart/form-data',\n },\n parseAs: 'stream',\n }\n );\n\n assertSuccess(bodyResponse, 'Failed to fetch Edge Function files');\n\n const contentType = bodyResponse.response.headers.get('content-type');\n\n if (!contentType || !contentType.startsWith('multipart/form-data')) {\n throw new Error(\n `Unexpected content type: ${contentType}. Expected multipart/form-data.`\n );\n }\n\n const boundary = getMultipartBoundary(contentType);\n\n if (!boundary) {\n throw new Error('No multipart boundary found in response headers');\n }\n\n if (!bodyResponse.data) {\n throw new Error('No data received from Edge Function body');\n }\n\n const files: EdgeFunctionWithBody['files'] = [];\n const parts = parseMultipartStream(bodyResponse.data, { boundary });\n\n for await (const part of parts) {\n if (part.isFile && part.filename) {\n files.push({\n name: normalizeFilename({\n deploymentId,\n filename: part.filename,\n }),\n content: part.text,\n });\n }\n }\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n files,\n };\n },\n async deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ) {\n let {\n name,\n entrypoint_path,\n import_map_path,\n 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 { stripIndent } from 'common-tags';\nimport type { LogsService } from './platform/types.js';\n\nexport function getLogQuery(service: LogsService, limit: number = 100) {\n switch (service) {\n case 'api':\n return stripIndent`\n select id, identifier, timestamp, event_message, request.method, request.path, response.status_code\n from edge_logs\n cross join unnest(metadata) as m\n cross join unnest(m.request) as request\n cross join unnest(m.response) as response\n order by timestamp desc\n limit ${limit}\n `;\n case 'branch-action':\n return stripIndent`\n select workflow_run, workflow_run_logs.timestamp, id, event_message from workflow_run_logs\n order by timestamp desc\n limit ${limit}\n `;\n case 'postgres':\n return stripIndent`\n select identifier, postgres_logs.timestamp, id, event_message, parsed.error_severity from postgres_logs\n cross join unnest(metadata) as m\n cross join unnest(m.parsed) as parsed\n order by timestamp desc\n limit ${limit}\n `;\n case 'edge-function':\n return stripIndent`\n select id, function_edge_logs.timestamp, event_message, response.status_code, request.method, m.function_id, m.execution_time_ms, m.deployment_id, m.version from function_edge_logs\n cross join unnest(metadata) as m\n cross join unnest(m.response) as response\n cross join unnest(m.request) as request\n order by timestamp desc\n limit ${limit}\n `;\n case 'auth':\n return stripIndent`\n select id, auth_logs.timestamp, event_message, metadata.level, metadata.status, metadata.path, metadata.msg as msg, metadata.error from auth_logs\n cross join unnest(metadata) as metadata\n order by timestamp desc\n limit ${limit}\n `;\n case 'storage':\n return stripIndent`\n select id, storage_logs.timestamp, event_message from storage_logs\n order by timestamp desc\n limit ${limit}\n `;\n case 'realtime':\n return stripIndent`\n select id, realtime_logs.timestamp, event_message from realtime_logs\n order by timestamp desc\n limit ${limit}\n `;\n default:\n throw new Error(`unsupported log service type: ${service}`);\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":"uGAAA,OACE,wBAAAA,EACA,wBAAAC,MACK,6BAEP,OAAS,iBAAAC,MAAqB,MCL9B,OAAS,eAAAC,MAAmB,cAGrB,SAASC,EAAYC,EAAsBC,EAAgB,IAAK,CACrE,OAAQD,EAAS,CACf,IAAK,MACH,OAAOF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAOGG,CAAK;AAAA,QAEjB,IAAK,gBACH,OAAOH;AAAA;AAAA;AAAA,gBAGGG,CAAK;AAAA,QAEjB,IAAK,WACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKGG,CAAK;AAAA,QAEjB,IAAK,gBACH,OAAOH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAMGG,CAAK;AAAA,QAEjB,IAAK,OACH,OAAOH;AAAA;AAAA;AAAA;AAAA,gBAIGG,CAAK;AAAA,QAEjB,IAAK,UACH,OAAOH;AAAA;AAAA;AAAA,gBAGGG,CAAK;AAAA,QAEjB,IAAK,WACH,OAAOH;AAAA;AAAA;AAAA,gBAGGG,CAAK;AAAA,QAEjB,QACE,MAAM,IAAI,MAAM,iCAAiCD,CAAO,EAAE,CAC9D,CACF,CC5DA,OAAOE,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,SAA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AASuB,EAAiBuC,EAAqB,CAC7C,OAAQA,EAAa,CACnB,IAAK,mBACH,MAAO,cACT,IAAK,qBACH,MAAO,iBACT,QACE,MAAO,cACX,CACF","names":["getMultipartBoundary","parseMultipartStream","fileURLToPath","stripIndent","getLogQuery","service","limit","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","service","iso_timestamp_start","iso_timestamp_end","getLogsOptionsSchema","sql","getLogQuery","development","getProjectDomain","anonKey","key","functions","edgeFunction","deploymentId","getDeploymentId","entrypoint_path","normalizeFilename","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"]}
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-PHWSETKC.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/chunk-PHWSETKC.cjs"],"names":[],"mappings":"AAAA","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/chunk-PHWSETKC.cjs"}
@@ -0,0 +1,40 @@
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 _chunkAAQ4TRSUcjs = require('./chunk-AAQ4TRSU.cjs');var _multipartparser = require('@mjackson/multipart-parser');var _url = require('url');var _commontags = require('common-tags');function L(p,i=100){switch(p){case"api":return _commontags.stripIndent`
2
+ select id, identifier, timestamp, event_message, request.method, request.path, response.status_code
3
+ from edge_logs
4
+ cross join unnest(metadata) as m
5
+ cross join unnest(m.request) as request
6
+ cross join unnest(m.response) as response
7
+ order by timestamp desc
8
+ limit ${i}
9
+ `;case"branch-action":return _commontags.stripIndent`
10
+ select workflow_run, workflow_run_logs.timestamp, id, event_message from workflow_run_logs
11
+ order by timestamp desc
12
+ limit ${i}
13
+ `;case"postgres":return _commontags.stripIndent`
14
+ select identifier, postgres_logs.timestamp, id, event_message, parsed.error_severity from postgres_logs
15
+ cross join unnest(metadata) as m
16
+ cross join unnest(m.parsed) as parsed
17
+ order by timestamp desc
18
+ limit ${i}
19
+ `;case"edge-function":return _commontags.stripIndent`
20
+ select id, function_edge_logs.timestamp, event_message, response.status_code, request.method, m.function_id, m.execution_time_ms, m.deployment_id, m.version from function_edge_logs
21
+ cross join unnest(metadata) as m
22
+ cross join unnest(m.response) as response
23
+ cross join unnest(m.request) as request
24
+ order by timestamp desc
25
+ limit ${i}
26
+ `;case"auth":return _commontags.stripIndent`
27
+ select id, auth_logs.timestamp, event_message, metadata.level, metadata.status, metadata.path, metadata.msg as msg, metadata.error from auth_logs
28
+ cross join unnest(metadata) as metadata
29
+ order by timestamp desc
30
+ limit ${i}
31
+ `;case"storage":return _commontags.stripIndent`
32
+ select id, storage_logs.timestamp, event_message from storage_logs
33
+ order by timestamp desc
34
+ limit ${i}
35
+ `;case"realtime":return _commontags.stripIndent`
36
+ select id, realtime_logs.timestamp, event_message from realtime_logs
37
+ order by timestamp desc
38
+ limit ${i}
39
+ `;default:throw new Error(`unsupported log service type: ${p}`)}}var _openapifetch = require('openapi-fetch'); var _openapifetch2 = _interopRequireDefault(_openapifetch);var _zod = require('zod');function P(p,i,d={}){return _openapifetch2.default.call(void 0, {baseUrl:p,headers:{Authorization:`Bearer ${i}`,...d}})}var H=_zod.z.object({message:_zod.z.string()});function r(p,i){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:d}=H.safeParse(p.error);throw d?new Error(d.message):new Error(i)}}var I="ABCDEFGHIJKLMNOPQRSTUVWXYZ",N="abcdefghijklmnopqrstuvwxyz",W="0123456789",K="!@#$%^&*()_+~`|}{[]:;?><,./-=",$=({length:p=10,numbers:i=!1,symbols:d=!1,uppercase:w=!0,lowercase:a=!0}={})=>{let m="";if(w&&(m+=I),a&&(m+=N),i&&(m+=W),d&&(m+=K),m.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 v=0;v<p;v++){let S=O[v]%m.length;E+=m.charAt(S)}return E};var{version:V}=_chunkAAQ4TRSUcjs.a;function fe(p){let{accessToken:i,apiUrl:d}=p,w=_nullishCoalesce(d, () => ("https://api.supabase.com")),a=P(w,i),m={async listOrganizations(){let t=await a.GET("/v1/organizations");return r(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await a.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return r(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await a.GET("/v1/projects");return r(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await a.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return r(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:s,region:n,db_pass:o}=_chunkAAQ4TRSUcjs.k.parse(t),c=await a.POST("/v1/projects",{body:{name:e,region:n,organization_id:s,db_pass:_nullishCoalesce(o, () => ($({length:16,numbers:!0,uppercase:!0,lowercase:!0})))}});return r(c,"Failed to create project"),c.data},async pauseProject(t){let e=await a.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});r(e,"Failed to pause project")},async restoreProject(t){let e=await a.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});r(e,"Failed to restore project")}},O={async executeSql(t,e){let{query:s,read_only:n}=_chunkAAQ4TRSUcjs.o.parse(e),o=await a.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:s,read_only:n}});return r(o,"Failed to execute SQL query"),o.data},async listMigrations(t){let e=await a.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return r(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:s,query:n}=_chunkAAQ4TRSUcjs.p.parse(e),o=await a.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:s,query:n}});r(o,"Failed to apply migration")}},E={async getLogs(t,e){let{service:s,iso_timestamp_start:n,iso_timestamp_end:o}=_chunkAAQ4TRSUcjs.s.parse(e),c=L(s),u=await a.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:c,iso_timestamp_start:n,iso_timestamp_end:o}}});return r(u,"Failed to fetch logs"),u.data},async getSecurityAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/security",{params:{path:{ref:t}}});return r(e,"Failed to fetch security advisors"),e.data},async getPerformanceAdvisors(t){let e=await a.GET("/v1/projects/{ref}/advisors/performance",{params:{path:{ref:t}}});return r(e,"Failed to fetch performance advisors"),e.data}},v={async getProjectUrl(t){let e=new URL(w);return`https://${t}.${Y(e.hostname)}`},async getAnonKey(t){let e=await a.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});r(e,"Failed to fetch API keys");let s=_optionalChain([e, 'access', _2 => _2.data, 'optionalAccess', _3 => _3.find, 'call', _4 => _4(n=>n.name==="anon")]);if(!_optionalChain([s, 'optionalAccess', _5 => _5.api_key]))throw new Error("Anonymous key not found");return s.api_key},async generateTypescriptTypes(t){let e=await a.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return r(e,"Failed to fetch TypeScript types"),e.data}},S={async listEdgeFunctions(t){let e=await a.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return r(e,"Failed to fetch Edge Functions"),e.data.map(s=>{let n=_chunkAAQ4TRSUcjs.u.call(void 0, t,s.id,s.version),o=s.entrypoint_path?_chunkAAQ4TRSUcjs.v.call(void 0, {deploymentId:n,filename:_url.fileURLToPath.call(void 0, s.entrypoint_path,{windows:!1})}):void 0,c=s.import_map_path?_chunkAAQ4TRSUcjs.v.call(void 0, {deploymentId:n,filename:_url.fileURLToPath.call(void 0, s.import_map_path,{windows:!1})}):void 0;return{...s,entrypoint_path:o,import_map_path:c}})},async getEdgeFunction(t,e){let s=await a.GET("/v1/projects/{ref}/functions/{function_slug}",{params:{path:{ref:t,function_slug:e}}});if(s.error)throw s.error;r(s,"Failed to fetch Edge Function");let n=s.data,o=_chunkAAQ4TRSUcjs.u.call(void 0, t,n.id,n.version),c=n.entrypoint_path?_chunkAAQ4TRSUcjs.v.call(void 0, {deploymentId:o,filename:_url.fileURLToPath.call(void 0, n.entrypoint_path,{windows:!1})}):void 0,u=n.import_map_path?_chunkAAQ4TRSUcjs.v.call(void 0, {deploymentId:o,filename:_url.fileURLToPath.call(void 0, n.import_map_path,{windows:!1})}):void 0,y=await a.GET("/v1/projects/{ref}/functions/{function_slug}/body",{params:{path:{ref:t,function_slug:e}},headers:{Accept:"multipart/form-data"},parseAs:"stream"});r(y,"Failed to fetch Edge Function files");let g=y.response.headers.get("content-type");if(!g||!g.startsWith("multipart/form-data"))throw new Error(`Unexpected content type: ${g}. Expected multipart/form-data.`);let l=_multipartparser.getMultipartBoundary.call(void 0, g);if(!l)throw new Error("No multipart boundary found in response headers");if(!y.data)throw new Error("No data received from Edge Function body");let h=[],T=_multipartparser.parseMultipartStream.call(void 0, y.data,{boundary:l});for await(let b of T)b.isFile&&b.filename&&h.push({name:_chunkAAQ4TRSUcjs.v.call(void 0, {deploymentId:o,filename:b.filename}),content:b.text});return{...n,entrypoint_path:c,import_map_path:u,files:h}},async deployEdgeFunction(t,e){let{name:s,entrypoint_path:n,import_map_path:o,files:c}=_chunkAAQ4TRSUcjs.n.parse(e),u;try{u=await S.getEdgeFunction(t,s)}catch (e2){}let y=c.find(l=>["deno.json","import_map.json"].includes(l.name));o??=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _6 => _6.import_map_path]), () => (_optionalChain([y, 'optionalAccess', _7 => _7.name])));let g=await a.POST("/v1/projects/{ref}/functions/deploy",{params:{path:{ref:t},query:{slug:s}},body:{metadata:{name:s,entrypoint_path:n,import_map_path:o},file:c},bodySerializer(l){let h=new FormData,T=new Blob([JSON.stringify(l.metadata)],{type:"application/json"});return h.append("metadata",T),_optionalChain([l, 'access', _8 => _8.file, 'optionalAccess', _9 => _9.forEach, 'call', _10 => _10(b=>{let A=b,z=new Blob([A.content],{type:"application/typescript"});h.append("file",z,A.name)})]),h}});return r(g,"Failed to deploy Edge Function"),g.data}};return{async init(t){let{clientInfo:e}=t;if(!e)throw new Error("Client info is required");a=P(w,i,{"User-Agent":`supabase-mcp/${V} (${e.name}/${e.version})`})},account:m,database:O,debugging:E,development:v,functions:S,branching:{async listBranches(t){let e=await a.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(r(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:s}=_chunkAAQ4TRSUcjs.l.parse(e),n=await a.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:s}});return r(n,"Failed to create branch"),n.data},async deleteBranch(t){let e=await a.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});r(e,"Failed to delete branch")},async mergeBranch(t){let e=await a.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:s}=_chunkAAQ4TRSUcjs.m.parse(e),n=await a.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:s}});r(n,"Failed to reset branch")},async rebaseBranch(t){let e=await a.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});r(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await a.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return r(e,"Failed to list storage buckets"),e.data},async getStorageConfig(t){let e=await a.GET("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}}});return r(e,"Failed to get storage config"),e.data},async updateStorageConfig(t,e){let s=await a.PATCH("/v1/projects/{ref}/config/storage",{params:{path:{ref:t}},body:{fileSizeLimit:e.fileSizeLimit,features:{imageTransformation:{enabled:e.features.imageTransformation.enabled},s3Protocol:{enabled:e.features.s3Protocol.enabled}}}});return r(s,"Failed to update storage config"),s.data}}}}function Y(p){switch(p){case"api.supabase.com":return"supabase.co";case"api.supabase.green":return"supabase.green";default:return"supabase.red"}}exports.a = fe;
40
+ //# sourceMappingURL=chunk-Z3P6IGCZ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/chunk-Z3P6IGCZ.cjs","../src/platform/api-platform.ts","../src/logs.ts"],"names":["getLogQuery","service","limit","stripIndent"],"mappings":"AAAA,y0BAAuG,6DCGhG,0BAEuB,yCCLF,SAGZA,CAAAA,CAAYC,CAAAA,CAAsBC,CAAAA,CAAgB,GAAA,CAAK,CACrE,MAAA,CAAQD,CAAAA,CAAS,CACf,IAAK,KAAA,CACH,OAAOE,uBAAAA,CAAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAA,EAOGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,IAAK,eAAA,CACH,OAAOC,uBAAAA,CAAAA;AAAA;AAAA;AAAA,cAAA,EAGGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,IAAK,UAAA,CACH,OAAOC,uBAAAA,CAAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAA,EAKGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,IAAK,eAAA,CACH,OAAOC,uBAAAA,CAAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAA,EAMGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,IAAK,MAAA,CACH,OAAOC,uBAAAA,CAAAA;AAAA;AAAA;AAAA;AAAA,cAAA,EAIGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,IAAK,SAAA,CACH,OAAOC,uBAAAA,CAAAA;AAAA;AAAA;AAAA,cAAA,EAGGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,IAAK,UAAA,CACH,OAAOC,uBAAAA,CAAAA;AAAA;AAAA;AAAA,cAAA,EAGGD,CAAK,CAAA;AAAA,MAAA,CAAA,CAEjB,OAAA,CACE,MAAM,IAAI,KAAA,CAAM,CAAA,8BAAA,EAAiCD,CAAO,CAAA,CAAA","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/chunk-Z3P6IGCZ.cjs","sourcesContent":[null,"import {\n getMultipartBoundary,\n parseMultipartStream,\n} from '@mjackson/multipart-parser';\nimport type { InitData } from '@supabase/mcp-utils';\nimport { fileURLToPath } from 'node:url';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { getDeploymentId, normalizeFilename } from '../edge-function.js';\nimport { getLogQuery } from '../logs.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 { service, iso_timestamp_start, iso_timestamp_end } =\n getLogsOptionsSchema.parse(options);\n\n const sql = getLogQuery(service);\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 entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.entrypoint_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.import_map_path, {\n windows: false,\n }),\n })\n : undefined;\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n };\n });\n },\n async getEdgeFunction(projectId: string, functionSlug: string) {\n const functionResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n }\n );\n\n if (functionResponse.error) {\n throw functionResponse.error;\n }\n\n assertSuccess(functionResponse, 'Failed to fetch Edge Function');\n\n const edgeFunction = functionResponse.data;\n\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.entrypoint_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const import_map_path = edgeFunction.import_map_path\n ? normalizeFilename({\n deploymentId,\n filename: fileURLToPath(edgeFunction.import_map_path, {\n windows: false,\n }),\n })\n : undefined;\n\n const bodyResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/functions/{function_slug}/body',\n {\n params: {\n path: {\n ref: projectId,\n function_slug: functionSlug,\n },\n },\n headers: {\n Accept: 'multipart/form-data',\n },\n parseAs: 'stream',\n }\n );\n\n assertSuccess(bodyResponse, 'Failed to fetch Edge Function files');\n\n const contentType = bodyResponse.response.headers.get('content-type');\n\n if (!contentType || !contentType.startsWith('multipart/form-data')) {\n throw new Error(\n `Unexpected content type: ${contentType}. Expected multipart/form-data.`\n );\n }\n\n const boundary = getMultipartBoundary(contentType);\n\n if (!boundary) {\n throw new Error('No multipart boundary found in response headers');\n }\n\n if (!bodyResponse.data) {\n throw new Error('No data received from Edge Function body');\n }\n\n const files: EdgeFunctionWithBody['files'] = [];\n const parts = parseMultipartStream(bodyResponse.data, { boundary });\n\n for await (const part of parts) {\n if (part.isFile && part.filename) {\n files.push({\n name: normalizeFilename({\n deploymentId,\n filename: part.filename,\n }),\n content: part.text,\n });\n }\n }\n\n return {\n ...edgeFunction,\n entrypoint_path,\n import_map_path,\n files,\n };\n },\n async deployEdgeFunction(\n projectId: string,\n options: DeployEdgeFunctionOptions\n ) {\n let {\n name,\n entrypoint_path,\n import_map_path,\n 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 { stripIndent } from 'common-tags';\nimport type { LogsService } from './platform/types.js';\n\nexport function getLogQuery(service: LogsService, limit: number = 100) {\n switch (service) {\n case 'api':\n return stripIndent`\n select id, identifier, timestamp, event_message, request.method, request.path, response.status_code\n from edge_logs\n cross join unnest(metadata) as m\n cross join unnest(m.request) as request\n cross join unnest(m.response) as response\n order by timestamp desc\n limit ${limit}\n `;\n case 'branch-action':\n return stripIndent`\n select workflow_run, workflow_run_logs.timestamp, id, event_message from workflow_run_logs\n order by timestamp desc\n limit ${limit}\n `;\n case 'postgres':\n return stripIndent`\n select identifier, postgres_logs.timestamp, id, event_message, parsed.error_severity from postgres_logs\n cross join unnest(metadata) as m\n cross join unnest(m.parsed) as parsed\n order by timestamp desc\n limit ${limit}\n `;\n case 'edge-function':\n return stripIndent`\n select id, function_edge_logs.timestamp, event_message, response.status_code, request.method, m.function_id, m.execution_time_ms, m.deployment_id, m.version from function_edge_logs\n cross join unnest(metadata) as m\n cross join unnest(m.response) as response\n cross join unnest(m.request) as request\n order by timestamp desc\n limit ${limit}\n `;\n case 'auth':\n return stripIndent`\n select id, auth_logs.timestamp, event_message, metadata.level, metadata.status, metadata.path, metadata.msg as msg, metadata.error from auth_logs\n cross join unnest(metadata) as metadata\n order by timestamp desc\n limit ${limit}\n `;\n case 'storage':\n return stripIndent`\n select id, storage_logs.timestamp, event_message from storage_logs\n order by timestamp desc\n limit ${limit}\n `;\n case 'realtime':\n return stripIndent`\n select id, realtime_logs.timestamp, event_message from realtime_logs\n order by timestamp desc\n limit ${limit}\n `;\n default:\n throw new Error(`unsupported log service type: ${service}`);\n }\n}\n"]}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGPUZG5AHcjs = require('./chunk-GPUZG5AH.cjs');var a=_chunkGPUZG5AHcjs.a.version;exports.createSupabaseMcpServer = _chunkGPUZG5AHcjs.g; exports.currentFeatureGroupSchema = _chunkGPUZG5AHcjs.b; exports.featureGroupSchema = _chunkGPUZG5AHcjs.c; exports.version = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAAQ4TRSUcjs = require('./chunk-AAQ4TRSU.cjs');var a=_chunkAAQ4TRSUcjs.a.version;exports.createSupabaseMcpServer = _chunkAAQ4TRSUcjs.w; exports.currentFeatureGroupSchema = _chunkAAQ4TRSUcjs.b; exports.featureGroupSchema = _chunkAAQ4TRSUcjs.c; exports.version = a;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/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/grichardson/Documents/dev/supabase/mcp-server-supabase/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"]}
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,ICahDA,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 { ToolCallCallback } from '@supabase/mcp-utils';\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.d.cts CHANGED
@@ -1,10 +1,11 @@
1
+ import { ToolCallCallback } from '@supabase/mcp-utils';
2
+ export { ToolCallCallback } from '@supabase/mcp-utils';
1
3
  import { SupabasePlatform } from './platform/index.cjs';
2
4
  import * as _modelcontextprotocol_sdk_server from '@modelcontextprotocol/sdk/server';
3
5
  import { z } from 'zod';
4
- import '@supabase/mcp-utils';
5
6
 
6
7
  declare const currentFeatureGroupSchema: z.ZodEnum<["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"]>;
7
- declare const featureGroupSchema: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["debug"]>, z.ZodEnum<["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"]>]>, "account" | "branching" | "database" | "storage" | "debugging" | "development" | "functions" | "docs", "account" | "branching" | "database" | "storage" | "debugging" | "development" | "functions" | "debug" | "docs">;
8
+ declare const featureGroupSchema: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["debug"]>, z.ZodEnum<["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"]>]>, "account" | "branching" | "database" | "debugging" | "storage" | "development" | "functions" | "docs", "account" | "branching" | "database" | "debugging" | "storage" | "development" | "functions" | "debug" | "docs">;
8
9
  type FeatureGroup = z.infer<typeof featureGroupSchema>;
9
10
 
10
11
  type SupabaseMcpServerOptions = {
@@ -32,6 +33,10 @@ type SupabaseMcpServerOptions = {
32
33
  * Options: 'account', 'branching', 'database', 'debugging', 'development', 'docs', 'functions', 'storage'
33
34
  */
34
35
  features?: string[];
36
+ /**
37
+ * Callback for after a supabase tool is called.
38
+ */
39
+ onToolCall?: ToolCallCallback;
35
40
  };
36
41
  /**
37
42
  * Creates an MCP server for interacting with Supabase.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ import { ToolCallCallback } from '@supabase/mcp-utils';
2
+ export { ToolCallCallback } from '@supabase/mcp-utils';
1
3
  import { SupabasePlatform } from './platform/index.js';
2
4
  import * as _modelcontextprotocol_sdk_server from '@modelcontextprotocol/sdk/server';
3
5
  import { z } from 'zod';
4
- import '@supabase/mcp-utils';
5
6
 
6
7
  declare const currentFeatureGroupSchema: z.ZodEnum<["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"]>;
7
- declare const featureGroupSchema: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["debug"]>, z.ZodEnum<["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"]>]>, "account" | "branching" | "database" | "storage" | "debugging" | "development" | "functions" | "docs", "account" | "branching" | "database" | "storage" | "debugging" | "development" | "functions" | "debug" | "docs">;
8
+ declare const featureGroupSchema: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["debug"]>, z.ZodEnum<["docs", "account", "database", "debugging", "development", "functions", "branching", "storage"]>]>, "account" | "branching" | "database" | "debugging" | "storage" | "development" | "functions" | "docs", "account" | "branching" | "database" | "debugging" | "storage" | "development" | "functions" | "debug" | "docs">;
8
9
  type FeatureGroup = z.infer<typeof featureGroupSchema>;
9
10
 
10
11
  type SupabaseMcpServerOptions = {
@@ -32,6 +33,10 @@ type SupabaseMcpServerOptions = {
32
33
  * Options: 'account', 'branching', 'database', 'debugging', 'development', 'docs', 'functions', 'storage'
33
34
  */
34
35
  features?: string[];
36
+ /**
37
+ * Callback for after a supabase tool is called.
38
+ */
39
+ onToolCall?: ToolCallCallback;
35
40
  };
36
41
  /**
37
42
  * Creates an MCP server for interacting with Supabase.
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-4LRODYL5.js";var a=e.version;export{p as createSupabaseMcpServer,r as currentFeatureGroupSchema,o as featureGroupSchema,a as version};
1
+ import{a as e,b as r,c as o,w as p}from"./chunk-EYNWMSPQ.js";var a=e.version;export{p as createSupabaseMcpServer,r as currentFeatureGroupSchema,o as featureGroupSchema,a as version};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["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"],"mappings":"6DAYO,IAAMA,EAAUC,EAAY","names":["version","package_default"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import packageJson from '../package.json' with { type: 'json' };\n\nexport type { ToolCallCallback } from '@supabase/mcp-utils';\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"],"mappings":"6DAaO,IAAMA,EAAUC,EAAY","names":["version","package_default"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZM7J5K5Mcjs = require('../chunk-ZM7J5K5M.cjs');require('../chunk-OUTPUM46.cjs');require('../chunk-GPUZG5AH.cjs');exports.createSupabaseApiPlatform = _chunkZM7J5K5Mcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ3P6IGCZcjs = require('../chunk-Z3P6IGCZ.cjs');require('../chunk-PHWSETKC.cjs');require('../chunk-AAQ4TRSU.cjs');exports.createSupabaseApiPlatform = _chunkZ3P6IGCZcjs.a;
2
2
  //# sourceMappingURL=api-platform.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/platform/api-platform.cjs"],"names":[],"mappings":"AAAA,kIAAoC,iCAA8B,iCAA8B,wDAAuC","file":"/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/platform/api-platform.cjs"}
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-KH3JZGVH.js";import"../chunk-XE2UPAEC.js";import"../chunk-4LRODYL5.js";export{a as createSupabaseApiPlatform};
1
+ import{a}from"../chunk-N4REUSSH.js";import"../chunk-LU6L7C36.js";import"../chunk-EYNWMSPQ.js";export{a as createSupabaseApiPlatform};
2
2
  //# sourceMappingURL=api-platform.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOUTPUM46cjs = require('../chunk-OUTPUM46.cjs');require('../chunk-GPUZG5AH.cjs');exports.applyMigrationOptionsSchema = _chunkOUTPUM46cjs.m; exports.branchSchema = _chunkOUTPUM46cjs.e; exports.createBranchOptionsSchema = _chunkOUTPUM46cjs.i; exports.createProjectOptionsSchema = _chunkOUTPUM46cjs.h; exports.deployEdgeFunctionOptionsSchema = _chunkOUTPUM46cjs.k; exports.edgeFunctionSchema = _chunkOUTPUM46cjs.f; exports.edgeFunctionWithBodySchema = _chunkOUTPUM46cjs.g; exports.executeSqlOptionsSchema = _chunkOUTPUM46cjs.l; exports.generateTypescriptTypesResultSchema = _chunkOUTPUM46cjs.p; exports.getLogsOptionsSchema = _chunkOUTPUM46cjs.o; exports.migrationSchema = _chunkOUTPUM46cjs.n; exports.organizationSchema = _chunkOUTPUM46cjs.c; exports.projectSchema = _chunkOUTPUM46cjs.d; exports.resetBranchOptionsSchema = _chunkOUTPUM46cjs.j; exports.storageBucketSchema = _chunkOUTPUM46cjs.a; exports.storageConfigSchema = _chunkOUTPUM46cjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-PHWSETKC.cjs');var _chunkAAQ4TRSUcjs = require('../chunk-AAQ4TRSU.cjs');exports.applyMigrationOptionsSchema = _chunkAAQ4TRSUcjs.p; exports.branchSchema = _chunkAAQ4TRSUcjs.h; exports.createBranchOptionsSchema = _chunkAAQ4TRSUcjs.l; exports.createProjectOptionsSchema = _chunkAAQ4TRSUcjs.k; exports.deployEdgeFunctionOptionsSchema = _chunkAAQ4TRSUcjs.n; exports.edgeFunctionSchema = _chunkAAQ4TRSUcjs.i; exports.edgeFunctionWithBodySchema = _chunkAAQ4TRSUcjs.j; exports.executeSqlOptionsSchema = _chunkAAQ4TRSUcjs.o; exports.generateTypescriptTypesResultSchema = _chunkAAQ4TRSUcjs.t; exports.getLogsOptionsSchema = _chunkAAQ4TRSUcjs.s; exports.logsServiceSchema = _chunkAAQ4TRSUcjs.r; exports.migrationSchema = _chunkAAQ4TRSUcjs.q; exports.organizationSchema = _chunkAAQ4TRSUcjs.f; exports.projectSchema = _chunkAAQ4TRSUcjs.g; exports.resetBranchOptionsSchema = _chunkAAQ4TRSUcjs.m; exports.storageBucketSchema = _chunkAAQ4TRSUcjs.d; exports.storageConfigSchema = _chunkAAQ4TRSUcjs.e;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/platform/index.cjs"],"names":[],"mappings":"AAAA,kIAAkE,iCAA8B,81BAAuc","file":"/Users/grichardson/Documents/dev/supabase/mcp-server-supabase/packages/mcp-server-supabase/dist/platform/index.cjs"}
1
+ {"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/index.cjs"],"names":[],"mappings":"AAAA,0GAA6B,yDAA0J,+4BAA8d","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/index.cjs"}
@@ -341,16 +341,17 @@ declare const migrationSchema: z.ZodObject<{
341
341
  version: string;
342
342
  name?: string | undefined;
343
343
  }>;
344
+ declare const logsServiceSchema: z.ZodEnum<["api", "branch-action", "postgres", "edge-function", "auth", "storage", "realtime"]>;
344
345
  declare const getLogsOptionsSchema: z.ZodObject<{
345
- sql: z.ZodString;
346
+ service: z.ZodEnum<["api", "branch-action", "postgres", "edge-function", "auth", "storage", "realtime"]>;
346
347
  iso_timestamp_start: z.ZodOptional<z.ZodString>;
347
348
  iso_timestamp_end: z.ZodOptional<z.ZodString>;
348
349
  }, "strip", z.ZodTypeAny, {
349
- sql: string;
350
+ service: "api" | "branch-action" | "postgres" | "edge-function" | "auth" | "storage" | "realtime";
350
351
  iso_timestamp_start?: string | undefined;
351
352
  iso_timestamp_end?: string | undefined;
352
353
  }, {
353
- sql: string;
354
+ service: "api" | "branch-action" | "postgres" | "edge-function" | "auth" | "storage" | "realtime";
354
355
  iso_timestamp_start?: string | undefined;
355
356
  iso_timestamp_end?: string | undefined;
356
357
  }>;
@@ -374,6 +375,7 @@ type ExecuteSqlOptions = z.infer<typeof executeSqlOptionsSchema>;
374
375
  type ApplyMigrationOptions = z.infer<typeof applyMigrationOptionsSchema>;
375
376
  type Migration = z.infer<typeof migrationSchema>;
376
377
  type ListMigrationsResult = z.infer<typeof migrationSchema>;
378
+ type LogsService = z.infer<typeof logsServiceSchema>;
377
379
  type GetLogsOptions = z.infer<typeof getLogsOptionsSchema>;
378
380
  type GenerateTypescriptTypesResult = z.infer<typeof generateTypescriptTypesResultSchema>;
379
381
  type StorageConfig = z.infer<typeof storageConfigSchema>;
@@ -431,4 +433,4 @@ type SupabasePlatform = {
431
433
  branching?: BranchingOperations;
432
434
  };
433
435
 
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 };
436
+ 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 LogsService, 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, logsServiceSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
@@ -341,16 +341,17 @@ declare const migrationSchema: z.ZodObject<{
341
341
  version: string;
342
342
  name?: string | undefined;
343
343
  }>;
344
+ declare const logsServiceSchema: z.ZodEnum<["api", "branch-action", "postgres", "edge-function", "auth", "storage", "realtime"]>;
344
345
  declare const getLogsOptionsSchema: z.ZodObject<{
345
- sql: z.ZodString;
346
+ service: z.ZodEnum<["api", "branch-action", "postgres", "edge-function", "auth", "storage", "realtime"]>;
346
347
  iso_timestamp_start: z.ZodOptional<z.ZodString>;
347
348
  iso_timestamp_end: z.ZodOptional<z.ZodString>;
348
349
  }, "strip", z.ZodTypeAny, {
349
- sql: string;
350
+ service: "api" | "branch-action" | "postgres" | "edge-function" | "auth" | "storage" | "realtime";
350
351
  iso_timestamp_start?: string | undefined;
351
352
  iso_timestamp_end?: string | undefined;
352
353
  }, {
353
- sql: string;
354
+ service: "api" | "branch-action" | "postgres" | "edge-function" | "auth" | "storage" | "realtime";
354
355
  iso_timestamp_start?: string | undefined;
355
356
  iso_timestamp_end?: string | undefined;
356
357
  }>;
@@ -374,6 +375,7 @@ type ExecuteSqlOptions = z.infer<typeof executeSqlOptionsSchema>;
374
375
  type ApplyMigrationOptions = z.infer<typeof applyMigrationOptionsSchema>;
375
376
  type Migration = z.infer<typeof migrationSchema>;
376
377
  type ListMigrationsResult = z.infer<typeof migrationSchema>;
378
+ type LogsService = z.infer<typeof logsServiceSchema>;
377
379
  type GetLogsOptions = z.infer<typeof getLogsOptionsSchema>;
378
380
  type GenerateTypescriptTypesResult = z.infer<typeof generateTypescriptTypesResultSchema>;
379
381
  type StorageConfig = z.infer<typeof storageConfigSchema>;
@@ -431,4 +433,4 @@ type SupabasePlatform = {
431
433
  branching?: BranchingOperations;
432
434
  };
433
435
 
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 };
436
+ 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 LogsService, 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, logsServiceSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"../chunk-XE2UPAEC.js";import"../chunk-4LRODYL5.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};
1
+ import"../chunk-LU6L7C36.js";import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o,s as p,t as q}from"../chunk-EYNWMSPQ.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,q as generateTypescriptTypesResultSchema,p as getLogsOptionsSchema,o as logsServiceSchema,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 _chunkZM7J5K5Mcjs = require('../chunk-ZM7J5K5M.cjs');require('../chunk-OUTPUM46.cjs');var _chunkGPUZG5AHcjs = require('../chunk-GPUZG5AH.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}=_chunkGPUZG5AHcjs.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=_chunkZM7J5K5Mcjs.a.call(void 0, {accessToken:n,apiUrl:e}),u=_chunkGPUZG5AHcjs.g.call(void 0, {platform:m,projectId:o,readOnly:t,features:f}),S=new _stdiojs.StdioServerTransport;await u.connect(S)}g().catch(console.error);
2
+ "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkZ3P6IGCZcjs = require('../chunk-Z3P6IGCZ.cjs');require('../chunk-PHWSETKC.cjs');var _chunkAAQ4TRSUcjs = require('../chunk-AAQ4TRSU.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}=_chunkAAQ4TRSUcjs.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=_chunkZ3P6IGCZcjs.a.call(void 0, {accessToken:n,apiUrl:e}),u=_chunkAAQ4TRSUcjs.w.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/grichardson/Documents/dev/supabase/mcp-server-supabase/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/grichardson/Documents/dev/supabase/mcp-server-supabase/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"]}
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,iCAA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ACF,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"]}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as c}from"../chunk-KH3JZGVH.js";import"../chunk-XE2UPAEC.js";import{a,g as i}from"../chunk-4LRODYL5.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);
2
+ import{a as c}from"../chunk-N4REUSSH.js";import"../chunk-LU6L7C36.js";import{a,w as i}from"../chunk-EYNWMSPQ.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@supabase/mcp-server-supabase",
3
3
  "mcpName": "com.supabase/mcp",
4
- "version": "0.5.5",
4
+ "version": "0.5.7",
5
5
  "description": "MCP server for interacting with Supabase",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "graphql": "^16.11.0",
39
39
  "openapi-fetch": "^0.13.5",
40
40
  "zod": "^3.24.1",
41
- "@supabase/mcp-utils": "^0.2.2"
41
+ "@supabase/mcp-utils": "^0.2.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@ai-sdk/anthropic": "^1.2.9",