Skip to content

feat(core): launch a local mcp build via SUPABASE_MCP_SERVER_PATH - #193

Merged
barryroodt merged 1 commit into
mainfrom
local-mcp-override
Aug 18, 2026
Merged

barryroodt merged 1 commit into
mainfrom
local-mcp-override

Conversation

@barryroodt

@barryroodt barryroodt commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Stack 1/4 for #128. Base: main. (compare moved out of the chain into #195, parked on #194.)

Re-lands the core of #118 without the submodule, so a workspace can test an unpublished mcp-server-supabase change against the evals without publishing to npm. Carries the review fixes from that thread (canonicalize the base once, receipt-visible mounts) and the tests. Thanks @Rodriguespn.

Set SUPABASE_MCP_SERVER_PATH and createConfig launches that build with node instead of the pinned package with npx. It takes a repo dir, a package dir, or a direct .js/.mjs/.cjs entrypoint, and resolves relative paths against the evals checkout root rather than the process CWD.

Three details worth your attention

These are what the tests pin, and each exists because a CLI agent spawns its MCP server inside the sandbox container, which inherits nothing from the harness process.

  • node, not process.execPath. The host's absolute node path does not exist in-container, so both sides resolve node through PATH.
  • The base is canonicalized once, and the entry derived from it. Docker resolves bind-mount sources against the daemon's view, so command and mount must agree on one filesystem view. Realpathing the entry separately would let a symlinked dist/ resolve outside the mounted directory.
  • The mount covers the build's whole git toplevel, not just dist/, because the build is unbundled and needs its node_modules at runtime.

Hence SandboxMount and supabaseMcpServerMounts(), threaded local-stack-runtime -> agent-environment -> docker-sandbox as --volume host:host:ro. Mounting at the identical real path is what lets one command config work on the host and in the container.

Nothing changes when the var is unset

supabaseMcpServerMounts() returns [], and I checked the config rather than assuming: ran createConfig({apiUrl}) against main and against this branch with the var cleared, and diffed. Identical, matching md5 875658e9…, same npx command and same seven args in the same order.

How to verify

git submodule update --init && pnpm install

# zero cost
pnpm --filter @supabase-evals/core test      # 114/114
pnpm --filter @supabase-evals/sandbox test   # 39 passed, 4 skipped
pnpm typecheck && pnpm format:check

# end to end (costs one agent run): make a visible change to a tool response in
# your mcp checkout, `pnpm install && pnpm build` there, then
SUPABASE_MCP_SERVER_PATH=<mcp-checkout> pnpm eval --eval investigate-db-001-table-row-counts --experiment claude-haiku-4.5

Unset the var and the config is byte-identical to main, which is what the new core tests pin.

Verified

  • core 114/114 (10 new), sandbox 39 passed, 4 skipped (counts after the rebase onto current main)
  • tsc --noEmit and biome check clean

@barryroodt
barryroodt requested a review from a team August 13, 2026 15:27
@vercel

vercel Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
evals Ignored Ignored Preview Aug 18, 2026 8:05am

Request Review

Comment thread packages/core/src/index.ts Resolved
@mattrossman

Copy link
Copy Markdown
Collaborator

Tested by patching search_docs to return a canary string, and confirmed it came through in tools mode and sandbox mode:

  • investigate-db-001-table-row-counts w/ claude-haiku-4.5
  • build-cli-002-declarative-schema w/ claude-code-sonnet-5

Re-lands the core of #118 without the submodule, so a workspace can test an
unpublished mcp-server-supabase change against the evals without publishing to
npm. Includes the review fixes from that thread (canonicalize the base once,
receipt-visible mounts) and the accompanying tests. Thanks @Rodriguespn.

When SUPABASE_MCP_SERVER_PATH is set, createConfig launches that build with
`node` instead of the pinned package with `npx`. It accepts a repo dir, a
package dir, or a direct .js/.mjs/.cjs entrypoint, and resolves relative paths
against the evals checkout root rather than the process CWD.

Three details that are not obvious, and are what the tests pin:

- `node`, not process.execPath. A CLI agent spawns this command INSIDE the
  sandbox container, where the host's node path does not exist. Both sides
  resolve `node` through PATH.
- The base is canonicalized ONCE and the entry derived from it. Docker resolves
  bind-mount sources against the daemon's view, so command and mount must agree
  on one filesystem view; realpathing the entry separately would let a
  symlinked dist/ resolve outside the mounted directory.
- The mount covers the build's whole git toplevel, not just dist/, because the
  build is unbundled and needs its node_modules at runtime.

Hence the new SandboxMount type and supabaseMcpServerMounts(), threaded through
local-stack-runtime -> agent-environment -> docker-sandbox as `--volume
host:host:ro`. Mounting at the identical real path is what lets one command
config work on the host and in the container. Empty when the env var is unset,
so nothing changes for existing runs.

