@supabase/mcp-server-supabase 0.5.7 → 0.5.9

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.
@@ -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 L,v as P,w as _}from"./chunk-5QLPLQMS.js";import{getMultipartBoundary as Q,parseMultipartStream as J}from"@mjackson/multipart-parser";import{fileURLToPath as T}from"url";import{stripIndent as f}from"common-tags";function D(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 z from"openapi-fetch";import{z as U}from"zod";function F(p,i,d={}){return z({baseUrl:p,headers:{Authorization:`Bearer ${i}`,...d}})}var K=U.object({message:U.string()});function n(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}=K.safeParse(p.error);throw d?new Error(d.message):new Error(i)}}var N="ABCDEFGHIJKLMNOPQRSTUVWXYZ",H="abcdefghijklmnopqrstuvwxyz",I="0123456789",W="!@#$%^&*()_+~`|}{[]:;?><,./-=",$=({length:p=10,numbers:i=!1,symbols:d=!1,uppercase:w=!0,lowercase:a=!0}={})=>{let m="";if(w&&(m+=N),a&&(m+=H),i&&(m+=I),d&&(m+=W),m.length===0)throw new Error("at least one character set must be selected");let E=new Uint32Array(p);crypto.getRandomValues(E);let v="";for(let S=0;S<p;S++){let O=E[S]%m.length;v+=m.charAt(O)}return v};var{version:V}=R;function fe(p){let{accessToken:i,apiUrl:d}=p,w=d??"https://api.supabase.com",a=F(w,i),m={async listOrganizations(){let t=await a.GET("/v1/organizations");return n(t,"Failed to fetch organizations"),t.data},async getOrganization(t){let e=await a.GET("/v1/organizations/{slug}",{params:{path:{slug:t}}});return n(e,"Failed to fetch organization"),e.data},async listProjects(){let t=await a.GET("/v1/projects");return n(t,"Failed to fetch projects"),t.data},async getProject(t){let e=await a.GET("/v1/projects/{ref}",{params:{path:{ref:t}}});return n(e,"Failed to fetch project"),e.data},async createProject(t){let{name:e,organization_id:s,region:o,db_pass:r}=C.parse(t),c=await a.POST("/v1/projects",{body:{name:e,region:o,organization_id:s,db_pass:r??$({length:16,numbers:!0,uppercase:!0,lowercase:!0})}});return n(c,"Failed to create project"),c.data},async pauseProject(t){let e=await a.POST("/v1/projects/{ref}/pause",{params:{path:{ref:t}}});n(e,"Failed to pause project")},async restoreProject(t){let e=await a.POST("/v1/projects/{ref}/restore",{params:{path:{ref:t}}});n(e,"Failed to restore project")}},E={async executeSql(t,e){let{query:s,parameters:o,read_only:r}=q.parse(e),c=await a.POST("/v1/projects/{ref}/database/query",{params:{path:{ref:t}},body:{query:s,parameters:o,read_only:r}});return n(c,"Failed to execute SQL query"),c.data},async listMigrations(t){let e=await a.GET("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}}});return n(e,"Failed to fetch migrations"),e.data},async applyMigration(t,e){let{name:s,query:o}=G.parse(e),r=await a.POST("/v1/projects/{ref}/database/migrations",{params:{path:{ref:t}},body:{name:s,query:o}});n(r,"Failed to apply migration")}},v={async getLogs(t,e){let{service:s,iso_timestamp_start:o,iso_timestamp_end:r}=L.parse(e),c=D(s),u=await a.GET("/v1/projects/{ref}/analytics/endpoints/logs.all",{params:{path:{ref:t},query:{sql:c,iso_timestamp_start:o,iso_timestamp_end:r}}});return n(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 n(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 n(e,"Failed to fetch performance advisors"),e.data}},S={async getProjectUrl(t){let e=new URL(w);return`https://${t}.${Y(e.hostname)}`},async getPublishableKeys(t){let e=await a.GET("/v1/projects/{ref}/api-keys",{params:{path:{ref:t},query:{reveal:!1}}});n(e,"Failed to fetch API keys");let s;try{let r=await a.GET("/v1/projects/{ref}/api-keys/legacy",{params:{path:{ref:t}}});r.response.ok&&(s=r.data?.enabled??!0)}catch{s=void 0}let o=e.data?.filter(r=>r.name==="anon"||r.type==="publishable")??[];if(o.length===0)throw new Error("No client-safe API keys (anon or publishable) found. Please create a publishable key in your project settings.");return o.map(r=>({api_key:r.api_key,name:r.name,type:r.type==="publishable"?"publishable":"legacy",...s!==void 0&&{disabled:r.type==="legacy"&&!s},description:r.description??void 0,id:r.id??void 0}))},async generateTypescriptTypes(t){let e=await a.GET("/v1/projects/{ref}/types/typescript",{params:{path:{ref:t}}});return n(e,"Failed to fetch TypeScript types"),e.data}},O={async listEdgeFunctions(t){let e=await a.GET("/v1/projects/{ref}/functions",{params:{path:{ref:t}}});return n(e,"Failed to fetch Edge Functions"),e.data.map(s=>{let o=P(t,s.id,s.version),r=s.entrypoint_path?_({deploymentId:o,filename:T(s.entrypoint_path,{windows:!1})}):void 0,c=s.import_map_path?_({deploymentId:o,filename:T(s.import_map_path,{windows:!1})}):void 0;return{...s,entrypoint_path:r,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;n(s,"Failed to fetch Edge Function");let o=s.data,r=P(t,o.id,o.version),c=o.entrypoint_path?_({deploymentId:r,filename:T(o.entrypoint_path,{windows:!1})}):void 0,u=o.import_map_path?_({deploymentId:r,filename:T(o.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"});n(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=[],j=J(y.data,{boundary:l});for await(let b of j)b.isFile&&b.filename&&h.push({name:_({deploymentId:r,filename:b.filename}),content:b.text});return{...o,entrypoint_path:c,import_map_path:u,files:h}},async deployEdgeFunction(t,e){let{name:s,entrypoint_path:o,import_map_path:r,files:c}=M.parse(e),u;try{u=await O.getEdgeFunction(t,s)}catch{}let y=c.find(l=>["deno.json","import_map.json"].includes(l.name));r??=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:o,import_map_path:r},file:c},bodySerializer(l){let h=new FormData,j=new Blob([JSON.stringify(l.metadata)],{type:"application/json"});return h.append("metadata",j),l.file?.forEach(b=>{let A=b,k=new Blob([A.content],{type:"application/typescript"});h.append("file",k,A.name)}),h}});return n(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=F(w,i,{"User-Agent":`supabase-mcp/${V} (${e.name}/${e.version})`})},account:m,database:E,debugging:v,development:S,functions:O,branching:{async listBranches(t){let e=await a.GET("/v1/projects/{ref}/branches",{params:{path:{ref:t}}});return e.response.status===422?[]:(n(e,"Failed to list branches"),e.data)},async createBranch(t,e){let{name:s}=B.parse(e),o=await a.POST("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:s}});return n(o,"Failed to create branch"),o.data},async deleteBranch(t){let e=await a.DELETE("/v1/branches/{branch_id}",{params:{path:{branch_id:t}}});n(e,"Failed to delete branch")},async mergeBranch(t){let e=await a.POST("/v1/branches/{branch_id}/merge",{params:{path:{branch_id:t}},body:{}});n(e,"Failed to merge branch")},async resetBranch(t,e){let{migration_version:s}=x.parse(e),o=await a.POST("/v1/branches/{branch_id}/reset",{params:{path:{branch_id:t}},body:{migration_version:s}});n(o,"Failed to reset branch")},async rebaseBranch(t){let e=await a.POST("/v1/branches/{branch_id}/push",{params:{path:{branch_id:t}},body:{}});n(e,"Failed to rebase branch")}},storage:{async listAllBuckets(t){let e=await a.GET("/v1/projects/{ref}/storage/buckets",{params:{path:{ref:t}}});return n(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 n(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}}}});n(s,"Failed to update storage config")}}}}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-VDOW5J7J.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 ApiKey,\n type ApiKeyType,\n type ApplyMigrationOptions,\n type BranchingOperations,\n type CreateBranchOptions,\n type CreateProjectOptions,\n type DatabaseOperations,\n type DebuggingOperations,\n type DeployEdgeFunctionOptions,\n type DevelopmentOperations,\n type SuccessResponse,\n type EdgeFunction,\n type EdgeFunctionsOperations,\n type EdgeFunctionWithBody,\n type ExecuteSqlOptions,\n type GetLogsOptions,\n type ResetBranchOptions,\n type StorageConfig,\n type StorageOperations,\n type SupabasePlatform,\n} from './index.js';\n\nconst { version } = packageJson;\n\nconst SUCCESS_RESPONSE: SuccessResponse = { success: true };\n\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, parameters, read_only } =\n executeSqlOptionsSchema.parse(options);\n\n const response = await managementApiClient.POST(\n '/v1/projects/{ref}/database/query',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n body: {\n query,\n parameters,\n read_only,\n },\n }\n );\n\n 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 getPublishableKeys(projectId: string): Promise<ApiKey[]> {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/api-keys',\n {\n params: {\n path: {\n ref: projectId,\n },\n query: {\n reveal: false,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch API keys');\n\n // Try to check if legacy JWT-based keys are enabled\n // If this fails, we'll continue without the disabled field\n let legacyKeysEnabled: boolean | undefined = undefined;\n try {\n const legacyKeysResponse = await managementApiClient.GET(\n '/v1/projects/{ref}/api-keys/legacy',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n if (legacyKeysResponse.response.ok) {\n legacyKeysEnabled = legacyKeysResponse.data?.enabled ?? true;\n }\n } catch (error) {\n // If we can't fetch legacy key status, continue without it\n legacyKeysEnabled = undefined;\n }\n\n // Filter for client-safe keys: legacy 'anon' or publishable type\n const clientKeys =\n response.data?.filter(\n (key) => key.name === 'anon' || key.type === 'publishable'\n ) ?? [];\n\n if (clientKeys.length === 0) {\n throw new Error(\n 'No client-safe API keys (anon or publishable) found. Please create a publishable key in your project settings.'\n );\n }\n\n return clientKeys.map((key) => ({\n api_key: key.api_key!,\n name: key.name,\n type: (key.type === 'publishable'\n ? 'publishable'\n : 'legacy') satisfies ApiKeyType,\n // Only include disabled field if we successfully fetched legacy key status\n ...(legacyKeysEnabled !== undefined && {\n disabled: key.type === 'legacy' && !legacyKeysEnabled,\n }),\n description: key.description ?? undefined,\n id: key.id ?? undefined,\n }));\n },\n async generateTypescriptTypes(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/types/typescript',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch TypeScript types');\n\n return response.data;\n },\n };\n\n const functions: EdgeFunctionsOperations = {\n async listEdgeFunctions(projectId: string) {\n const response = await managementApiClient.GET(\n '/v1/projects/{ref}/functions',\n {\n params: {\n path: {\n ref: projectId,\n },\n },\n }\n );\n\n assertSuccess(response, 'Failed to fetch Edge Functions');\n\n return response.data.map((edgeFunction) => {\n const deploymentId = getDeploymentId(\n projectId,\n edgeFunction.id,\n edgeFunction.version\n );\n\n const entrypoint_path = edgeFunction.entrypoint_path\n ? normalizeFilename({\n deploymentId,\n filename: 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 };\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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AAU,iCAAiC,CAC3D,CACF,CAyBA,CAGF,CAEA,SAASwB,EAAiB0C,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","parameters","read_only","executeSqlOptionsSchema","applyMigrationOptionsSchema","debugging","service","iso_timestamp_start","iso_timestamp_end","getLogsOptionsSchema","sql","getLogQuery","development","getProjectDomain","legacyKeysEnabled","legacyKeysResponse","clientKeys","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","version","createBranchOptionsSchema","createBranchResponse","branchId","migration_version","resetBranchOptionsSchema","project_id","config","apiHostname"]}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _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;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkANLJV57Tcjs = require('./chunk-ANLJV57T.cjs');var a=_chunkANLJV57Tcjs.a.version;exports.createSupabaseMcpServer = _chunkANLJV57Tcjs.x; exports.currentFeatureGroupSchema = _chunkANLJV57Tcjs.b; exports.featureGroupSchema = _chunkANLJV57Tcjs.c; exports.version = a;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
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};
1
+ import{a as e,b as r,c as o,x as p}from"./chunk-5QLPLQMS.js";var a=e.version;export{p as createSupabaseMcpServer,r as currentFeatureGroupSchema,o as featureGroupSchema,a as version};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ3P6IGCZcjs = require('../chunk-Z3P6IGCZ.cjs');require('../chunk-PHWSETKC.cjs');require('../chunk-AAQ4TRSU.cjs');exports.createSupabaseApiPlatform = _chunkZ3P6IGCZcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHX36432Ccjs = require('../chunk-HX36432C.cjs');require('../chunk-PHWSETKC.cjs');require('../chunk-ANLJV57T.cjs');exports.createSupabaseApiPlatform = _chunkHX36432Ccjs.a;
2
2
  //# sourceMappingURL=api-platform.cjs.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-N4REUSSH.js";import"../chunk-LU6L7C36.js";import"../chunk-EYNWMSPQ.js";export{a as createSupabaseApiPlatform};
