---
title: How to connect Supabase MCP to Claude Code
description: Run claude mcp add with https://mcp.supabase.com/mcp, then /mcp to sign in. Scope it with project_ref and read_only=true, share it, and limit write tools.
canonical: https://mcp1.com/blog/supabase-mcp-claude-code
last-updated: 2026-11-30
---

# How to connect Supabase MCP to Claude Code

Run claude mcp add with https://mcp.supabase.com/mcp, then /mcp to sign in. Scope it with project\_ref and read\_only=true, share it, and limit write tools.

![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite

 Terminal

$ claude mcp add --transport http supabase mcp.supabase.com/mcp?read\_only=true

supabaseRead only

 Terminal

$ claude mcp add --transport http supabase mcp.supabase.com/mcp?read\_only=true

supabaseRead only

To connect Supabase to Claude Code, run `claude mcp add --transport http supabase "https://mcp.supabase.com/mcp"`, start `claude`, run `/mcp` and choose Authenticate. You sign in to Supabase in the browser and pick the organization that holds your project. Add `project_ref` and `read_only=true` to the URL before the agent touches a database with real data.

## How do I add Supabase MCP to Claude Code?

Supabase hosts the server, so there is nothing to install and no token to create:

1. 1Add the server, scoped to one project and read-only. The project ref is the ID in your dashboard URL, `supabase.com/dashboard/project/<ref>`. Quote the URL so your shell doesn’t treat `&` as a command separator.  
Terminal  
```  
claude mcp add --transport http supabase \  
  "https://mcp.supabase.com/mcp?project_ref=abcdefghijklmnop&read_only=true"  
```
2. 2Start `claude` in a regular terminal, run `/mcp`, select `supabase` and choose Authenticate. Supabase’s docs say to do this from the terminal, not the IDE extension.
3. 3Sign in and choose the organization that contains the project. Supabase registers Claude Code as an OAuth client itself, so there is no app to set up.

Check it with something harmless: “List the tables in the public schema and which ones have RLS disabled.” Claude Code should call `list_tables` and `get_advisors`. `claude mcp get supabase` shows the stored URL and whether the server connected.

## Which URL parameters should I set?

Three, on almost every setup. The bare URL reaches every project in the organization you approved, production included.

ParameterEffect

`project_ref=<ref>`

One project only. Also removes the account tools, like create\_project and pause\_project.

`read_only=true`

Every query runs as a read-only Postgres user, so writes fail in the database, whatever the agent sends.

`features=database,docs`

Loads only the listed tool groups, which shortens the tool list Claude Code carries in context.

The groups are account, branching, database, debugging, development, docs, feedback, functions, notebooks and storage. All are on by default except storage. Branching is experimental and needs a paid plan. For a read-only look at a project, `database,debugging,docs` covers schema, logs, advisors and documentation.

## Which tools will Claude Code get?

These are the ones that matter most, with whether they change anything:

ToolWhat it does

`list_tables`

Tables in the given schemas. Read.

`execute_sql`

Runs any SQL. Read-only when read\_only=true, otherwise it can write or drop.

`apply_migration`

Applies DDL as a tracked migration. Write.

`list_migrations`

Migrations already applied. Read.

`get_logs`

Recent logs for one service: API, Postgres, auth, storage, edge functions. Read.

`get_advisors`

Security and performance notices, such as missing RLS policies. Read.

`generate_typescript_types`

Types generated from the schema. Read.

`deploy_edge_function`

Deploys an edge function. Write.

`merge_branch`

Merges a development branch into production. Destructive.

In Claude Code each one is named `mcp__supabase__<tool>`, which is what permission rules match on.

## How do I share Supabase MCP with my team?

Add it at project scope. Claude Code writes the entry to `.mcp.json` at the repository root, which you commit. Each teammate approves the server the first time it loads and signs in with their own Supabase account:

Terminal

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

If people work against different projects, keep the ref out of the file. Claude Code expands `${VAR}` and `${VAR:-default}` in URLs and headers:

.mcp.json

```
{
  "mcpServers": {
    "supabase": {
      "type": "http",
      "url": "https://mcp.supabase.com/mcp?project_ref=${SUPABASE_PROJECT_REF}&read_only=true"
    }
  }
}
```

## How do I stop Claude Code running write tools?

Use permission rules in `.claude/settings.json`. Pre-approve reads, ask before SQL, and deny schema changes and deploys. Globs work after the literal `mcp__supabase__` prefix:

.claude/settings.json

```
{
  "permissions": {
    "allow": [
      "mcp__supabase__list_*",
      "mcp__supabase__get_*",
      "mcp__supabase__search_docs"
    ],
    "ask": ["mcp__supabase__execute_sql"],
    "deny": [
      "mcp__supabase__apply_migration",
      "mcp__supabase__deploy_edge_function",
      "mcp__supabase__delete_branch"
    ]
  }
}
```

Keep `execute_sql` on ask even with `read_only=true`. Your tables hold text written by other people, and Supabase’s own example of prompt injection is a support ticket that tells the agent to read another table. Seeing each statement before it runs is the cheapest check you have. Supabase also says never to connect the server to anything your customers use, since it runs with your developer permissions. More on this in [how to make an MCP server read-only](https://mcp1.com/blog/read-only-mcp-server) and [stopping destructive MCP tools](https://mcp1.com/blog/stop-destructive-mcp-tools).

## Can I use a personal access token instead of OAuth?

Yes, and Supabase recommends it for CI, where nobody can finish a browser sign-in. Create a token on your account’s access tokens page and pass it as a bearer header:

.mcp.json

```
{
  "mcpServers": {
    "supabase": {
      "type": "http",
      "url": "https://mcp.supabase.com/mcp?project_ref=${SUPABASE_PROJECT_REF}&read_only=true",
      "headers": {
        "Authorization": "Bearer ${SUPABASE_ACCESS_TOKEN}"
      }
    }
  }
}
```

`claude -p` runs can’t do OAuth, so headless jobs need this. A token acts as the person who created it, so use one owned by a service account for shared jobs. The rest of a CI setup is in [using MCP in CI and headless agents](https://mcp1.com/blog/mcp-in-ci-and-headless-agents).

## Does it work with a local Supabase project?

Yes. `supabase start` serves an MCP endpoint at `http://localhost:54321/mcp` with no sign-in:

Terminal

```
claude mcp add --transport http supabase-local http://localhost:54321/mcp
```

The local server is smaller

The CLI serves a subset of the hosted tools and has no OAuth. With the experimental stack setting the port changes; read the URL from `supabase status`.

## What if Supabase doesn’t connect?

- Tools return nothing for your project. You approved a different organization. Run claude mcp logout supabase, then authenticate again and pick the right one.
- Account tools are missing. project\_ref is set, which removes them by design.
- Writes fail with a permission error. read\_only=true is working. Drop it only for a development project or a branch.
- Storage or branching tools are missing. Storage is off by default and branching needs a paid plan. Add the group to features.
- claude mcp list warns about a variable. An unset ${VAR} with no default stays literal in the URL. Export it before starting claude.

## Supabase for the whole team, in every client

A committed `.mcp.json` covers Claude Code in one repository. Cursor, ChatGPT and Claude each need their own setup, and `read_only=true` is a URL parameter anyone can delete. MCP1 is a gateway that sets it up once: an admin installs [Supabase](https://mcp1.com/servers/supabase) in the workspace, grants groups full or read-only access, and adds rules by name, like an Ask first rule on `supabase__execute_sql` or `supabase__merge_branch` held to admins. Every call is recorded in the audit log with who made it and the SQL it ran.

In Claude Code it is one command, `claude mcp add --transport http mcp1 https://mcp1.com/mcp/<workspace>/<gateway>`, then `/mcp`. The [docs](https://mcp1.com/docs) cover gateways and groups, and the Individual plan is free to [start with](https://mcp1.com/signup). For other clients, see [Supabase MCP in Cursor](https://mcp1.com/blog/supabase-mcp-cursor).

## Common questions

### Do I need a Supabase access token for Claude Code?

No. The hosted server uses OAuth with dynamic client registration, so you sign in through /mcp. Use a personal access token only for CI and claude -p runs, where a browser sign-in can’t happen.

### Can Claude Code change my Supabase database?

Only if you let it. With read\_only=true in the URL, every query runs as a read-only Postgres user. Without it, execute\_sql and apply\_migration can write, so keep them on ask or deny.

### How do I connect Claude Code to more than one Supabase project?

Add the server twice under different names, each with its own project\_ref, for example supabase-staging and supabase-prod. Make the production one read-only.

### Is there a Supabase plugin for Claude Code?

Supabase publishes agent skills you can install with claude plugin marketplace add supabase/agent-skills and claude plugin install supabase@supabase-agent-skills. The MCP server works without them.

Give your team one URL

Create a workspace, install your servers and share a gateway with a group. Free for individuals.

[Start with MCP1](https://mcp1.com/signup)[Read the docs](https://mcp1.com/docs)

## More from the blog

[ \~/.codex/config.toml[mcp_servers.notion] url = "https://mcp.notion.com/mcp"codex mcp login notionSigned inHow to connect Notion MCP to CodexRun codex mcp add notion --url https://mcp.notion.com/mcp, then codex mcp login notion. Approvals, a token for CI, team config and fixes.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/notion-mcp-codex)[ Where PHI goes in one tool callMCP serverBAA, endpoint in scopeModel providerBAA, product namedGatewayBAA, audit logLogsEncrypted, retention setMCP and HIPAA: what to check before agents touch PHIEvery party that handles PHI in an MCP tool call needs a BAA, and model providers’ BAAs don’t cover MCP servers. What to check, limit and log.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/mcp-hipaa)

---

This is the markdown copy of https://mcp1.com/blog/supabase-mcp-claude-code. Site index for agents: https://mcp1.com/llms.txt
