@supabase/mcp-server-supabase 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var re={name:"@supabase/mcp-server-supabase",mcpName:"com.supabase/mcp",version:"0.6.0",description:"MCP server for interacting with Supabase",license:"Apache-2.0",repository:{type:"git",url:"https://github.com/supabase-community/supabase-mcp.git"},type:"module",main:"dist/index.cjs",types:"dist/index.d.ts",sideEffects:!1,scripts:{build:"tsup --clean",dev:"tsup --watch",typecheck:"tsc --noEmit",prebuild:"pnpm typecheck",prepublishOnly:"pnpm build","registry:update":"tsx scripts/registry/update-version.ts && biome format --write server.json","registry:login":"scripts/registry/login.sh","registry:publish":"mcp-publisher publish",test:"vitest","test:unit":"vitest --project unit","test:e2e":"vitest --project e2e","test:integration":"vitest --project integration","test:coverage":"vitest --coverage","generate:management-api-types":"openapi-typescript https://api.supabase.com/api/v1-json -o ./src/management-api/types.ts"},files:["dist/**/*"],bin:{"mcp-server-supabase":"./dist/transports/stdio.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.cjs"},"./platform":{types:"./dist/platform/index.d.ts",import:"./dist/platform/index.js",default:"./dist/platform/index.cjs"},"./platform/api":{types:"./dist/platform/api-platform.d.ts",import:"./dist/platform/api-platform.js",default:"./dist/platform/api-platform.cjs"}},dependencies:{"@mjackson/multipart-parser":"^0.10.1","@modelcontextprotocol/sdk":"catalog:","@supabase/mcp-utils":"workspace:^","common-tags":"^1.8.2",gqlmin:"^0.3.1",graphql:"^16.11.0","openapi-fetch":"^0.13.5"},peerDependencies:{zod:"catalog:"},devDependencies:{"@ai-sdk/anthropic":"catalog:","@ai-sdk/mcp":"catalog:","@electric-sql/pglite":"^0.2.17","@total-typescript/tsconfig":"^1.0.4","@types/common-tags":"^1.8.4","@types/node":"^22.8.6","@vitest/coverage-v8":"^2.1.9",ai:"catalog:","date-fns":"^4.1.0",dotenv:"^16.5.0",msw:"^2.7.3",nanoid:"^5.1.5","openapi-typescript":"^7.5.0","openapi-typescript-helpers":"^0.0.15",prettier:"^3.3.3",tsup:"^8.3.5",tsx:"^4.19.2",typescript:"^5.6.3",vite:"^5.4.19",vitest:"^2.1.9",zod:"catalog:"}};import{z as B}from"zod/v4";var ze=["docs","account","database","debugging","development","functions","branching","storage"],qe=B.enum(["debug"]),$=B.enum(ze),ae=B.union([qe,$]).transform(t=>{switch(t){case"debug":return"debugging";default:return t}});import{z as e}from"zod/v4";import{z as K}from"zod/v4";import{createMcpServer as mt}from"@supabase/mcp-utils";import Ke from"gqlmin";import{z as ie}from"zod/v4";import{buildSchema as We,GraphQLError as Ge,parse as Be,validate as $e}from"graphql";import{z as m}from"zod/v4";var Ot=m.object({query:m.string(),variables:m.record(m.string(),m.unknown()).optional()}),Me=m.object({data:m.record(m.string(),m.unknown()),errors:m.undefined()}),Qe=m.object({message:m.string(),locations:m.array(m.object({line:m.number(),column:m.number()}))}),Je=m.object({data:m.undefined(),errors:m.array(Qe)}),Ye=m.union([Me,Je]),R=class{#t;#e;schemaLoaded;constructor(i){this.#t=i.url,this.#e=i.headers??{},this.schemaLoaded=i.loadSchema?.({query:this.#n.bind(this)}).then(n=>({source:n,schema:We(n)}))??Promise.reject(new Error("No schema loader provided")),this.schemaLoaded.catch(()=>{})}async query(i,n={validateSchema:!1}){try{let r=Be(i.query);if(n.validateSchema){let{schema:a}=await this.schemaLoaded,s=$e(a,r);if(s.length>0)throw new Error(`Invalid GraphQL query: ${s.map(c=>c.message).join(", ")}`)}return this.#n(i)}catch(r){throw r instanceof Ge?new Error(`Invalid GraphQL query: ${r.message}`):r}}setUserAgent(i){this.#e["User-Agent"]=i}async#n(i){let{query:n,variables:r}=i,a=new URL(this.#t);a.searchParams.set("query",n),r!==void 0&&a.searchParams.set("variables",JSON.stringify(r));let s=await fetch(a,{method:"GET",headers:{...this.#e,Accept:"application/json"}});if(!s.ok)throw new Error(`Failed to fetch Supabase Content API GraphQL schema: HTTP status ${s.status}`);let c=await s.json(),{data:d,error:p}=Ye.safeParse(c);if(p)throw new Error(`Failed to parse Supabase Content API response: ${p.message}`);if(d.errors)throw new Error(`Supabase Content API GraphQL error: ${d.errors.map(g=>`${g.message} (line ${g.locations[0]?.line??"unknown"}, column ${g.locations[0]?.column??"unknown"})`).join(", ")}`);return d.data}};var Ve=ie.object({schema:ie.string()});async function se(t,i){let n=new R({url:t,headers:i});return{loadSchema:async()=>{let r=await n.query({query:"{ schema }"}),{schema:a}=Ve.parse(r);return Ke(a)},async query(r){return n.query(r)},setUserAgent(r){n.setUserAgent(r)}}}import{tool as j}from"@supabase/mcp-utils";import{z as u}from"zod/v4";async function M(t,i){let n=await t.getOrganization(i),a=(await t.listProjects()).filter(c=>c.organization_id===i&&!["INACTIVE","GOING_DOWN","REMOVED"].includes(c.status)),s=0;return n.plan!=="free"&&a.length>0&&(s=10),{type:"project",recurrence:"monthly",amount:s}}function L(){return{type:"branch",recurrence:"hourly",amount:.01344}}var ce={success:!0};function pe({account:t,readOnly:i}){return{list_organizations:j({description:"Lists all organizations that the user is a member of.",annotations:{title:"List organizations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({}),execute:async()=>await t.listOrganizations()}),get_organization:j({description:"Gets details for an organization. Includes subscription plan.",annotations:{title:"Get organization details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({id:u.string().describe("The organization ID")}),execute:async({id:n})=>await t.getOrganization(n)}),list_projects:j({description:"Lists all Supabase projects for the user. Use this to help discover the project ID of the project that the user is working on.",annotations:{title:"List projects",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({}),execute:async()=>await t.listProjects()}),get_project:j({description:"Gets details for a Supabase project.",annotations:{title:"Get project details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({id:u.string().describe("The project ID")}),execute:async({id:n})=>await t.getProject(n)}),get_cost:j({description:"Gets the cost of creating a new project or branch. Never assume organization as costs can be different for each.",annotations:{title:"Get cost of new resources",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({type:u.enum(["project","branch"]),organization_id:u.string().describe("The organization ID. Always ask the user.")}),execute:async({type:n,organization_id:r})=>{function a(s){return`The new ${n} will cost $${s.amount} ${s.recurrence}. You must repeat this to the user and confirm their understanding.`}switch(n){case"project":{let s=await M(t,r);return a(s)}case"branch":{let s=L();return a(s)}default:throw new Error(`Unknown cost type: ${n}`)}}}),confirm_cost:j({description:"Ask the user to confirm their understanding of the cost of creating a new project or branch. Call `get_cost` first. Returns a unique ID for this confirmation which should be passed to `create_project` or `create_branch`.",annotations:{title:"Confirm cost understanding",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({type:u.enum(["project","branch"]),recurrence:u.enum(["hourly","monthly"]),amount:u.number()}),execute:async n=>await A(n)}),create_project:j({description:"Creates a new Supabase project. Always ask the user which organization to create the project in. The project can take a few minutes to initialize - use `get_project` to check the status.",annotations:{title:"Create project",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:u.object({name:u.string().describe("The name of the project"),region:u.enum(P).describe("The region to create the project in."),organization_id:u.string(),confirm_cost_id:u.string({error:n=>n.input===void 0?"User must confirm understanding of costs before creating a project.":void 0}).describe("The cost confirmation ID. Call `confirm_cost` first.")}),execute:async({name:n,region:r,organization_id:a,confirm_cost_id:s})=>{if(i)throw new Error("Cannot create a project in read-only mode.");let c=await M(t,a);if(await A(c)!==s)throw new Error("Cost confirmation ID does not match the expected cost of creating a project.");return await t.createProject({name:n,region:r,organization_id:a})}}),pause_project:j({description:"Pauses a Supabase project.",annotations:{title:"Pause project",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:u.object({project_id:u.string()}),execute:async({project_id:n})=>{if(i)throw new Error("Cannot pause a project in read-only mode.");return await t.pauseProject(n),ce}}),restore_project:j({description:"Restores a Supabase project.",annotations:{title:"Restore project",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:u.object({project_id:u.string()}),execute:async({project_id:n})=>{if(i)throw new Error("Cannot restore a project in read-only mode.");return await t.restoreProject(n),ce}})}}import{tool as D}from"@supabase/mcp-utils";import{z as f}from"zod/v4";import{tool as le}from"@supabase/mcp-utils";import"zod/v4";function l({description:t,annotations:i,parameters:n,inject:r,execute:a}){if(!r||Object.values(r).every(p=>p===void 0))return le({description:t,annotations:i,parameters:n,execute:a});let s=Object.fromEntries(Object.keys(r).filter(p=>r[p]!==void 0).map(p=>[p,!0])),c=n.omit(s);return le({description:t,annotations:i,parameters:c,execute:async p=>a({...p,...r})})}var k={success:!0};function de({branching:t,projectId:i,readOnly:n}){let r=i;return{create_branch:l({description:"Creates a development branch on a Supabase project. This will apply all migrations from the main project to a fresh branch database. Note that production data will not carry over. The branch will get its own project_id via the resulting project_ref. Use this ID to execute queries and migrations on the branch.",annotations:{title:"Create branch",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:f.object({project_id:f.string(),name:f.string().default("develop").describe("Name of the branch to create"),confirm_cost_id:f.string({error:a=>a.input===void 0?"User must confirm understanding of costs before creating a branch.":void 0}).describe("The cost confirmation ID. Call `confirm_cost` first.")}),inject:{project_id:r},execute:async({project_id:a,name:s,confirm_cost_id:c})=>{if(n)throw new Error("Cannot create a branch in read-only mode.");let d=L();if(await A(d)!==c)throw new Error("Cost confirmation ID does not match the expected cost of creating a branch.");return await t.createBranch(a,{name:s})}}),list_branches:l({description:"Lists all development branches of a Supabase project. This will return branch details including status which you can use to check when operations like merge/rebase/reset complete.",annotations:{title:"List branches",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:f.object({project_id:f.string()}),inject:{project_id:r},execute:async({project_id:a})=>await t.listBranches(a)}),delete_branch:D({description:"Deletes a development branch.",annotations:{title:"Delete branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string()}),execute:async({branch_id:a})=>{if(n)throw new Error("Cannot delete a branch in read-only mode.");return await t.deleteBranch(a),k}}),merge_branch:D({description:"Merges migrations and edge functions from a development branch to production.",annotations:{title:"Merge branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string()}),execute:async({branch_id:a})=>{if(n)throw new Error("Cannot merge a branch in read-only mode.");return await t.mergeBranch(a),k}}),reset_branch:D({description:"Resets migrations of a development branch. Any untracked data or schema changes will be lost.",annotations:{title:"Reset branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string(),migration_version:f.string().optional().describe("Reset your development branch to a specific migration version.")}),execute:async({branch_id:a,migration_version:s})=>{if(n)throw new Error("Cannot reset a branch in read-only mode.");return await t.resetBranch(a,{migration_version:s}),k}}),rebase_branch:D({description:"Rebases a development branch on production. This will effectively run any newer migrations from production onto this branch to help handle migration drift.",annotations:{title:"Rebase branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string()}),execute:async({branch_id:a})=>{if(n)throw new Error("Cannot rebase a branch in read-only mode.");return await t.rebaseBranch(a),k}})}}import{source as at}from"common-tags";import{z as h}from"zod/v4";import{stripIndent as he}from"common-tags";var ue=`-- Adapted from information_schema.columns
1
+ var re={name:"@supabase/mcp-server-supabase",mcpName:"com.supabase/mcp",version:"0.6.1",description:"MCP server for interacting with Supabase",license:"Apache-2.0",repository:{type:"git",url:"https://github.com/supabase-community/supabase-mcp.git"},type:"module",main:"dist/index.cjs",types:"dist/index.d.ts",sideEffects:!1,scripts:{build:"tsup --clean",dev:"tsup --watch",typecheck:"tsc --noEmit",prebuild:"pnpm typecheck",prepublishOnly:"pnpm build","registry:update":"tsx scripts/registry/update-version.ts && biome format --write server.json","registry:login":"scripts/registry/login.sh","registry:publish":"mcp-publisher publish",test:"vitest","test:unit":"vitest --project unit","test:e2e":"vitest --project e2e","test:integration":"vitest --project integration","test:coverage":"vitest --coverage","generate:management-api-types":"openapi-typescript https://api.supabase.com/api/v1-json -o ./src/management-api/types.ts"},files:["dist/**/*"],bin:{"mcp-server-supabase":"./dist/transports/stdio.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.cjs"},"./platform":{types:"./dist/platform/index.d.ts",import:"./dist/platform/index.js",default:"./dist/platform/index.cjs"},"./platform/api":{types:"./dist/platform/api-platform.d.ts",import:"./dist/platform/api-platform.js",default:"./dist/platform/api-platform.cjs"}},dependencies:{"@mjackson/multipart-parser":"^0.10.1","@modelcontextprotocol/sdk":"catalog:","@supabase/mcp-utils":"workspace:^","common-tags":"^1.8.2",gqlmin:"^0.3.1",graphql:"^16.11.0","openapi-fetch":"^0.13.5"},peerDependencies:{zod:"catalog:"},devDependencies:{"@ai-sdk/anthropic":"catalog:","@ai-sdk/mcp":"catalog:","@electric-sql/pglite":"^0.2.17","@total-typescript/tsconfig":"^1.0.4","@types/common-tags":"^1.8.4","@types/node":"^22.8.6","@vitest/coverage-v8":"^2.1.9",ai:"catalog:","date-fns":"^4.1.0",dotenv:"^16.5.0",msw:"^2.7.3",nanoid:"^5.1.5","openapi-typescript":"^7.5.0","openapi-typescript-helpers":"^0.0.15",prettier:"^3.3.3",tsup:"^8.3.5",tsx:"^4.19.2",typescript:"^5.6.3",vite:"^5.4.19",vitest:"^2.1.9",zod:"catalog:"}};import{z as B}from"zod/v4";var ze=["docs","account","database","debugging","development","functions","branching","storage"],qe=B.enum(["debug"]),$=B.enum(ze),ae=B.union([qe,$]).transform(t=>{switch(t){case"debug":return"debugging";default:return t}});import{z as e}from"zod/v4";import{z as K}from"zod/v4";import{createMcpServer as mt}from"@supabase/mcp-utils";import Ke from"gqlmin";import{z as ie}from"zod/v4";import{buildSchema as We,GraphQLError as Ge,parse as Be,validate as $e}from"graphql";import{z as m}from"zod/v4";var Ot=m.object({query:m.string(),variables:m.record(m.string(),m.unknown()).optional()}),Me=m.object({data:m.record(m.string(),m.unknown()),errors:m.undefined()}),Qe=m.object({message:m.string(),locations:m.array(m.object({line:m.number(),column:m.number()}))}),Je=m.object({data:m.undefined(),errors:m.array(Qe)}),Ye=m.union([Me,Je]),R=class{#t;#e;schemaLoaded;constructor(i){this.#t=i.url,this.#e=i.headers??{},this.schemaLoaded=i.loadSchema?.({query:this.#n.bind(this)}).then(n=>({source:n,schema:We(n)}))??Promise.reject(new Error("No schema loader provided")),this.schemaLoaded.catch(()=>{})}async query(i,n={validateSchema:!1}){try{let r=Be(i.query);if(n.validateSchema){let{schema:a}=await this.schemaLoaded,s=$e(a,r);if(s.length>0)throw new Error(`Invalid GraphQL query: ${s.map(c=>c.message).join(", ")}`)}return this.#n(i)}catch(r){throw r instanceof Ge?new Error(`Invalid GraphQL query: ${r.message}`):r}}setUserAgent(i){this.#e["User-Agent"]=i}async#n(i){let{query:n,variables:r}=i,a=new URL(this.#t);a.searchParams.set("query",n),r!==void 0&&a.searchParams.set("variables",JSON.stringify(r));let s=await fetch(a,{method:"GET",headers:{...this.#e,Accept:"application/json"}});if(!s.ok)throw new Error(`Failed to fetch Supabase Content API GraphQL schema: HTTP status ${s.status}`);let c=await s.json(),{data:d,error:p}=Ye.safeParse(c);if(p)throw new Error(`Failed to parse Supabase Content API response: ${p.message}`);if(d.errors)throw new Error(`Supabase Content API GraphQL error: ${d.errors.map(g=>`${g.message} (line ${g.locations[0]?.line??"unknown"}, column ${g.locations[0]?.column??"unknown"})`).join(", ")}`);return d.data}};var Ve=ie.object({schema:ie.string()});async function se(t,i){let n=new R({url:t,headers:i});return{loadSchema:async()=>{let r=await n.query({query:"{ schema }"}),{schema:a}=Ve.parse(r);return Ke(a)},async query(r){return n.query(r)},setUserAgent(r){n.setUserAgent(r)}}}import{tool as j}from"@supabase/mcp-utils";import{z as u}from"zod/v4";async function M(t,i){let n=await t.getOrganization(i),a=(await t.listProjects()).filter(c=>c.organization_id===i&&!["INACTIVE","GOING_DOWN","REMOVED"].includes(c.status)),s=0;return n.plan!=="free"&&a.length>0&&(s=10),{type:"project",recurrence:"monthly",amount:s}}function L(){return{type:"branch",recurrence:"hourly",amount:.01344}}var ce={success:!0};function pe({account:t,readOnly:i}){return{list_organizations:j({description:"Lists all organizations that the user is a member of.",annotations:{title:"List organizations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({}),execute:async()=>await t.listOrganizations()}),get_organization:j({description:"Gets details for an organization. Includes subscription plan.",annotations:{title:"Get organization details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({id:u.string().describe("The organization ID")}),execute:async({id:n})=>await t.getOrganization(n)}),list_projects:j({description:"Lists all Supabase projects for the user. Use this to help discover the project ID of the project that the user is working on.",annotations:{title:"List projects",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({}),execute:async()=>await t.listProjects()}),get_project:j({description:"Gets details for a Supabase project.",annotations:{title:"Get project details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({id:u.string().describe("The project ID")}),execute:async({id:n})=>await t.getProject(n)}),get_cost:j({description:"Gets the cost of creating a new project or branch. Never assume organization as costs can be different for each.",annotations:{title:"Get cost of new resources",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({type:u.enum(["project","branch"]),organization_id:u.string().describe("The organization ID. Always ask the user.")}),execute:async({type:n,organization_id:r})=>{function a(s){return`The new ${n} will cost $${s.amount} ${s.recurrence}. You must repeat this to the user and confirm their understanding.`}switch(n){case"project":{let s=await M(t,r);return a(s)}case"branch":{let s=L();return a(s)}default:throw new Error(`Unknown cost type: ${n}`)}}}),confirm_cost:j({description:"Ask the user to confirm their understanding of the cost of creating a new project or branch. Call `get_cost` first. Returns a unique ID for this confirmation which should be passed to `create_project` or `create_branch`.",annotations:{title:"Confirm cost understanding",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:u.object({type:u.enum(["project","branch"]),recurrence:u.enum(["hourly","monthly"]),amount:u.number()}),execute:async n=>await A(n)}),create_project:j({description:"Creates a new Supabase project. Always ask the user which organization to create the project in. The project can take a few minutes to initialize - use `get_project` to check the status.",annotations:{title:"Create project",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:u.object({name:u.string().describe("The name of the project"),region:u.enum(P).describe("The region to create the project in."),organization_id:u.string(),confirm_cost_id:u.string({error:n=>n.input===void 0?"User must confirm understanding of costs before creating a project.":void 0}).describe("The cost confirmation ID. Call `confirm_cost` first.")}),execute:async({name:n,region:r,organization_id:a,confirm_cost_id:s})=>{if(i)throw new Error("Cannot create a project in read-only mode.");let c=await M(t,a);if(await A(c)!==s)throw new Error("Cost confirmation ID does not match the expected cost of creating a project.");return await t.createProject({name:n,region:r,organization_id:a})}}),pause_project:j({description:"Pauses a Supabase project.",annotations:{title:"Pause project",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:u.object({project_id:u.string()}),execute:async({project_id:n})=>{if(i)throw new Error("Cannot pause a project in read-only mode.");return await t.pauseProject(n),ce}}),restore_project:j({description:"Restores a Supabase project.",annotations:{title:"Restore project",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:u.object({project_id:u.string()}),execute:async({project_id:n})=>{if(i)throw new Error("Cannot restore a project in read-only mode.");return await t.restoreProject(n),ce}})}}import{tool as D}from"@supabase/mcp-utils";import{z as f}from"zod/v4";import{tool as le}from"@supabase/mcp-utils";import"zod/v4";function l({description:t,annotations:i,parameters:n,inject:r,execute:a}){if(!r||Object.values(r).every(p=>p===void 0))return le({description:t,annotations:i,parameters:n,execute:a});let s=Object.fromEntries(Object.keys(r).filter(p=>r[p]!==void 0).map(p=>[p,!0])),c=n.omit(s);return le({description:t,annotations:i,parameters:c,execute:async p=>a({...p,...r})})}var k={success:!0};function de({branching:t,projectId:i,readOnly:n}){let r=i;return{create_branch:l({description:"Creates a development branch on a Supabase project. This will apply all migrations from the main project to a fresh branch database. Note that production data will not carry over. The branch will get its own project_id via the resulting project_ref. Use this ID to execute queries and migrations on the branch.",annotations:{title:"Create branch",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},parameters:f.object({project_id:f.string(),name:f.string().default("develop").describe("Name of the branch to create"),confirm_cost_id:f.string({error:a=>a.input===void 0?"User must confirm understanding of costs before creating a branch.":void 0}).describe("The cost confirmation ID. Call `confirm_cost` first.")}),inject:{project_id:r},execute:async({project_id:a,name:s,confirm_cost_id:c})=>{if(n)throw new Error("Cannot create a branch in read-only mode.");let d=L();if(await A(d)!==c)throw new Error("Cost confirmation ID does not match the expected cost of creating a branch.");return await t.createBranch(a,{name:s})}}),list_branches:l({description:"Lists all development branches of a Supabase project. This will return branch details including status which you can use to check when operations like merge/rebase/reset complete.",annotations:{title:"List branches",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:f.object({project_id:f.string()}),inject:{project_id:r},execute:async({project_id:a})=>await t.listBranches(a)}),delete_branch:D({description:"Deletes a development branch.",annotations:{title:"Delete branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string()}),execute:async({branch_id:a})=>{if(n)throw new Error("Cannot delete a branch in read-only mode.");return await t.deleteBranch(a),k}}),merge_branch:D({description:"Merges migrations and edge functions from a development branch to production.",annotations:{title:"Merge branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string()}),execute:async({branch_id:a})=>{if(n)throw new Error("Cannot merge a branch in read-only mode.");return await t.mergeBranch(a),k}}),reset_branch:D({description:"Resets migrations of a development branch. Any untracked data or schema changes will be lost.",annotations:{title:"Reset branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string(),migration_version:f.string().optional().describe("Reset your development branch to a specific migration version.")}),execute:async({branch_id:a,migration_version:s})=>{if(n)throw new Error("Cannot reset a branch in read-only mode.");return await t.resetBranch(a,{migration_version:s}),k}}),rebase_branch:D({description:"Rebases a development branch on production. This will effectively run any newer migrations from production onto this branch to help handle migration drift.",annotations:{title:"Rebase branch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:f.object({branch_id:f.string()}),execute:async({branch_id:a})=>{if(n)throw new Error("Cannot rebase a branch in read-only mode.");return await t.rebaseBranch(a),k}})}}import{source as at}from"common-tags";import{z as h}from"zod/v4";import{stripIndent as he}from"common-tags";var ue=`-- Adapted from information_schema.columns
2
2
 
3
3
  SELECT
4
4
  c.oid :: int8 AS table_id,
@@ -269,4 +269,4 @@ group by
269
269
  `;function Ne({functions:t,projectId:i,readOnly:n}){let r=i;return{list_edge_functions:l({description:"Lists all Edge Functions in a Supabase project.",annotations:{title:"List Edge Functions",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:y.object({project_id:y.string()}),inject:{project_id:r},execute:async({project_id:a})=>await t.listEdgeFunctions(a)}),get_edge_function:l({description:"Retrieves file contents for an Edge Function in a Supabase project.",annotations:{title:"Get Edge Function",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:y.object({project_id:y.string(),function_slug:y.string()}),inject:{project_id:r},execute:async({project_id:a,function_slug:s})=>await t.getEdgeFunction(a,s)}),deploy_edge_function:l({description:`Deploys an Edge Function to a Supabase project. If the function already exists, this will create a new version. Example:
270
270
 
271
271
  ${we}`,annotations:{title:"Deploy Edge Function",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:y.object({project_id:y.string(),name:y.string().describe("The name of the function"),entrypoint_path:y.string().default("index.ts").describe("The entrypoint of the function"),import_map_path:y.string().describe("The import map for the function.").optional(),verify_jwt:y.boolean().default(!0).describe("Whether to require a valid JWT in the Authorization header. You SHOULD ALWAYS enable this to ensure authorized access. ONLY disable if the function previously had it disabled OR you've confirmed the function body implements custom authentication (e.g., API keys, webhooks) OR the user explicitly requested it be disabled."),files:y.array(y.object({name:y.string(),content:y.string()})).describe("The files to upload. This should include the entrypoint, deno.json, and any relative dependencies. Include the deno.json and deno.jsonc files to configure the Deno runtime (e.g., compiler options, imports) if they exist.")}),inject:{project_id:r},execute:async({project_id:a,name:s,entrypoint_path:c,import_map_path:d,verify_jwt:p,files:g})=>{if(n)throw new Error("Cannot deploy an edge function in read-only mode.");return await t.deployEdgeFunction(a,{name:s,entrypoint_path:c,import_map_path:d,verify_jwt:p,files:g})}})}}import{z as _}from"zod/v4";var ut={success:!0};function He({storage:t,projectId:i,readOnly:n}){let r=i;return{list_storage_buckets:l({description:"Lists all storage buckets in a Supabase project.",annotations:{title:"List storage buckets",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:_.object({project_id:_.string()}),inject:{project_id:r},execute:async({project_id:a})=>await t.listAllBuckets(a)}),get_storage_config:l({description:"Get the storage config for a Supabase project.",annotations:{title:"Get storage config",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},parameters:_.object({project_id:_.string()}),inject:{project_id:r},execute:async({project_id:a})=>await t.getStorageConfig(a)}),update_storage_config:l({description:"Update the storage config for a Supabase project.",annotations:{title:"Update storage config",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},parameters:_.object({project_id:_.string(),config:_.object({fileSizeLimit:_.number(),features:_.object({imageTransformation:_.object({enabled:_.boolean()}),s3Protocol:_.object({enabled:_.boolean()})})})}),inject:{project_id:r},execute:async({project_id:a,config:s})=>{if(n)throw new Error("Cannot update storage config in read-only mode.");return await t.updateStorageConfig(a,s),ut}})}}var{version:J}=re,gt=["docs","account","database","debugging","development","functions","branching"],Y=["docs"];function Bn(t){let{platform:i,projectId:n,readOnly:r,features:a,contentApiUrl:s="https://supabase.com/docs/api/graphql",onToolCall:c}=t,d=se(s,{"User-Agent":`supabase-mcp/${J}`}),p=gt.filter(S=>Y.includes(S)||Object.keys(i).includes(S)),g=ve(i,a??p);return mt({name:"supabase",title:"Supabase",version:J,async onInitialize(S){let{clientInfo:b}=S,x=`supabase-mcp/${J} (${b.name}/${b.version})`;await Promise.all([i.init?.(S),d.then(T=>T.setUserAgent(x))])},onToolCall:c,tools:async()=>{let S=await d,b={},{account:x,database:T,functions:N,debugging:U,development:F,storage:H,branching:v}=i;return g.has("docs")&&Object.assign(b,Te({contentApiClient:S})),!n&&x&&g.has("account")&&Object.assign(b,pe({account:x,readOnly:r})),T&&g.has("database")&&Object.assign(b,je({database:T,projectId:n,readOnly:r})),U&&g.has("debugging")&&Object.assign(b,Ee({debugging:U,projectId:n})),F&&g.has("development")&&Object.assign(b,Oe({development:F,projectId:n})),N&&g.has("functions")&&Object.assign(b,Ne({functions:N,projectId:n,readOnly:r})),v&&g.has("branching")&&Object.assign(b,de({branching:v,projectId:n,readOnly:r})),H&&g.has("storage")&&Object.assign(b,He({storage:H,projectId:n,readOnly:r})),b}})}async function A(t,i){let n=JSON.stringify(t,(s,c)=>c&&typeof c=="object"&&!Array.isArray(c)?Object.keys(c).sort().reduce((d,p)=>(d[p]=c[p],d),{}):c),r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return btoa(String.fromCharCode(...new Uint8Array(r))).slice(0,i)}function ve(t,i){let n=K.set(ae).parse(new Set(i)),r=[...Y,...$.options.filter(s=>Object.keys(t).includes(s))],a=K.enum(r,{error:s=>{if(s.code==="invalid_value")return`This platform does not support the '${s.input}' feature group. Supported groups are: ${r.join(", ")}`}}).describe("Available features based on platform implementation");return K.set(a).parse(n)}var ft={WEST_US:{code:"us-west-1",displayName:"West US (North California)",location:{lat:37.774929,lng:-122.419418}},EAST_US:{code:"us-east-1",displayName:"East US (North Virginia)",location:{lat:37.926868,lng:-78.024902}},EAST_US_2:{code:"us-east-2",displayName:"East US (Ohio)",location:{lat:39.9612,lng:-82.9988}},CENTRAL_CANADA:{code:"ca-central-1",displayName:"Canada (Central)",location:{lat:56.130367,lng:-106.346771}},WEST_EU:{code:"eu-west-1",displayName:"West EU (Ireland)",location:{lat:53.3498,lng:-6.2603}},WEST_EU_2:{code:"eu-west-2",displayName:"West Europe (London)",location:{lat:51.507351,lng:-.127758}},WEST_EU_3:{code:"eu-west-3",displayName:"West EU (Paris)",location:{lat:2.352222,lng:48.856613}},CENTRAL_EU:{code:"eu-central-1",displayName:"Central EU (Frankfurt)",location:{lat:50.110924,lng:8.682127}},CENTRAL_EU_2:{code:"eu-central-2",displayName:"Central Europe (Zurich)",location:{lat:47.3744489,lng:8.5410422}},NORTH_EU:{code:"eu-north-1",displayName:"North EU (Stockholm)",location:{lat:59.3251172,lng:18.0710935}},SOUTH_ASIA:{code:"ap-south-1",displayName:"South Asia (Mumbai)",location:{lat:18.9733536,lng:72.8281049}},SOUTHEAST_ASIA:{code:"ap-southeast-1",displayName:"Southeast Asia (Singapore)",location:{lat:1.357107,lng:103.8194992}},NORTHEAST_ASIA:{code:"ap-northeast-1",displayName:"Northeast Asia (Tokyo)",location:{lat:35.6895,lng:139.6917}},NORTHEAST_ASIA_2:{code:"ap-northeast-2",displayName:"Northeast Asia (Seoul)",location:{lat:37.5665,lng:126.978}},OCEANIA:{code:"ap-southeast-2",displayName:"Oceania (Sydney)",location:{lat:-33.8688,lng:151.2093}},SOUTH_AMERICA:{code:"sa-east-1",displayName:"South America (S\xE3o Paulo)",location:{lat:-1.2043218,lng:-47.1583944}}},P=Object.values(ft).map(t=>t.code);var Xn=e.object({id:e.string(),name:e.string(),owner:e.string(),created_at:e.string(),updated_at:e.string(),public:e.boolean()}),eo=e.object({fileSizeLimit:e.number(),features:e.object({imageTransformation:e.object({enabled:e.boolean()}),s3Protocol:e.object({enabled:e.boolean()})})}),to=e.object({id:e.string(),name:e.string(),plan:e.string().optional(),allowed_release_channels:e.array(e.string()),opt_in_tags:e.array(e.string())}),no=e.object({id:e.string(),organization_id:e.string(),name:e.string(),status:e.string(),created_at:e.string(),region:e.string()}),oo=e.object({id:e.string(),name:e.string(),project_ref:e.string(),parent_project_ref:e.string(),is_default:e.boolean(),git_branch:e.string().optional(),pr_number:e.number().optional(),latest_check_run_id:e.number().optional(),persistent:e.boolean(),status:e.enum(["CREATING_PROJECT","RUNNING_MIGRATIONS","MIGRATIONS_PASSED","MIGRATIONS_FAILED","FUNCTIONS_DEPLOYED","FUNCTIONS_FAILED"]),created_at:e.string(),updated_at:e.string()}),ht=e.object({id:e.string(),slug:e.string(),name:e.string(),status:e.string(),version:e.number(),created_at:e.number().optional(),updated_at:e.number().optional(),verify_jwt:e.boolean().optional(),import_map:e.boolean().optional(),import_map_path:e.string().optional(),entrypoint_path:e.string().optional()}),ro=ht.extend({files:e.array(e.object({name:e.string(),content:e.string()}))}),ao=e.object({name:e.string(),organization_id:e.string(),region:e.enum(P),db_pass:e.string().optional()}),io=e.object({name:e.string()}),so=e.object({migration_version:e.string().optional()}),co=e.object({name:e.string(),entrypoint_path:e.string(),import_map_path:e.string().optional(),verify_jwt:e.boolean().optional(),files:e.array(e.object({name:e.string(),content:e.string()}))}),po=e.object({query:e.string(),parameters:e.array(e.unknown()).optional(),read_only:e.boolean().optional()}),lo=e.object({name:e.string(),query:e.string()}),uo=e.object({version:e.string(),name:e.string().optional()}),Q=e.enum(["api","branch-action","postgres","edge-function","auth","storage","realtime"]),mo=e.object({service:Q,iso_timestamp_start:e.string().optional(),iso_timestamp_end:e.string().optional()}),go=e.object({types:e.string()}),fo=e.enum(["legacy","publishable"]);export{re as a,ze as b,Xn as c,eo as d,to as e,no as f,oo as g,ht as h,ro as i,ao as j,io as k,so as l,co as m,po as n,lo as o,uo as p,Q as q,mo as r,go as s,fo as t,En as u,On as v,Bn as w};
272
- //# sourceMappingURL=chunk-ZU2DJR27.js.map
272
+ //# sourceMappingURL=chunk-52DDTMJB.js.map