1
+ import{a}from"../chunk-VDOW5J7J.js";import"../chunk-LU6L7C36.js";import"../chunk-5QLPLQMS.js";export{a as createSupabaseApiPlatform};
2
2
  //# sourceMappingURL=api-platform.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-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;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-PHWSETKC.cjs');var _chunkANLJV57Tcjs = require('../chunk-ANLJV57T.cjs');exports.apiKeyTypeSchema = _chunkANLJV57Tcjs.u; exports.applyMigrationOptionsSchema = _chunkANLJV57Tcjs.p; exports.branchSchema = _chunkANLJV57Tcjs.h; exports.createBranchOptionsSchema = _chunkANLJV57Tcjs.l; exports.createProjectOptionsSchema = _chunkANLJV57Tcjs.k; exports.deployEdgeFunctionOptionsSchema = _chunkANLJV57Tcjs.n; exports.edgeFunctionSchema = _chunkANLJV57Tcjs.i; exports.edgeFunctionWithBodySchema = _chunkANLJV57Tcjs.j; exports.executeSqlOptionsSchema = _chunkANLJV57Tcjs.o; exports.generateTypescriptTypesResultSchema = _chunkANLJV57Tcjs.t; exports.getLogsOptionsSchema = _chunkANLJV57Tcjs.s; exports.logsServiceSchema = _chunkANLJV57Tcjs.r; exports.migrationSchema = _chunkANLJV57Tcjs.q; exports.organizationSchema = _chunkANLJV57Tcjs.f; exports.projectSchema = _chunkANLJV57Tcjs.g; exports.resetBranchOptionsSchema = _chunkANLJV57Tcjs.m; exports.storageBucketSchema = _chunkANLJV57Tcjs.d; exports.storageConfigSchema = _chunkANLJV57Tcjs.e;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"sources":["/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/index.cjs"],"names":[],"mappings":"AAAA,0GAA6B,yDAAiK,+7BAAof","file":"/Users/matt/Developer/supabase-org/supabase-mcp/packages/mcp-server-supabase/dist/platform/index.cjs"}
