Skip to content

feat(mcp): hide legacy cost tools from form-capable clients - #411

Merged
barryroodt merged 4 commits into
mainfrom
feat/hide-legacy-cost-tools
Sep 4, 2026
Merged

feat(mcp): hide legacy cost tools from form-capable clients#411
barryroodt merged 4 commits into
mainfrom
feat/hide-legacy-cost-tools

Conversation

@mattrossman

@mattrossman mattrossman commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Makes tools/list adapt to costConfirmation.enabledTools to prevent supported clients from getting prompted twice, from both the legacy tools and elicitation strategy, surfaced when testing https://github.com/supabase/platform/pull/37717

The tools callback now receives the per-request ServerContext so tools/list can vary by client:

  • If both create_project and create_branch are in costConfirmation.enabledTools, get_cost and confirm_cost are no longer advertised. They stay callable, so a client that already knows the names keeps working.
  • If only one create_ tool is enabled, the two cost tools are still advertised because the other create_ tool still needs a confirm_cost_id, but their type argument is narrowed.
  • create_project and create_branch drop confirm_cost_id when they're in enabledTools, since a form-capable client confirms inline and never needs it.

Legacy clients are unaffected.

How to review

Run the server over HTTP w/ costConfirmation enabled for both tools and connect a form-capable client (e.g. Claude Code w/ the SDK v2 flag as described here). The tool list should have no get_cost or confirm_cost, and create_project no longer has a confirm_cost_id argument. Connect again without declaring elicitation and both tools are back.

Notes

I renamed the test helper setupFormCapable to setupModern and made its capabilities explicit via a FORM_CAPABLE constant, because technically legacy clients can have form capabilities.

The #391 test "a supplied confirm_cost_id cannot bypass the form" is now "is rejected". The field isn't in a form-capable client's schema anymore, so strict arg parsing errors instead of routing to the form.

@coveralls

coveralls commented Sep 3, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 33806422877

Coverage increased (+0.05%) to 96.549%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: 38 of 38 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3426
Covered Lines: 3324
Line Coverage: 97.02%
Relevant Branches: 486
Covered Branches: 453
Branch Coverage: 93.21%
Branches in Coverage %: Yes
Coverage Strength: 60.14 hits per line

💛 - Coveralls

Comment thread packages/mcp-server-supabase/src/server.ts Outdated
Comment thread packages/mcp-server-supabase/src/server.test.ts
@mattrossman
mattrossman marked this pull request as ready for review September 3, 2026 21:18
@mattrossman
mattrossman requested a review from a team as a code owner September 3, 2026 21:18

@barryroodt barryroodt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for scoping the omit loop, reads clearly now.

@barryroodt barryroodt added the publish-preview Runs `publish-preview` workflow to publish preview packages via https://pkg.pr.new/ label Sep 4, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@supabase/mcp-server-postgrest@f53073a
pnpm add https://pkg.pr.new/@supabase/mcp-server-supabase@f53073a
pnpm add https://pkg.pr.new/@supabase/mcp-utils@f53073a

commit: f53073a

@barryroodt
barryroodt merged commit 2f04461 into main Sep 4, 2026
8 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Sep 3, 2026
barryroodt pushed a commit that referenced this pull request Sep 4, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-utils: 0.8.0</summary>

##
[0.8.0](mcp-utils-v0.7.0...mcp-utils-v0.8.0)
(2026-09-04)


### Features

* **mcp:** add project cost confirmation elicitation
([#391](#391))
([fb50882](fb50882))
* **mcp:** hide legacy cost tools from form-capable clients
([#411](#411))
([2f04461](2f04461))
</details>

<details><summary>mcp-server-supabase: 0.12.0</summary>

##
[0.12.0](mcp-server-supabase-v0.11.0...mcp-server-supabase-v0.12.0)
(2026-09-04)


### Features

* group lints in `get_advisors` response
([#390](#390))
([48d593a](48d593a))
* **mcp:** add branch cost confirmation elicitation
([#394](#394))
([867a160](867a160))
* **mcp:** add project cost confirmation elicitation
([#391](#391))
([fb50882](fb50882))
* **mcp:** hide legacy cost tools from form-capable clients
([#411](#411))
([2f04461](2f04461))


### Bug Fixes

* ensure correct escaping in advisor
([#407](#407))
([a6cf4a0](a6cf4a0))
* make server instructions intent-based instead of naming tools
([#372](#372))
([fc54ea2](fc54ea2))
</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 Sep 4, 2026
Brings in #411 (ctx-aware tools(), hidden get_cost/confirm_cost and
confirm_cost_id omission for form-capable clients) and the 0.12.0 release.
Conflicts resolved so #411's per-request tool shaping runs under the renamed
`confirmation` option; #408's tests migrated from setupFormCapable to
setupModern with explicit FORM_CAPABLE capabilities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

publish-preview Runs `publish-preview` workflow to publish preview packages via https://pkg.pr.new/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants