How to connect a Supabase or Neon database to Claude and ChatGPT
Updated
Add your Supabase or Neon database to Kaiva Bridge as a PostgreSQL database. Bridge reads its tables, creates read-only tools to look up and total rows, and serves them as an MCP server you add to Claude, ChatGPT, Cursor or any other AI client. For Supabase, use the Session pooler connection string and add Supabase's CA certificate; Neon's connection string works as it is.
Step by step
- Create a login that can only readIn the SQL editor of Supabase or Neon, run the SQL below with a password of your own. The login can read the tables in the public schema and nothing else.
- Copy the connection stringSupabase: click Connect, choose Session pooler and copy the string, then change the user name to bridge_ro.<your project ref> and put in its password. Neon: click Connect, copy the string, and change the user name and password to bridge_ro and its password.
- Add it to BridgeChoose New server, then Database, then PostgreSQL, paste the string and click Test and introspect. For Supabase, when Bridge says it cannot verify the certificate, paste Supabase's CA certificate (below) into CA certificate.
- Choose the tools and deploySwitch on the tools for the tables your AI needs, click Deploy server and add the server's address to Claude, ChatGPT, Cursor or another MCP client.
The read-only login
Run this once in the SQL editor. It covers tables in the public schema, including ones you create later; Supabase's own schemas, such as auth, stay out of reach.
CREATE ROLE bridge_ro LOGIN PASSWORD 'choose-a-password';
GRANT USAGE ON SCHEMA public TO bridge_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO bridge_ro;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO bridge_ro;Supabase: row-level security
Supabase turns on row-level security for tables you create in its dashboard. A new login sees no rows in those tables until a policy lets it read. For each table your AI should see, add a policy like this one; a table without one answers with no rows.
CREATE POLICY bridge_ro_read ON public.orders
FOR SELECT TO bridge_ro USING (true);Supabase: the connection string and certificate
Use the Session pooler string from Supabase's Connect dialog: it works over IPv4 on every Supabase plan. The direct connection uses IPv6 unless your project has Supabase's IPv4 add-on. Through the pooler, the user name is the login followed by your project ref, such as bridge_ro.abcdefghijklmnop.
Supabase signs its database certificates with its own certificate authority, which is not on the public list. Download it from Supabase's database settings, under SSL configuration, open the file in a text editor and paste it into CA certificate in Bridge. Bridge then checks it is talking to Supabase. If your connection string has an sslrootcert option, remove it: Bridge takes the certificate as text, not as a file path.
Neon
Neon's certificates come from Let's Encrypt, which Bridge already trusts, so there is nothing to add. Use the string from Neon's Connect dialog with the bridge_ro login in it.
A Neon database that has scaled to zero wakes on the first call, so that call takes a little longer.
The tools your AI gets
Two for each table the login can read: get_orders looks up rows with filters, sorting and paging, and summarize_orders counts and totals them, optionally grouped by a column. Every call is one query generated from the schema, run in a read-only transaction. Your AI never writes SQL.
Free includes 10 MCP servers, 200,000 tool calls a month and 200 pages of documents, with no card.
Other ways to do it
- Supabase's MCP serverFor developers working on a Supabase project from Cursor, Claude Code or Claude.ai: run SQL, apply migrations, manage branches and Edge Functions. It acts with your Supabase account's permissions, and Supabase says not to give it to customers or end users.
- Neon's MCP serverFor developers managing Neon projects: create projects and branches and run SQL. Neon recommends it for development and testing, not production.
- Kaiva Postgres MCP, on your machineA free, open-source, read-only Postgres MCP server for Claude Code, Cursor or Claude Desktop on your own machine, with no account.
Questions
- How is this different from Supabase's or Neon's own MCP server?
- Theirs are for developers managing a project: they run SQL with your account's access. Bridge gives Claude, ChatGPT and your team read-only tools for the tables you choose, behind sign-in, with no access to the project itself.
- Can the AI change my data?
- No. Every call runs in a read-only transaction, and the bridge_ro login can only read.
- Why does a Supabase table return no rows?
- Row-level security is on and no policy lets bridge_ro read. Add a SELECT policy for bridge_ro on that table.
- What does "Tenant or user not found" mean?
- Supabase's pooler could not match the user name to your project. Through the pooler the user name is bridge_ro.<your project ref>; copy the host from Supabase's Connect dialog.
- Do I need Supabase's certificate?
- Yes. Bridge checks the database's certificate, and Supabase's comes from Supabase's own certificate authority. Without it, Bridge stops before signing in.
- Is it free?
- Free includes 10 MCP servers, 200,000 tool calls a month and 200 pages of documents, with no card.