Repository navigation
fix(mcp-server-supabase): skip cost confirmation for $0 projects on clients without forms - #608
Conversation
…lients without forms
Coverage Report for CI Build 45603159969Coverage increased (+0.004%) to 98.36%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
barryroodt
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
| // Legacy clients only: form-capable clients returned above. Without | ||
| // this, a missing ID would hit the opaque hash-mismatch error below. | ||
| // Legacy clients only: form-capable clients returned above. | ||
| const cost = await getNextProjectCost(account, organization_id); |
There was a problem hiding this comment.
Could we hoist getNextProjectCost and a single if (cost.amount === 0 && !ctx.mcpReq.requestState<unknown>()) bypass above if (confirmation && isFormCapable(ctx))? That avoids duplicating the $0 block and keeps the !state guard in both lanes so a declined requestState retry can't slip through if the quote drops to $0.
| // Legacy clients only: form-capable clients returned above. | ||
| const cost = await getNextProjectCost(account, organization_id); | ||
| if (cost.amount === 0) { | ||
| observation?.record({ |
There was a problem hiding this comment.
Recording bypass / zero_cost here widens the meaning of mcp_observer_confirmation_decisions_total{route="bypass", reason="zero_cost"} in platform from form-capable clients only to all lanes (there's no client/era label on that counter). Would be good to add a legacy $0 assertion in observation-confirmation.test.ts to pin this behavior, and flag the metric semantics change if anything tracks form-capable bypasses separately.
| @@ -787,6 +793,66 @@ describe('tools', () => { | |||
| ]); | |||
There was a problem hiding this comment.
Small test catch just above this hunk (server.account.test.ts:726): capability-free client still succeeds via get_cost -> confirm_cost -> create_project uses a free org ($0), so it now hits the bypass and no longer exercises confirm_cost_id verification. Might be worth moving it to createOrganizationWithBillableNextProject() + PROJECT_COST_MONTHLY, same as the server.functions.test.ts update.
Rodriguespn
left a comment
There was a problem hiding this comment.
@barryroodt already approved, so leaving these notes here as non-blocking suggestions regardless.
Worth noting for rollout: on remote MCP, confirm_cost_id is only optional when EnableMcpCostConfirmationElicitation is enabled and create_project isn't in skip_elicitations, so users with that flag off will still hit Zod validation before reaching this bypass.
Thanks, yeah that's intentional for now, this covers the flag-on path where all the |
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-utils: 0.11.1</summary> ## [0.11.1](mcp-utils-v0.11.0...mcp-utils-v0.11.1) (2026-11-26) ### Bug Fixes * **mcp-ui:** shared project card for create-project and create-branch ([#578](#578)) ([efe189f](efe189f)) </details> <details><summary>mcp-server-supabase: 0.20.0</summary> ## [0.20.0](mcp-server-supabase-v0.19.0...mcp-server-supabase-v0.20.0) (2026-11-26) ### Features * **debugging:** add project issues DEBUG-311 ([#546](#546)) ([01f8021](01f8021)) * **mcp-server-supabase:** add optional schemas parameter to generate_typescript_types ([#592](#592)) ([7532f53](7532f53)) ### Bug Fixes * **debugging:** link docs once per issue in get_issues ([#610](#610)) ([74801d8](74801d8)) * **mcp-server-supabase:** detect import maps uploaded with a ./ prefix ([#591](#591)) ([6b8f4dc](6b8f4dc)) * **mcp-server-supabase:** keep a declined or cancelled SQL confirmation final ([#581](#581)) ([03afe8e](03afe8e)) * **mcp-server-supabase:** match Studio's notebook row_limit and clarify skip and blank-input messages ([#593](#593)) ([ad07f1b](ad07f1b)) * **mcp-server-supabase:** skip cost confirmation for $0 projects on clients without forms ([#608](#608)) ([50cfc37](50cfc37)) * **mcp-server-supabase:** stop reusing a removed import map on edge function redeploy ([#588](#588)) ([56093a6](56093a6)) * **mcp-ui:** shared project card for create-project and create-branch ([#578](#578)) ([efe189f](efe189f)) * **mcp:** confirm UPDATEs without WHERE that follow a comment and set a dollar-quoted value ([#612](#612)) ([468907a](468907a)) * **mcp:** confirm UPDATEs without WHERE that use inheritance syntax ([#565](#565)) ([687b3ee](687b3ee)) * **mcp:** confirm UPDATEs without WHERE when a column name ends in where ([#557](#557)) ([57fa34b](57fa34b)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
A free org on a client without form support (ChatGPT and most others) has to "confirm" a $0 project:
create_projectfails with "first confirm the cost"get_costreturns $0confirm_costwith $0create_projectagain with the ID, and it worksSome agents get lost in that loop. In the last 3 weeks about 4.5K users never got a project because of it. It also logs ~26K
confirmation_requirederrors a week, 89% of them on free orgs where the cost is $0.Form-capable clients already skip confirmation when the cost is $0.
What is the new behavior?
Clients without forms get the same rule: if the next project costs $0,
create_projectcreates it on the first call. Paid projects still needconfirm_cost_id, unchanged.If cost confirmation isn't configured, the schema still requires
confirm_cost_id, so that path doesn't change.How to Review
Legacy path in
create_projectpackages/mcp-server-supabase/src/tools/account-tools.tsconfirm_cost_idchecks, and recordsbypass/zero_costlike the form-capable path.Tests
packages/mcp-server-supabase/src/server.account.test.ts: new $0 cases (no ID, stale ID). The mismatch test moved to a paid org.packages/mcp-server-supabase/src/server.functions.test.ts: the URL-only legacy-lane test moved to a paid org, so it still exercises the confirmation steps.Review questions
confirm_cost_idis ignored when the cost is $0? Same as the form-capable path.Verification
CI=1 pnpm vitest run --project unit src/inpackages/mcp-server-supabase: 976 passedtsc --noEmitandbiome checkare cleanpnpm dev:http --api-url https://api.supabase.greenand connected MCP Inspector without--protocol-era modern, so it's treated as a client without forms.confirm_cost_idshows as optional. Calledcreate_projecton a free org with noconfirm_cost_id, and the project was created on the first call (ACTIVE_HEALTHY).