Skip to content

fix(mcp-server-supabase): detect deno.jsonc as the default edge function import map - #559

Merged
Rodriguespn merged 4 commits into
supabase:mainfrom
officialasishkumar:fix/deploy-edge-function-deno-jsonc
Nov 17, 2026
Merged

Rodriguespn merged 4 commits into
supabase:mainfrom
officialasishkumar:fix/deploy-edge-function-deno-jsonc

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Fixes #558.

When deploy_edge_function is called without import_map_path and the function has no existing import map, the server guesses one from the uploaded file names. The guess only matches deno.json and import_map.json. A function configured through deno.jsonc therefore deploys with no import map, and its imports are dropped, even though the files description tells agents to include deno.jsonc. When several matching files are present, the first one in files wins, so the result depends on array order.

What is the new behavior?

The default import map is chosen by a fixed precedence: deno.json, then deno.jsonc (as supabase functions deploy does), then the legacy import_map.json. File order no longer matters. An explicit import_map_path still wins, and so does the import map of an existing function. No tool metadata changes.

How to Review

  1. Import map selection

    • packages/mcp-server-supabase/src/platform/api-platform.ts
    • deployEdgeFunction now calls getDefaultImportMapPath, which walks DEFAULT_IMPORT_MAP_FILENAMES in order. Fallback order (explicit → existing → heuristic) is unchanged.
  2. Tests

    • packages/mcp-server-supabase/src/server.functions.test.ts
    • A deno.jsonc-only deploy gets import_map_path ending in deno.jsonc. With import_map.json, deno.jsonc and deno.json passed in that order, deno.json is chosen.

Review questions

  • Should import_map.json stay as the last fallback? This PR keeps it for backward compatibility.
  • Do the main execution paths preserve existing behavior?
  • Do tests protect observable behavior rather than implementation details?

Verification

Run on Node 24.22.3 / pnpm 10.34.9 after pnpm run build:

  • pnpm --filter @supabase/mcp-server-supabase test:unit --run: 34 files, 915 tests passed.
  • With the api-platform.ts change reverted, test:unit --run src/server.functions.test.ts -t "import map" fails both new tests; the three existing import-map tests still pass.
  • pnpm typecheck in packages/mcp-server-supabase and biome check on both changed files: clean.

Additional context

Supabase CLI reference for the precedence: apps/cli/src/shared/functions/deploy.ts in supabase/cli checks deno.json, then deno.jsonc.

…ion import map

When deploy_edge_function is called without import_map_path and the
function has no existing import map, the server falls back to a file-name
heuristic. That heuristic only matched deno.json and import_map.json, so a
function configured through deno.jsonc deployed with no import map and its
`imports` were silently dropped, even though the tool's `files` description
tells agents to include deno.jsonc. The heuristic also used whichever
matching file came first in `files`, so the chosen map depended on the
order the agent listed them in.

Pick the default with a fixed precedence instead: deno.json, then
deno.jsonc (matching the Supabase CLI), then the legacy import_map.json.
An explicit import_map_path and a previously deployed import map still
take priority, as before.

Adds tests for a deno.jsonc-only deploy and for deno.json winning over
deno.jsonc and import_map.json regardless of file order.

Fixes supabase#558
@officialasishkumar
officialasishkumar requested a review from a team as a code owner November 15, 2026 11:13

@Rodriguespn Rodriguespn 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 fix and for contributing, @officialasishkumar! We'll merge this.

Rodriguespn and others added 3 commits November 17, 2026 19:35
…./platform

Move the deno.json / deno.jsonc / import_map.json precedence logic into
src/platform/import-map.ts and export DEFAULT_IMPORT_MAP_FILENAMES and
getDefaultImportMapPath from the `@supabase/mcp-server-supabase/platform`
entrypoint so the hosted MCP server can reuse it instead of keeping a copy.

Builds on the fix from supabase#559 (credit to Asish Kumar).

Refs AI-1500

Co-authored-by: Asish Kumar <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…o edge-function.ts

Fold DEFAULT_IMPORT_MAP_FILENAMES and getDefaultImportMapPath into the existing
edge-function module and its test file instead of a separate import-map module.
The ./platform entrypoint re-exports them from there.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Rodriguespn
Rodriguespn merged commit 16bde19 into supabase:main Nov 17, 2026
4 of 5 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Nov 17, 2026
Rodriguespn pushed a commit that referenced this pull request Nov 20, 2026
🤖 I have created a release *beep* *boop*
---


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

##
[0.19.0](mcp-server-supabase-v0.18.0...mcp-server-supabase-v0.19.0)
(2026-11-19)


### Features

* **mcp apps:** create project and create branch ui
([#573](#573))
([a4e8c43](a4e8c43))


### Bug Fixes

* **mcp-server-supabase:** detect deno.jsonc as the default edge
function import map ([#559](#559))
([16bde19](16bde19))
</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 ignores deno.jsonc when choosing a default import map

2 participants