MCP server
Serve the CLI to a coding agent as an MCP server on stdio, read-only by default, with file writes behind the user's consent.
better-supabase mcp runs an MCP server on stdio for the project in the
current directory. Each tool runs one CLI command in process with --json
and returns its result envelope as
structuredContent, so an agent reads the same status, data, error
and next it would get from the shell.
pnpm better-supabase mcpSide effects: Reads the database, writes files with --allow-writes.
This server is for development. To give an agent access to your app's data
as the signed-in user, serve createMcp from the
app instead.
Add it to an agent
In Cursor, add the server to .cursor/mcp.json in the project:
{
"mcpServers": {
"better-supabase": {
"command": "pnpm",
"args": ["exec", "better-supabase", "mcp"]
}
}
}In Claude Code, add it from the project directory:
claude mcp add better-supabase -- pnpm exec better-supabase mcpThe server runs every command in the directory the agent started it in, with
the environment the agent gave it, and the config file and --env it found
at start.
Tools
The read-only tools run by default:
| Tool | Command |
|---|---|
doctor | doctor |
blocks_list | blocks list, with category |
blocks_view | blocks view <block> |
blocks_search | blocks search <text> |
config | config |
config_preset | config --preset |
blocks_installed | blocks list --installed |
gen_check | gen --check |
add_preset_dry_run | add --preset <preset> --dry-run |
--allow-writes adds the tools that write files: gen, upgrade,
add_preset (add --preset, with preset), add
(with blocks) and remove (with blocks).
Confirmation for writes
A write tool never runs on its first call. It returns a confirmation_required
error document, the same one agent mode uses, with a
data.digest and a message to show the user. Once the user agrees, the agent
calls the tool again with the same arguments and effectsDigest set to the
digest. The digest covers only those arguments, so a call with other blocks or
another preset asks again.
{
"status": "action_required",
"reason": "confirmation_required",
"message": "add writes files in /app. Ask the user first, then call add again with effectsDigest \"3f9c0a1b2d4e5f60\".",
"data": { "digest": "3f9c0a1b2d4e5f60" }
}The commands themselves run with agent mode off, so this one confirmation covers the call. No tool forces an overwrite or writes to the database.
Protocol
The server answers initialize for clients on the 2025 revisions and
server/discover for 2026-07-28 clients, then tools/list and
tools/call, one JSON-RPC message per line. The CLI prints its own
messages on stderr, so stdout carries only protocol messages.
Last updated on