To connect Supabase MCP to Claude Code, run claude mcp add --scope project --transport http supabase "https://mcp.supabase.com/mcp?project_ref=YOUR_REF&read_only=true", then sign in with claude /mcp from a regular terminal. Two URL parameters do most of the safety work. project_ref pins the agent to one project, and read_only=true runs every query as a read-only Postgres user. The official Supabase MCP docs list every option.

Official links

Key facts

  • Hosted endpoint: https://mcp.supabase.com/mcp. Paste it into Claude Code. Opening it in a browser won't do anything useful.
  • Auth: for interactive use you sign in with OAuth in the browser and don't need a personal access token. For CI you use a scoped token that starts with sbp_fc.
  • 24 November 2026: Anthropic made Tasks and Elicitation generally available in Claude and Claude Code for Pro, Max and Ultra plans. Supabase uses Elicitation to confirm costs before it creates a paid project and before it runs destructive SQL.
  • Official plugin: the Supabase plugin for Claude Code is marked "Anthropic verified" and has 118,617 installs. It bundles the MCP server (20+ tools) with Supabase skills.
  • Local development: with the Supabase CLI, the endpoint is http://localhost:54321/mcp. You get fewer tools and no OAuth 2.1.
  • 23 November 2026: Supabase launched its Knowledge Base, written so coding agents can read it. Every page has a Markdown version.

The connection lets Claude reach your data. It doesn't tell Claude what that data means, such as which table holds the truth or what counts as an activated user. That second job is what Context as a Service covers, and it decides whether the answers below are any use.

Why the security setup matters more than the demo

Most video walkthroughs connect the server to a full account and start running queries. That ignores the risk that has been documented. In June 2025, General Analysis showed a prompt injection hidden in a support ticket. When an agent read the ticket, the hidden instructions made it read the integration_tokens table and write the secrets back into the ticket. Their summary was "No permissions were violated."

The attack is often explained with Simon Willison's "lethal trifecta": the agent can read private data, it reads untrusted content, and it has a way to send data out. A Supabase project that stores user-submitted text has the first two built in. So the setup below limits what the agent can see and keeps a human approving each action.

Step 1: Choose the project the agent can see

Open the Supabase Dashboard and pick the project. Its reference ID is the string after /project/ in the dashboard URL.

For growth analysis, a staging project or a separate reporting copy is the safer choice. According to Fastero, Supabase changed its production advice on 4 September 2026 from "don't connect to production" to "connect only when the task needs it". Fastero is a vendor with its own product to sell, so read that as reported, not confirmed. Either way, the rule holds: production access is for a specific task, not the default.

Step 2: Add the Supabase MCP server to Claude Code

