Supabase MCP server: setup, safe defaults and which to pick
T. Krause ·
Supabase MCP is Supabase's hosted MCP server at https://mcp.supabase.com/mcp. Add that URL to Claude Code, Cursor, VS Code or Codex, sign in to Supabase in the browser and pick the organization that holds your project. The agent can then list tables, run SQL, apply migrations, read logs and deploy Edge Functions in the projects your account can reach. To keep it to one project and read-only SQL, add ?project_ref=<id>&read_only=true to the URL.
That covers your own projects in a coding agent. Supabase's docs also say not to hand the server to your customers, because it runs with your developer permissions. If you are building an agent that connects to other people's Supabase accounts, or one that uses Supabase next to GitHub and Slack, you need a different setup. The second half of this guide covers that case with Prompt TM. The Supabase details below come from supabase.com/docs and Supabase's GitHub as of November 2026.
Three things a search for "Supabase MCP" can mean
Supabase's own server. This is the hosted server above, built so your coding agent can work on your Supabase projects. Per Supabase's MCP docs, it connects "your AI tools to Supabase", and assistants "can interact with and query your Supabase projects on your behalf". Its source is at github.com/supabase/mcp.
An MCP server you deploy on Supabase. If your app's own users should reach your app's data from Claude or ChatGPT, Supabase has a separate guide to deploying MCP servers on Edge Functions. With Supabase Auth in front, "every tool call runs as that user under your Row Level Security (RLS) policies". Supabase notes that this "is the MCP server your app exposes to its users" and differs from the Supabase MCP server. This guide doesn't cover it.
A tool layer between your agent and Supabase. Prompt TM stores each person's Supabase access token and serves Supabase tools at one MCP URL, next to the other apps the agent uses. That is the last part of this guide.
Set up Supabase's server in your client
Every client takes the same URL. On the first call it sends you to Supabase to sign in and grant access. Supabase's README asks you to "choose the organization that contains the project you wish to work with".
Claude Code. Supabase's docs add the server to the project's config:
claude mcp add --scope project --transport http supabase "https://mcp.supabase.com/mcp"
Then run claude /mcp in a regular terminal, not the IDE extension, select supabase and choose Authenticate. The --scope project flag writes the server to .mcp.json in the repository, so everyone who clones it gets the server and signs in with their own Supabase account. What the other scopes do is in Claude Code MCP server setup.
Cursor. Put this in .cursor/mcp.json, or in ~/.cursor/mcp.json to use it in every project:
{
"mcpServers": {
"supabase": { "url": "https://mcp.supabase.com/mcp" }
}
}
VS Code. Use .vscode/mcp.json, with the server under servers and "type": "http".
Codex. Run codex mcp add supabase --url "https://mcp.supabase.com/mcp", then codex mcp login supabase.
Claude.ai and ChatGPT. Supabase is a connector in each one's directory. Install it there.
To check the connection, Supabase suggests asking: "What tables are there in the database? Use MCP tools." If you run Supabase locally with the Supabase CLI, the server is at http://localhost:54321/mcp. There it has fewer tools and no OAuth sign-in.
Narrow the server before the first prompt
Without parameters, the server isn't tied to one project. Supabase's docs list three URL parameters that narrow it.
| Parameter | What it does |
|---|---|
project_ref=<id> | Limits the server to one project. This also turns off the account tools, such as listing, creating and pausing projects |
read_only=true | Runs every SQL query "as a read-only Postgres user" |
features=<groups> | Turns on only the tool groups you name, for example database,docs |
They combine. For one project, read-only, with only the database and docs tools:
claude mcp add --scope project --transport http supabase \
"https://mcp.supabase.com/mcp?project_ref=your-project-ref&read_only=true&features=database,docs"
Replace your-project-ref with your project's ref. Supabase's README also points to an MCP tab in the dashboard that builds this URL for you.
The tool groups are Database, Debugging, Development, Edge Functions, Account management, Docs, Branching, Feedback, Storage and Notebooks. Storage is off unless you enable it. Branching is marked experimental and needs a paid plan.
The reason to narrow it is prompt injection. Supabase's docs give an example. A customer files a support ticket whose text tells the model to select everything from a sensitive table and post it as a reply. A developer later asks Cursor to read that ticket through Supabase MCP, and the model tries to follow the instructions in it. Supabase wraps SQL results with instructions that tell the model not to follow commands found in the data, and says this "is not foolproof". Its advice:
- Keep your client's manual approval of tool calls on, and review each call.
- Connect to production only when the task needs production data, and then with project scoping and read-only mode.
- Run unattended routines in read-only mode, and approve in advance only the project-scoped, read-only tools they need.
- Test schema changes on a branch before merging them.
Some clients also show confirmation forms from the server. execute_sql and apply_migration ask before running SQL that Supabase classifies as destructive, and create_project and create_branch show the cost first. Supabase calls these a guardrail that "may not catch every destructive operation and is not a security guarantee". The forms only appear when your client supports them.
Run it without a browser
In CI, or anywhere OAuth can't open a browser, Supabase's docs send a personal access token in the Authorization header instead:
{
"mcpServers": {
"supabase": {
"type": "http",
"url": "https://mcp.supabase.com/mcp?project_ref=${SUPABASE_PROJECT_REF}",
"headers": {
"Authorization": "Bearer ${SUPABASE_ACCESS_TOKEN}"
}
}
}
}
SUPABASE_ACCESS_TOKEN and SUPABASE_PROJECT_REF are environment variables in the CI job, so neither value is committed. Not every MCP client supports custom headers.
Make the token a scoped one. Per Supabase's access token docs, you scope a token to organizations, projects and permissions when you create it, and tokens made in the dashboard are scoped by default. A full-access token shows a Legacy badge. It "carries every permission on every organization and project you belong to, including ones you create or join later". A scoped token starts with sbp_fc. Each MCP tool needs a permission: list_tables and execute_sql need Database (Read), apply_migration needs Migrations (Read-write), and a tool whose permission the token lacks can't be called.
Who the server is for
One of Supabase's security recommendations reads: "The MCP server operates under the context of your developer permissions, so you should not give it to your customers or end users." The server is a developer tool for your own projects.
| You want | Use |
|---|---|
| Claude Code, Cursor or Codex working on your own Supabase projects | Supabase's hosted server with OAuth, scoped to a project |
| A CI job or headless script on your own project | Supabase's hosted server with a scoped access token |
| Your app's end users reaching their own data under RLS | An MCP server you deploy on Supabase Edge Functions |
| An agent you run for other developers, each with their own Supabase account, or Supabase next to other apps with your own approvals and logs | Supabase's Management API behind a server that keeps the tokens (below) |
The last row fits a coding platform whose users connect their own Supabase accounts, or an internal ops agent that checks project health and also files the GitHub issue. Each user's token has to live somewhere other than the agent's config. The agent has to pick the right token per call, and a person should see a write before it runs.
Connect Supabase to Prompt TM
Prompt TM serves Supabase tools at one MCP URL, alongside any other toolkits in the project. It calls Supabase's Management API at api.supabase.com/v1, not Supabase MCP, with a token it stores encrypted. The agent calls a tool such as SUPABASE_LIST_PROJECTS, Prompt TM adds the token to the request, and the agent never sees the token.
The Supabase toolkit takes a personal access token, sent as a bearer token. There is no Supabase OAuth sign-in on Prompt TM today, so each person creates a token under Account → Access Tokens in Supabase and hands it over through the steps below. Scope that token as described above. Prompt TM checks a new token by listing the organizations it can reach. With the Organizations permission (Read), the account shows the organization's name. A scoped token without that permission still connects and shows as "Scoped access token", so grant only the permissions your tools need, listed in the table below. A token Supabase doesn't recognize, or one you revoked, fails the check.
1. Add an auth config for Supabase. In the dashboard, open Auth configs → New, choose Supabase and Access token. Or with the API:
curl -X POST https://www.prompt-tm.com/api/v3/auth_configs \
-H "x-api-key: $PROMPT_TM_KEY" -H "content-type: application/json" \
-d '{ "toolkit": { "slug": "supabase" }, "auth_config": { "auth_scheme": "BEARER_TOKEN" } }'
2. Connect an account. With your own token:
curl -X POST https://www.prompt-tm.com/api/v3/connected_accounts \
-H "x-api-key: $PROMPT_TM_KEY" -H "content-type: application/json" \
-d '{ "auth_config": { "id": "ac_..." }, "user_id": "me",
"connection": { "data": { "token": "sbp_..." } } }'
If Supabase rejects the token, the call answers 400 and the account is FAILED. For someone else's account, POST /api/v3/connected_accounts/link returns a connect link on prompt-tm.com with a form for the token. The person pastes their token there, so it never passes through your app or the agent. The link expires after one hour. More in the authentication docs.
3. Create an MCP server. In MCP servers → New, choose Custom, tick Supabase, and under Only some tools pick the tools the agent should see. Copy the server URL.
4. Add it to your client. In Claude Code:
claude mcp add --transport http prompt-tm-supabase \
"https://www.prompt-tm.com/mcp/mcp_...?user_id=me" \
--header "x-api-key: $PROMPT_TM_KEY"
The name prompt-tm-supabase keeps it apart from a supabase server you may have added from Supabase. The user_id in the URL picks whose Supabase token the calls use. Cursor, VS Code, Claude Desktop, claude.ai and the agent SDKs are in the MCP client docs. Then ask something like "Are all services of my staging project healthy?"
The ten tools and the token permission each needs
The Supabase toolkit has ten tools. The permission column comes from Supabase's permission table for the endpoint each tool calls, so you can scope a token to the tools you enable.
| Tool | What it does | Supabase permission |
|---|---|---|
SUPABASE_LIST_ORGANIZATIONS | Lists the organizations the token can reach, with their slugs | Organizations (Read) |
SUPABASE_LIST_ORGANIZATION_MEMBERS | Lists an organization's members and their roles | Organization Members (Read) |
SUPABASE_LIST_PROJECTS | Lists projects with their ref, region and status | Projects, account-wide (Read) |
SUPABASE_GET_PROJECT | Returns one project's name, region, status and database host | Project Settings (Read) |
SUPABASE_GET_PROJECT_HEALTH | Checks whether auth, db, realtime, rest and storage are healthy, and the pooler on request | Project Settings (Read) |
SUPABASE_LIST_EDGE_FUNCTIONS | Lists Edge Functions with slugs, status and versions | Edge Functions (Read) |
SUPABASE_LIST_BRANCHES | Lists the project's database branches | Development or Production Branches (Read) |
SUPABASE_GENERATE_TYPESCRIPT_TYPES | Returns TypeScript types for the schema, public by default | Database (Read) |
SUPABASE_GET_API_KEYS | Returns the project's API keys, including the service role key | API Keys and API Key Secrets (Read) |
SUPABASE_RUN_SQL_QUERY | Runs SQL against the project's Postgres database and returns the rows | Database |
Nine of them only read. SUPABASE_RUN_SQL_QUERY runs whatever SQL the agent sends, including statements that change or delete data and schema, and Prompt TM has no read-only switch for it. SUPABASE_GET_API_KEYS is a read, but the service role key it returns bypasses row-level security. Most agents need neither.
Supabase's server has more tools. It applies migrations, queries logs, runs security and performance advisors, deploys Edge Functions, searches Supabase's docs and manages storage. None of those has a tool here. For a Management API endpoint without a tool, the REST proxy, POST /api/v3/tools/execute/proxy, sends the request to api.supabase.com/v1 with the same token, and only to that host.
Hold the SQL tool back
The token. A scoped token reaches only the projects and permissions you granted, and Supabase answers a call outside them with a 403. If the agent only reports on projects, leave out the Database and API Key Secrets permissions.
The tool list. A custom MCP server shows only the tools you ticked. To block SUPABASE_RUN_SQL_QUERY and SUPABASE_GET_API_KEYS for every account on an auth config, set restrict_to_following_tools on it to the other eight. Accounts connected through it can then call only those tools, and the proxy refuses them with a 403.
Approvals. SUPABASE_RUN_SQL_QUERY is the toolkit's only tool that changes anything, so both approval settings on an MCP server, Ask a person before destructive calls and Ask a person before any call that changes something, hold that one tool. A held call returns approval_required: true and runs nothing. The approval link goes to your webhook and to the server's page in the dashboard, never to the agent, so the agent can't approve its own query. Details are in the router docs.
The log. Each call appears under Logs with the tool, the user and the outcome.
To put Supabase in a router with the rest of the catalogue instead of a fixed tool list, see tool router vs fixed tools. The Supabase toolkit page lists every input. Prompt TM is free during early access, with 20,000 tool calls per project per month. To try it, create a free project and connect a token scoped to one staging project with read access.