@@ -1,6 +1,9 @@
1
1
  import { InitData } from '@supabase/mcp-utils';
2
2
  import { z } from 'zod';
3
3
 
4
+ type SuccessResponse = {
5
+ success: true;
6
+ };
4
7
  declare const storageBucketSchema: z.ZodObject<{
5
8
  id: z.ZodString;
6
9
  name: z.ZodString;
@@ -313,12 +316,15 @@ declare const deployEdgeFunctionOptionsSchema: z.ZodObject<{
313
316
  }>;
314
317
  declare const executeSqlOptionsSchema: z.ZodObject<{
315
318
  query: z.ZodString;
319
+ parameters: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
316
320
  read_only: z.ZodOptional<z.ZodBoolean>;
317
321
  }, "strip", z.ZodTypeAny, {
318
322
  query: string;
323
+ parameters?: unknown[] | undefined;
319
324
  read_only?: boolean | undefined;
320
325
  }, {
321
326
  query: string;
327
+ parameters?: unknown[] | undefined;
322
328
  read_only?: boolean | undefined;
323
329
  }>;
324
330
  declare const applyMigrationOptionsSchema: z.ZodObject<{
@@ -404,9 +410,19 @@ type DebuggingOperations = {
404
410
  getSecurityAdvisors(projectId: string): Promise<unknown>;
405
411
  getPerformanceAdvisors(projectId: string): Promise<unknown>;
406
412
  };
413
+ declare const apiKeyTypeSchema: z.ZodEnum<["legacy", "publishable"]>;
414
+ type ApiKeyType = z.infer<typeof apiKeyTypeSchema>;
415
+ type ApiKey = {
416
+ api_key: string;
417
+ name: string;
418
+ type: ApiKeyType;
419
+ description?: string;
420
+ id?: string;
421
+ disabled?: boolean;
422
+ };
407
423
  type DevelopmentOperations = {
408
424
  getProjectUrl(projectId: string): Promise<string>;
409
- getAnonKey(projectId: string): Promise<string>;
425
+ getPublishableKeys(projectId: string): Promise<ApiKey[]>;
410
426
  generateTypescriptTypes(projectId: string): Promise<GenerateTypescriptTypesResult>;
411
427
  };
412
428
  type StorageOperations = {
@@ -433,4 +449,4 @@ type SupabasePlatform = {
433
449
  branching?: BranchingOperations;
434
450
  };
435
451
 
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 };
452
+ export { type AccountOperations, type ApiKey, type ApiKeyType, 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 SuccessResponse, type SupabasePlatform, apiKeyTypeSchema, applyMigrationOptionsSchema, branchSchema, createBranchOptionsSchema, createProjectOptionsSchema, deployEdgeFunctionOptionsSchema, edgeFunctionSchema, edgeFunctionWithBodySchema, executeSqlOptionsSchema, generateTypescriptTypesResultSchema, getLogsOptionsSchema, logsServiceSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
@@ -1,6 +1,9 @@
1
1
  import { InitData } from '@supabase/mcp-utils';
2
2
  import { z } from 'zod';
3
3
 
4
+ type SuccessResponse = {
5
+ success: true;
6
+ };
4
7
  declare const storageBucketSchema: z.ZodObject<{
5
8
  id: z.ZodString;
6
9
  name: z.ZodString;
@@ -313,12 +316,15 @@ declare const deployEdgeFunctionOptionsSchema: z.ZodObject<{
313
316
  }>;
314
317
  declare const executeSqlOptionsSchema: z.ZodObject<{
315
318
  query: z.ZodString;
319
+ parameters: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
316
320
  read_only: z.ZodOptional<z.ZodBoolean>;
317
321
  }, "strip", z.ZodTypeAny, {
318
322
  query: string;
323
+ parameters?: unknown[] | undefined;
319
324
  read_only?: boolean | undefined;
320
325
  }, {
321
326
  query: string;
327
+ parameters?: unknown[] | undefined;
322
328
  read_only?: boolean | undefined;
323
329
  }>;
324
330
  declare const applyMigrationOptionsSchema: z.ZodObject<{
@@ -404,9 +410,19 @@ type DebuggingOperations = {
404
410
  getSecurityAdvisors(projectId: string): Promise<unknown>;
405
411
  getPerformanceAdvisors(projectId: string): Promise<unknown>;
406
412
  };
413
+ declare const apiKeyTypeSchema: z.ZodEnum<["legacy", "publishable"]>;
414
+ type ApiKeyType = z.infer<typeof apiKeyTypeSchema>;
415
+ type ApiKey = {
416
+ api_key: string;
417
+ name: string;
418
+ type: ApiKeyType;
419
+ description?: string;
420
+ id?: string;
421
+ disabled?: boolean;
422
+ };
407
423
  type DevelopmentOperations = {
408
424
  getProjectUrl(projectId: string): Promise<string>;
409
- getAnonKey(projectId: string): Promise<string>;
425
+ getPublishableKeys(projectId: string): Promise<ApiKey[]>;
410
426
  generateTypescriptTypes(projectId: string): Promise<GenerateTypescriptTypesResult>;
411
427
  };
412
428
  type StorageOperations = {
@@ -433,4 +449,4 @@ type SupabasePlatform = {
433
449
  branching?: BranchingOperations;
434
450
  };
435
451
 
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 };
452
+ export { type AccountOperations, type ApiKey, type ApiKeyType, 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 SuccessResponse, type SupabasePlatform, apiKeyTypeSchema, applyMigrationOptionsSchema, branchSchema, createBranchOptionsSchema, createProjectOptionsSchema, deployEdgeFunctionOptionsSchema, edgeFunctionSchema, edgeFunctionWithBodySchema, executeSqlOptionsSchema, generateTypescriptTypesResultSchema, getLogsOptionsSchema, logsServiceSchema, migrationSchema, organizationSchema, projectSchema, resetBranchOptionsSchema, storageBucketSchema, storageConfigSchema };
@@ -1,2 +1,2 @@
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};
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,u as r}from"../chunk-5QLPLQMS.js";export{r as apiKeyTypeSchema,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 _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);
2
+ "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkHX36432Ccjs = require('../chunk-HX36432C.cjs');require('../chunk-PHWSETKC.cjs');var _chunkANLJV57Tcjs = require('../chunk-ANLJV57T.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}=_chunkANLJV57Tcjs.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=_chunkHX36432Ccjs.a.call(void 0, {accessToken:n,apiUrl:e}),u=_chunkANLJV57Tcjs.x.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,3 +1,3 @@
1
1
  #!/usr/bin/env node
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);
2
+ import{a as c}from"../chunk-VDOW5J7J.js";import"../chunk-LU6L7C36.js";import{a,x as i}from"../chunk-5QLPLQMS.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.7",
4
+ "version": "0.5.9",
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.3"
41
+ "@supabase/mcp-utils": "^0.2.4"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@ai-sdk/anthropic": "^1.2.9",