Run this from the root of your repository (Anthropic's Claude Code MCP docs explain the claude mcp add command and its scopes):

claude mcp add --scope project --transport http supabase "https://mcp.supabase.com/mcp?project_ref=YOUR_REF&read_only=true&features=database,docs,debugging"

Keep the quotes. Without them the shell cuts the URL off at the first &, and you end up with an unscoped server without noticing. The --scope project flag writes the config to .mcp.json in the repo, so your whole team gets the same scoped setup. Because OAuth handles sign-in, the file holds no secrets.

ParameterWhat it doesWhen to use it
project_ref=<id>Limits the server to one project and turns off account toolsAlways
read_only=trueRuns queries as a read-only Postgres userAny analysis work
features=database,docs,debuggingTurns on only the tool groups you listLeave out Edge Functions, Account and Storage unless the task needs them
skip_elicitations=<tools>Skips the confirmation forms for those tools (names are case-sensitive)Not recommended for production

The tool groups are Database (list_tables, execute_sql, apply_migration), Debugging (query_logs, get_advisors), Development (generate_typescript_types), Edge Functions, Account, Docs (search_docs), Branching (experimental, paid plans only), Feedback, Storage (off by default) and Notebooks (hosted only). Fastero counts 33 tools in total.

Step 3: Authenticate in a regular terminal

Open a normal terminal, not the VS Code or JetBrains extension. Run claude /mcp, pick supabase, then choose Authenticate. A browser window opens for the OAuth sign-in. There you choose the Supabase organisation that owns the project. If you pick the wrong one, Claude won't find the project later.

Teams on Supabase Team or Enterprise with SSO have a second route. Since 3 November 2026, Claude can issue the identity assertion for the Supabase MCP server. On the Claude side, auto-connect is in beta for Team and Enterprise.

Step 4: Keep the guardrails on

  • Manual tool approval stays on. Supabase's own advice is to approve each tool call yourself. Read the SQL before you approve it.
  • Leave Elicitation alone. The confirmation forms for paid projects and destructive SQL are the newest safety layer. Adding skip_elicitations removes them.
  • Test what read-only actually allows. Fastero reports that supabase_read_only_user can't write but can read every table, including auth.users, and has BYPASSRLS, which means Row Level Security doesn't apply. That isn't independently confirmed. Check it on your own project: ask Claude to count rows in auth.users and see whether it can.
  • Test changes on a branch. Use branching (paid plans) for migrations instead of applying them to the live database.
  • Never give the server to end users. Supabase says this plainly. It is a developer tool.

CI and headless runs: scoped personal access tokens

OAuth needs a browser, so pipelines need a token. Supabase's scoped personal access tokens start with sbp_fc. You can limit each one by organisation, project and permission, and set an expiry of up to one year. Older full-access tokens still work and are labelled "Legacy". Supabase says nearly 9 in 10 new tokens created in the Dashboard are scoped, and the MCP server checks permissions on every tool call.

Send the token as a header and keep it in an environment variable, not in .mcp.json:

claude mcp add --transport http supabase "https://mcp.supabase.com/mcp?project_ref=YOUR_REF&read_only=true" --header "Authorization: Bearer $SUPABASE_ACCESS_TOKEN"

Plugin, hosted server or local npx?

OptionGood forWatch out for
Official Claude Code pluginGetting MCP plus Supabase skills (including Postgres best practices) in one installCheck which URL it configures and add your scoping parameters
Hosted server via claude mcp addFull, visible control of every parameter in .mcp.jsonQuote the URL
Local CLI at localhost:54321/mcpLocal development against the Supabase CLI stackFewer tools, no OAuth 2.1
@supabase/mcp-server-supabase via npxOlder setupsGuides link it to "connected but no tools" errors

The @supabase/mcp-server-postgrest package is deprecated. If you've already set up a WordPress connection, the shape is the same as in the WordPress MCP server setup for Claude: scope first, then authenticate.

Three growth-ops queries a marketing lead can run

These prompts assume features=database,docs,debugging and read-only mode. Swap in your own table and event names.

1. Weekly signups by acquisition source

Prompt: "Use list_tables to find where signups and their acquisition source are stored. Then give me weekly signups by source for the last 8 weeks. Show the SQL you ran."

Check: the table it chose. If source is stored in two places, the agent will pick one, and you need to know which.

2. Seven-day activation by signup cohort

Prompt: "Activation means the user created their first [project/invoice/report] within 7 days of signup. For each weekly cohort in the last 8 weeks, what share activated? Show the SQL."

Check: the definition. You write it, and the agent applies it. If you leave it out, Claude will invent one.

3. Did the campaign break the signup flow?

Prompt: "Use query_logs to list auth and Edge Function errors from the last 24 hours, grouped by error message. Then run get_advisors and list any security or performance warnings."

Check: run this right after a launch. It is the cheapest way to spot a broken form before paid traffic piles up.

Troubleshooting the Supabase MCP connection

  • "Needs authentication": run claude /mcp from a regular terminal. Signing in from an IDE extension fails.
  • Can't find the project: you picked the wrong organisation at sign-in. Authenticate again.
  • Account tools missing: this is expected when project_ref is set.
  • Branching tools fail: branching needs a paid plan.
  • Connected but no tools: you're probably on the old npx package. Switch to the hosted endpoint.
  • Agent stuck on an error: point it at the Supabase Knowledge Base. Its Markdown pages are linked from llms.txt, and it has migration guides for 10+ sources, including Firebase, Neon and Auth0.

Next step

Before you connect anything, write down your three most-asked growth questions and the exact definition behind each one. Then add the server with project_ref and read_only=true and run them. If the answers still come back generic, the gap is usually missing definitions, not the model. A 60-minute Context Clinic (₹5,000 or $150) is built to find that gap in one sitting. Other MCP builds are on the arsachdeva.com blog.

Take the 3-minute Context Readiness Scorecard

Frequently asked questions

Do I need a personal access token to use Supabase MCP with Claude Code?

Not for interactive use. Run claude /mcp in a regular terminal, choose supabase, then Authenticate, and you sign in with OAuth in the browser. You only need a token for CI or headless runs. In that case, use a scoped personal access token starting with sbp_fc, sent as an Authorization: Bearer header and kept in an environment variable.

How do I make the Supabase MCP server read-only?

Add read_only=true to the server URL, for example https://mcp.supabase.com/mcp?project_ref=YOUR_REF&read_only=true, and keep the whole URL in quotes so the shell doesn't cut it at the ampersand. Queries then run as a read-only Postgres user. Fastero reports that this user can still read every table, including auth.users, so test that on your own project.

Is it safe to connect Supabase MCP to a production database?

Only when a specific task needs it. Pin the server to one project with project_ref, turn on read_only, limit tool groups with features, keep manual tool approval on and leave the Elicitation confirmations in place. Prompt injection hidden in user-submitted data is the documented risk, so for routine growth analysis a staging or reporting project is the safer choice.

Why are account tools missing after I connect?

This is expected when project_ref is set. Scoping the server to one project turns off account-level tools such as listing or creating projects, which is the point of scoping it. If you really need account tools for a one-off task, add a separate, temporary connection without project_ref, and remove it when you're done.

Should I use the Supabase plugin or add the MCP server manually?

The official plugin, which is Anthropic verified, bundles the MCP server with Supabase skills such as Postgres best practices, and that helps with schema work. Adding the hosted server with claude mcp add puts every parameter in your own .mcp.json, where your team can see and review the scope. Whichever you choose, make sure project_ref and read_only are set.

Sources

  1. Model context protocol (MCP) · Supabase Docs | Supabase
  2. Connect Claude Code to tools via MCP · Anthropic
  3. Skills over MCP, Tasks and more · Anthropic
  4. Supabase MCP server (GitHub) · Supabase
  5. Supabase plugin for Claude Code · Anthropic
  6. Scope your personal access tokens · Supabase
  7. Claude-issued enterprise-managed auth for MCP · Supabase
  8. Introducing the Supabase Knowledge Base · Supabase