Skip to content

create_branch uncallable in project-scoped mode — confirm_cost not exposed #285

Closed

Description

@ocean-views-228

Bug report

Describe the bug

When using the Supabase MCP server in project-scoped mode (recommended security configuration), the branching tools are fully non-functional:

  1. create_branch requires a confirm_cost_id parameter, which can only be obtained from confirm_cost. But confirm_cost (and get_cost) are in the Account Management feature group, which is disabled in project-scoped mode. This makes create_branch uncallable.

  2. list_branches returns the error: "Project reference is missing when validating permissions." This makes the entire branching surface non-functional — even if a branch were created via the dashboard, the MCP cannot see or manage it.merge_branch is presumed to fail the same way.

The branching tools are listed in the Branching feature group, which is documented as available in project-scoped mode. The bug
is that they depend on an account-scoped prerequisite (confirm_cost) that is unavailable in the same mode.

To Reproduce

  1. Connect the Supabase MCP server in project-scoped mode (passing project_ref parameter)
  2. Call list_branches → error: "Project reference is missing when validating permissions"
  3. Attempt to call create_branch → cannot provide required confirm_cost_id parameter because confirm_cost tool is
    not available in project-scoped mode
  4. All branching operations are blocked

Expected behavior

Branching tools should be fully functional in project-scoped mode. Either:

  • Expose get_cost / confirm_cost in project-scoped mode (scoped to the connected project), or
  • Allow create_branch without confirm_cost_id in project-scoped mode (project is already identified, cost is deterministic), or
  • Fix project reference resolution for list_branches / merge_branch in project-scoped connections

Screenshots

N/A — MCP tool calls, not browser UI.

System information

  • OS: N/A (cloud-hosted MCP via Claude.ai)
  • Browser: N/A
  • Version of supabase-js: N/A
  • Version of Node.js: N/A
  • MCP access method: Claude.ai MCP integration
  • Supabase plan: Pro
  • MCP connection mode: project-scoped
  • Region: us-west-2

Additional context

This blocks the staging-branch workflow for MCP-managed migrations. The intended workflow is create_branch → apply_migration on dev branch → verify → merge_branch to production. Without functional branching, migrations must be applied directly to production with no staging validation.

Activity

  1. added
    bug
    on May 15, 2026
  2. kayalopez commented on May 24, 2026

    @kayalopez

    This looks like a good regression target for project-scoped MCP mode because the broken path is not just create_branch; it is the whole migration-staging contract.

    The acceptance checks I would want before marking this fixed:

    • In a project-scoped connection, tools/list exposes only branching tools that are actually callable in that same scope, or the blocked prerequisite is documented in the tool description.
    • list_branches succeeds without a Project reference is missing when validating permissions error.
    • create_branch either does not require confirm_cost_id in project-scoped mode, or a project-scoped get_cost / confirm_cost path is visible and callable.
    • The create branch -> apply migration on dev branch -> verify -> merge branch workflow is covered by one regression test using the same scoped connection.
    • If branching cannot be used, apply_migration should not be treated as a safe fallback to production without an explicit approval gate.

    I made a small client-side checker for this exact shape of failure if it helps people triage their own redacted MCP notes: https://ai-launch-risk-check-public.vercel.app/supabase-mcp-branching-readiness.html

    It does not ask for credentials or call Supabase; it just flags the project-scoped confirm_cost gap, list_branches project-ref errors, and production-migration fallback risk from pasted redacted notes.

  3. luisangelrod commented on Jul 23, 2026

    @luisangelrod

    I traced this against current main and found two separate paths:

    1. list_branches: the repository implementation already injects the scoped project ID. getBranchingTools() passes inject: { project_id } to both create_branch and list_branches. I added a local-only regression test that starts a server with setup({ projectId: project.id }), calls list_branches with {} arguments, and verifies the branch for that project is returned. It passes:
    Test Files  1 passed (1)
    Tests       1 passed | 110 skipped (111)
    

    The exact hosted error text (Project reference is missing when validating permissions) does not occur in this repository. That points to the cloud MCP authorization/gateway or a deployed-version difference, rather than missing injection in branching-tools.ts.

    1. create_branch: the scoped-mode dead end is reproducible from the tool definitions. Project scope removes account tools including get_cost and confirm_cost, while create_branch still requires confirm_cost_id and validates its hash before executing. A scoped client therefore has no exposed route to obtain a valid confirmation ID.

    I can submit the scoped list_branches regression test, but the production fix needs a maintainer decision so the cost guard is not weakened accidentally. Would you prefer:

    • expose a narrowly scoped cost-confirmation path for branching,
    • hide/disable create_branch when project scoped until that path exists, or
    • handle confirmation in the hosted authorization layer?

    If you confirm the intended behavior, I’m happy to implement it with tests.

  4. barryroodt commented on Sep 11, 2026

    @barryroodt
    Contributor

    Thanks for reporting this. We’ve confirmed that, in the legacy workflow, create_branch cannot be called in project-scoped mode because confirm_cost is not exposed. The separate list_branches permission concern has not been assessed.

    We’ve decided not to pursue a fix for the legacy get_cost / confirm_cost workflow, so this branch-creation bug remains unresolved for clients using it. We plan to retire that workflow in favour of MCP elicitations once more clients support them, rather than make further changes to the legacy flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCPbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions