Repository navigation
feat(mcp-server-supabase): add destructive SQL observations - #455
Merged
Merged
Conversation
barryroodt
marked this pull request as ready for review
October 5, 2026 14:50
commit: |
…y-destructive-sql # Conflicts: # scripts/fixtures/packed-platform-consumer/modern-call.mjs
…-observability-lifecycle
…-observability-cost
…-observability-destructive-sql
…-observability-cost
…-observability-destructive-sql
…y-destructive-sql
# Conflicts: # README.md
# Conflicts: # packages/mcp-server-supabase/src/tools/confirmation.ts
…-observability-cost # Conflicts: # README.md
…-observability-destructive-sql
…-observability-cost # Conflicts: # packages/mcp-server-supabase/src/tools/account-tools.ts # packages/mcp-server-supabase/src/tools/branching-tools.ts
…-observability-destructive-sql
barryroodt
added a commit
that referenced
this pull request
Oct 14, 2026
) ## Why Platform measures how Supabase cost confirmations for `create_project` and `create_branch` behave, without shipping payloads. This is part of [AI-1273](https://linear.app/supabase/issue/AI-1273/observability-for-mcp-elicitations-and-requests), building on [#427](#427), with [#455](#455) adding SQL confirmation facts. ## What changed - Supabase owns concrete tool and fact types plus observer aliases, and classifies tools with a `CURRENT_ELICITATION_TOOLS` lookup; `mcp-utils` supplies the generic core. - `create_project` and `create_branch` report confirmation decisions and protected-operation durations that exclude observer recording latency. Consumed responses set the outcome before fact dispatch or changed-quote validation. - Built-in facts contain bounded values without raw arguments, results, state or errors. Custom fact producers remain responsible for privacy. - Existing confirmation behavior stays intact. With no observer, no facts or timings are recorded. ## How to test ```sh pnpm test:packed-platform-consumer ``` All 3 packed-consumer checks pass. ## Trade-offs - Hosts own collection; synchronous observers can block despite failure isolation. - Packed checks don't cover branch or cancellation paths.
…y-destructive-sql # Conflicts: # CONTRIBUTING.md # packages/mcp-server-supabase/src/observation-confirmation.test.ts # packages/mcp-server-supabase/src/observation.ts # packages/mcp-server-supabase/src/tools/account-tools.ts # packages/mcp-server-supabase/src/tools/branching-tools.ts # packages/mcp-server-supabase/src/tools/confirmation.ts # scripts/fixtures/packed-platform-consumer/modern-call.mjs # scripts/fixtures/packed-platform-consumer/types-check.ts
…y-destructive-sql
Merged
Coverage Report for CI Build 38541493789Warning No base build found for commit Coverage: 97.348%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
barryroodt
pushed a commit
that referenced
this pull request
Oct 14, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-utils: 0.9.0</summary> ## [0.9.0](mcp-utils-v0.8.0...mcp-utils-v0.9.0) (2026-10-14) ### Features * **mcp-utils:** add bounded request lifecycle observations ([#427](#427)) ([b11d62b](b11d62b)) </details> <details><summary>mcp-server-supabase: 0.14.0</summary> ## [0.14.0](mcp-server-supabase-v0.13.0...mcp-server-supabase-v0.14.0) (2026-10-14) ### Features * **advisors:** add health advisor support ([#420](#420)) ([8a26508](8a26508)) * **mcp-server-supabase:** add bounded cost lifecycle observations ([#428](#428)) ([657d1f3](657d1f3)) * **mcp-server-supabase:** add destructive SQL observations ([#455](#455)) ([4595698](4595698)) ### Bug Fixes * **mcp:** clarify cost and deploy tool descriptions for OpenAI scanner ([#467](#467)) ([1f9da03](1f9da03)) * **mcp:** stop double cost confirmation on create_project and create_branch ([#468](#468)) ([3c3b1fc](3c3b1fc)) </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>
barryroodt
added a commit
that referenced
this pull request
Nov 23, 2026
…on final (#581) First PR in the stack replacing #454. Base: `main` (1/5). ## Why this changes When `execute_sql` or `apply_migration` asks for confirmation, the client sends a second tool call with the server-issued state and the user’s answer. Today, only **Accept** skips a second SQL classification. If the user clicks **Decline** or **Cancel**, the server checks the SQL again before it honors that answer. The current regex always gives the same answer for the same SQL. The next PR makes the classifier replaceable, so a parser could flag a query on the first call and a fallback could clear it on the second. Today, that would run SQL the user just declined. #455 added observability and a test that captures this behavior. ## What changes The server checks that the signed state is valid and unexpired, then matches it to the current tool, project ID and exact SQL text. For `apply_migration`, the migration name must also match. | Answer for a matching prompt | What the server does | | --- | --- | | Decline or Cancel | Returns the user’s answer immediately. It skips classification and stops before executing the SQL. | | No answer | Asks again, even if the classifier now clears the SQL. In that case, the prompt says “This SQL was flagged for confirmation earlier and still needs your approval.” | | Accept | Runs the SQL, as it does today. | A decline ends that call. The client can still send **Accept** for the same prompt before the state expires. If the client changes the SQL, the earlier answer doesn’t apply to the new query. The server classifies it as before. ## Where to review Start with `checkDestructiveSqlConfirmation`, which decides when to classify the SQL. The updated tests show what happens when the classifier changes its answer or throws after the first prompt. [SQL confirmation handling](https://github.com/supabase/mcp/blob/92be4920a465b507d2efc5196cff252eb9323126/packages/mcp-server-supabase/src/tools/database-operation-tools.ts#L67-L152) · [PR diff and tests](https://github.com/supabase/mcp/pull/581/files) Refs AI-1338
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Platform measures destructive-SQL confirmations for
execute_sqlandapply_migrationalongside cost confirmations. This adds those facts for AI-1273, stacked on #428.What changed
execute_sqlandapply_migrationreport confirmation decisions, successful issuance, consumed responses, resume validation, and backend operations. Supabase owns these concrete facts;mcp-utilsstays generic.The shared SQL gate stages confirmation facts and outcomes, applying outcomes before dispatching facts. A non-destructive bypass discards both. Accepted valid resumes still skip classification, preserving existing SQL policy and cost behavior.
Built-in facts contain finite values and durations without payloads or IDs; custom producers remain responsible for privacy. Outcomes stay independent of fact contents. With no observer, no facts or timings are recorded.
How to test
All 3 packed-consumer checks pass, including ESM/CJS SQL confirmation flows.
Trade-offs