← Back to Pull requests

feat(mcp): add project cost confirmation elicitation #391

Closed
unknown closed this pull request without merging on Sep 03, 2026 08:03 UTC
View on GitHub
unknown unknown commented on Aug 28, 2026 19:41 UTC
Author

What kind of change does this PR introduce?

Feature.

Implements the create_project slice of AI-1091.

What is the current behavior?

create_project requires a valid confirm_cost_id before execution. Clients without elicitation capability keep this flow.

What is the new behavior?

When costConfirmation is configured with enabledTools: ['create_project'], form-capable clients can confirm the quoted cost inside create_project through the SDK-native inputRequired and inputResponse flow. The signed request state binds the method and authenticated principal, and carries tool: 'create_project', the project name, region, organization, and quoted cost.

The form has no properties. Consent lives in the elicitation action, so clients use their native accept, decline, and cancel controls. Accept creates the project. Decline or cancel returns a normal result without creating anything.

Argument mismatches are rejected, and cost drift starts confirmation again. A state signed for the wrong tool fails before argument or acceptance checks. Empty elicitation mode maps count as form-capable; URL-only or absent elicitation uses the legacy confirm_cost flow. A precomputed legacy ID cannot bypass confirmation for a form-capable request.

This PR covers create_project only. It does not change stdio, and there is no create_branch implementation in this PR.

How to Review

1. Server setup
- packages/mcp-server-supabase/src/server.ts
- Inspect how costConfirmation, its enabledTools, and request state enter the server.

2. Confirmation flow and executor seam
- packages/mcp-server-supabase/src/tools/cost-confirmation.ts, packages/mcp-server-supabase/src/tools/account-tools.ts, packages/mcp-server-supabase/src/tools/util.ts, and packages/mcp-utils/src/server.ts
- Inspect the private module that owns the project state discriminator, action-only schema, and capability helper, plus signed state, project creation behavior, request-state verification, and SDK result passthrough.

3. Behavioral coverage
- packages/mcp-server-supabase/src/server.test.ts
- Inspect the modern and legacy paths.

  • Does capability detection select the right lane?

  • Is signed state bound to the right request, tool, and principal?

  • Do decline and cancel avoid project creation?

  • Does the legacy flow remain strict?
  • Verification

  • pnpm --filter @supabase/mcp-server-supabase test src/server.test.ts -t "create_project cost confirmation via elicitation" passed 8 tests.

  • pnpm --filter @supabase/mcp-server-supabase build passed.

  • pnpm test:packed-platform-consumer passed all 3 public-surface assertions.

  • biome ci . passed.
  • Additional context

    This is a fresh, project-only implementation separate from the earlier draft in #389.

    When confirmation is configured, the public schema makes confirm_cost_id optional so form-capable clients can call create_project directly. Capability-free execution still requires a valid ID.

    Known limits remain: signed state has no single-use replay prevention, and the existing final cost-check concurrency race remains.

    The platform PR will first pin the pkg.pr.new preview, then switch to the released npm version.

    This implementation was AI-assisted. The verification evidence is above, and human review is required before merge.

    Diff: 440 lines (+330 / -110) across 5 files Reviewer: gregnr Review duration: 7942m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 440 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.364
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #391"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.3% (MEDIUM) · Higher = larger blast radius
    45.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.9% · Safe to merge
    17.9%
    Repository