Skip to content

fix(mcp-server-supabase): detect import maps uploaded with a ./ prefix - #591

Merged
barryroodt merged 1 commit into
supabase:mainfrom
Heman10x-NGU:fix/default-import-map-dot-slash
Nov 24, 2026
Merged

barryroodt merged 1 commit into
supabase:mainfrom
Heman10x-NGU:fix/default-import-map-dot-slash

Conversation

@Heman10x-NGU

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix.

What is the current behavior?

Fixes #590

On a first deploy with no import_map_path, deploy_edge_function looks for deno.json, deno.jsonc, or import_map.json in the uploaded files. It compares names exactly, so ./deno.json is not found and the function deploys with no import map.

With import_map.json and ./deno.jsonc uploaded together, it also picks import_map.json instead of ./deno.jsonc.

What is the new behavior?

Names are compared after normalize from node:path/posix, so ./deno.json matches deno.json. The order stays deno.json, then deno.jsonc, then import_map.json. Files in a subfolder, such as lib/deno.json, are still not picked.

The function returns the name as the caller sent it (./deno.json, not deno.json), so import_map_path is always the name of an uploaded file.

How to Review

  1. The fix

    • packages/mcp-server-supabase/src/edge-function.ts
    • getDefaultImportMapPath matches on the normalized name and returns the original name. Its only caller is deployEdgeFunction in src/platform/api-platform.ts, which is unchanged.
  2. Tests

    • packages/mcp-server-supabase/src/edge-function.test.ts
    • ./ names for all three files, the order with ./ names, a mix of bare and ./ names, and ./lib/deno.json not being picked.

Review questions

  • Should the returned path be the name as sent (./deno.json) or the cleaned name (deno.json)?
  • normalize also turns lib/../deno.json into deno.json. Is matching that fine, or should only a leading ./ be stripped?
  • If both deno.json and ./deno.json are uploaded, the one listed first is returned. Is that fine?
  • Is a helper test enough, or do you want a deploy test in src/server.functions.test.ts too?

Verification

From the repo root, on Node 24.22.3:

pnpm --filter @supabase/mcp-server-supabase test:unit --run
pnpm --filter @supabase/mcp-server-supabase typecheck
pnpm format:check
  • With the change: 35 files, 936 tests passed.
  • With only edge-function.ts reverted to main, src/edge-function.test.ts has 5 failed and 15 passed. The 5 failures are the new ./ cases.
  • typecheck and format:check: clean.

Not tested: a deploy with this build to a hosted project. The tests use the repo's mock API.

Additional context

What hosted users see today, checked on 2026-11-21 on a test project through the hosted server at mcp.supabase.com: a first deploy of a new function sent index.ts, greeting.ts, and ./deno.json (its imports map greeting to ./greeting.ts), with no import_map_path. It returned import_map: false and no import_map_path. The hosted server runs different code from this repo's main for the Edge Function tools, so this shows the bug as users meet it. It does not test this branch.

@Heman10x-NGU
Heman10x-NGU requested a review from a team as a code owner November 21, 2026 20:58

@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 the clear write-up!

@barryroodt
barryroodt merged commit 6b8f4dc into supabase:main Nov 24, 2026
5 of 7 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 24, 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.

deploy_edge_function misses an import map named ./deno.json on first deploy

2 participants