Verified: core 113/113 (10 new), sandbox 39 passed, tsc and biome clean. With
the override unset, createConfig's output is byte-identical to before (same npx
command, same args, same order).
@barryroodt
barryroodt merged commit 16f0e10 into main Aug 18, 2026
7 checks passed
claude Bot pushed a commit that referenced this pull request Aug 18, 2026
Second resolution against upstream; the previous one merged main up to
d5db72e. Five commits landed since: the SUPABASE_MCP_SERVER_PATH local MCP
build support (#193), the AgentDojo-style prompt-injection scenarios (#202),
and three eval-result refreshes (#208, #209, #213).

Two conflicts, both from #193 threading a new `mounts` option through the
sandbox layer alongside this branch's new `agent` option:

- packages/sandbox/src/bare-sandbox.ts — union of both. This branch's named
  `BareSandboxOptions` (required, because `agent` is mandatory) gains
  upstream's `mounts?: readonly SandboxMount[]`, and the import list takes
  `AgentHarnessId` and `SandboxMount`.
- apps/framework/harness/run-eval.ts — the `createBareSandbox` call passes
  both `agent: exp.agent.id` and `mounts: supabaseMcpServerMounts()`.

No new harness landed, so the no-synthetic-prompt gating is unchanged.
apps/web/src/data/ and results/ are taken from main verbatim.

Co-Authored-By: Claude <[email protected]>
mattrossman added a commit that referenced this pull request Nov 17, 2026
## Problem

Teams need a way to test MCP changes with evals locally and verify
findings in CI. So far the [local MCP
override](#193) had no documented
development workflow, and sharing unpublished changes for PR or CI
testing required publishing a preview package and wiring it into an eval
experiment.

## Changes

This updates the contributing guide to explain how to use a local
checkout and share a revision and tweaks the resolution logic. See
[Testing MCP
Changes](https://github.com/supabase/evals/blob/mattrossman/ai-1477-make-mcp-eval-development-easy-to-run/CONTRIBUTING.md#testing-mcp-changes).

As we look towards a future where you can plug in different revisions of
the MCP server, CLI, and docs source code, I've changed the local
override to accept a path to the full MCP repo instead of a package
directory. This keeps package layout out of contributor config and lets
future CLI and docs repo overrides follow the same convention.

```dotenv
# Local clone of https://github.com/supabase/mcp
SUPABASE_MCP_REPO_PATH=../mcp
```

For sharing and CI, experiments can now target an MCP branch, tag, or
commit directly. You can update this broadly across experiments using
the default runtime in `presets.ts`

```ts
// Pin a commit for reproducible runs.
supabaseMcpServer({ revision: 'b0724c9d37e9e74cddd8c79eaf93cdfac9b7523d' })

// Follow a branch while developing.
supabaseMcpServer({ revision: 'feature/my-mcp-change' })
```

The runner builds each revision once per process, mounts the checkout
for container agents, and records the resolved SHA in results and
Braintrust. We can explore optimizations to re-use checkouts across
Sandboxes in follow-ups.

## Verification

I tested roundtrips of eval runs with the new env var locally, and CI
runs with `revision` config for a [a commit SHA
pin](https://github.com/supabase/evals/blob/268ebfd8eadf2c06a6f2932ac05ef77539009ebb/experiments/benchmark/codex-gpt-6-luna.experiment.ts#L13)
and a [branch
reference](https://github.com/supabase/evals/blob/a570ffac4/experiments/benchmark/codex-gpt-6-luna.experiment.ts#L12)
with a [canary
marker](https://github.com/supabase/mcp/blob/b0724c9d37e9e74cddd8c79eaf93cdfac9b7523d/packages/mcp-server-supabase/src/tools/account-tools.ts#L275-L281)
in the MCP `list_projects` source. Both resolved, and the [SHA
trace](https://www.braintrust.dev/app/supabase.io/p/Evals/experiments/benchmark-codex-gpt-6-luna%40268ebfd-20261116T2022Z?r=0beebafb0d70ab3db0b0fb7b3ec20b0d&sid=71921d7f0b0a697b)
and [branch
trace](https://www.braintrust.dev/app/supabase.io/p/Evals/experiments/benchmark-codex-gpt-6-luna%40a570ffa-20261116T2140Z?r=66ab79241ed9179f5e966510a4382077&sid=186685026499c728)
show that build’s marker in the actual `list_projects` response.

| [Resolved MCP
source](https://www.braintrust.dev/app/supabase.io/p/Evals/experiments/benchmark-codex-gpt-6-luna%40a570ffa-20261116T2140Z?r=66ab79241ed9179f5e966510a4382077&sid=f385a3b350f27690)
| [Canary tool
response](https://www.braintrust.dev/app/supabase.io/p/Evals/experiments/benchmark-codex-gpt-6-luna%40268ebfd-20261116T2022Z?r=0beebafb0d70ab3db0b0fb7b3ec20b0d&sid=71921d7f0b0a697b)
|
| --- | --- |
| <img width="1488" height="1296" alt="CleanShot 2026-11-16 at 7 25 34
PM@2x"
src="https://github.com/user-attachments/assets/88b374ac-96be-4424-b06c-2baffd6d191b"
/> | <img width="1466" height="1090" alt="CleanShot 2026-11-16 at 4 22
29 PM@2x"
src="https://github.com/user-attachments/assets/f8620a87-683d-422e-850c-b25b44ace22c"
/> |

Closes AI-1477

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[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.

2 participants