Skip to content

feat(mcp-server-supabase): add optional schemas parameter to generate_typescript_types - #592

Merged
barryroodt merged 1 commit into
supabase:mainfrom
officialbidisha:feat/typegen-schemas
Nov 25, 2026
Merged

barryroodt merged 1 commit into
supabase:mainfrom
officialbidisha:feat/typegen-schemas

Conversation

@officialbidisha

@officialbidisha officialbidisha commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Passes schemas to the Management API as included_schemas. Omitting it sends the same request as before, so the API default (public) still applies.

What kind of change does this PR introduce?

Feature: an expand-only change to tools/list. It adds one new optional input field and changes nothing else.

What is the current behavior?

Closes #597

generate_typescript_types takes no arguments, so it only ever returns the public schema. Objects in other schemas (an app schema, storage, etc.) can't be typed through the MCP, and the tool description doesn't mention the limit.

The Management API already supports this: GET /v1/projects/{ref}/types/typescript?included_schemas=public,app returns both schemas, and included_schemas is already in the generated client types (src/management-api/types.ts).

What is the new behavior?

  • New input: schemas: string[], optional, at least 1 item, each name non-empty. It's described as "Defaults to ["public"] when omitted".
  • When schemas is given: the request adds included_schemas=<comma-joined>.
  • When it's omitted: the request is identical to today's, with no query param.
  • Platform: DevelopmentOperations.generateTypescriptTypes(projectId, options?) gains an optional GenerateTypescriptTypesOptions argument. Existing implementers and callers still compile.

How to Review

Review area

packages/mcp-server-supabase/src/tools/development-tools.ts

  • The schemas input schema and its description.
  • The top-level tool description is unchanged.
  • execute passes { schemas } through.

Next review area

packages/mcp-server-supabase/src/platform/api-platform.ts

  • generateTypescriptTypes adds query.included_schemas only when schemas is present (...(schemas && { query: ... })).

Next review area

packages/mcp-server-supabase/src/platform/types.ts

  • The new exported GenerateTypescriptTypesOptions, and the optional second parameter on DevelopmentOperations.generateTypescriptTypes.

Next review area

packages/mcp-server-supabase/test/mocks.ts

  • The new mock handler for GET /v1/projects/:projectId/types/typescript, which echoes included_schemas (or (not sent)).

Tests

src/server.development.test.ts, describe('generate_typescript_types'):

  • No schemas: no included_schemas query param is sent. This protects the existing default behavior.
  • ['public', 'mcp_types']: included_schemas=public,mcp_types is sent.
  • []: rejected as invalid arguments.
  • tools/list: schemas is an optional array (not in required, minItems: 1, string items with minLength: 1).

Review questions

  • Is the public contract minimal and intentional? It adds one optional field and leaves the optionality of existing fields untouched, following the CONTRIBUTING "expand" pattern. Because it changes published input-schema metadata, a later ChatGPT plugin resubmission will pick it up.
  • Do the main execution paths preserve existing behavior? Without schemas, the request is byte-for-byte the same as before.
  • Do failures stop safely? Invalid input (an empty list or empty names) is rejected before any API call. API errors use the existing assertSuccess path.
  • Do tests protect observable behavior rather than implementation details? Yes. They assert the query string actually sent to the API and the advertised input schema.

Verification

From the repo root, on this branch (base main at efe189f):

pnpm --filter @supabase/mcp-server-supabase typecheck
pnpm exec biome check packages
pnpm --filter @supabase/mcp-server-supabase test:unit --run
# Test Files  35 passed (35)
#      Tests  935 passed (935)

Live check against a real project with pnpm dev:http:

{}                                  -> public only; no other schemas (unchanged)
{"schemas":["public","storage"]}    -> output includes `storage: {`
{"schemas":["public","mcp_types"]}  -> output includes `mcp_types: { Tables: { things ... } Enums: { color: "red" | "green" } }`
{"schemas":[]}                      -> isError, too_small at path ["schemas"]

The change was written with AI assistance (Claude Code). I reviewed the diff and re-ran the commands above.

Additional context

  • Schema names are joined with , to match the API's included_schemas format, so a schema name containing a comma isn't supported. That's the API's limitation.
  • Separately, while testing I saw upstream typegen emit unknown for domains used inside composite types and function signatures, even though the same domains resolve correctly on table columns. The raw Management API output is identical, so that's a postgres-meta issue, not part of this PR.

Generated with Claude Code

…_typescript_types

Passes schemas to the Management API as included_schemas. Omitting it sends the same request as before, so the API default (public) still applies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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.

Thanks for this, and for checking it against a real project! The schemas name matches list_tables, and I confirmed the public default on the API side.

@barryroodt
barryroodt merged commit 7532f53 into supabase:main Nov 25, 2026
5 of 7 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 25, 2026
barryroodt pushed a commit that referenced this pull request Nov 26, 2026
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_typescript_types: add optional schemas (included_schemas) parameter

2 participants