Integration · Supabase PostgreSQL (HTTP & MCP) · Open Source (Apache-2.0) & Cloud

Supabase + Claix: The Best Way to Connect AI Agents & Coding Tools to Supabase
Supabase makes spinning up a production PostgreSQL backend effortless — which also makes it effortless to hand an AI coding assistant or customer-facing agent far more access than it should ever hold. Even Supabase's own MCP security guidance warns against wiring general developer MCP connections straight into production data because untrusted text inside a table can hijack an over-privileged assistant.
In the IDE, a frustrated coding agent will happily suggest ALTER TABLE … DISABLE ROW LEVEL SECURITY or GRANT ALL … TO anon just to make a failing test pass. In production, connecting an agent with service_role bypasses Row-Level Security completely. Claix sits between your agents and Supabase Postgres with table- and row-scoped reads and a deny-by-default SQL firewall that inspects affected rows in milliseconds — with zero model calls at check time.
The problem
Why service_role, raw MCP, and prompt warnings are not enough
Teams connecting AI tools to Supabase typically hit three structural gaps that RLS alone does not close.
Indirect prompt injection across tables: an assistant reading a routine support ticket can encounter hidden instructions, then query integration_tokens or auth tables with broad database authority and write secrets into a user-visible thread. Wrapping SQL results in text warnings to the LLM is not foolproof.
Read-only connections still execute side-effect functions and expose catalogs: a SELECT that invokes a volatile function can mutate state without a prompt, and broad catalog access exposes internal tables and sensitive columns.
Agents disarming RLS and schemas during refactors: autonomous coding tools routinely try to drop columns, TRUNCATE seed tables, alter policies, or turn off RLS when debugging permission errors.
How Claix helps
Hard Postgres boundaries for Supabase agents
Claix enforces boundaries that neither prompt injection nor hallucinated migrations can talk their way past — on Core or Cloud.
Clean Supabase catalog isolation
Claix skips internal supabase_* stack schemas during catalog introspection and restricts reads to the routes and columns you expose — keeping auth.*, vault.*, storage.*, and private token tables unreachable to the agent.
Row-scoped reads without service_role
Each Claix agent carries deterministic scope rules that wrap every read query automatically, so a portal or support agent only ever sees the tenant rows you defined.
Deny-by-default SQL firewall
A statement passes only when an active permission covers that exact operation. A permission covering a single-row DELETE never covers DROP, ALTER, TRUNCATE, or GRANT. Session mutations such as SET ROLE or SET row_security = off cannot be permitted.
Affected-row preflight, zero LLM calls
Using a dedicated read-only Postgres role (claix_agent), Claix parses the statement, inspects the exact rows a write would touch, and returns allow, deny, or needs_approval without running the write.
Core vs Cloud
Claix Core vs Claix Cloud on Supabase
Both editions run the same deterministic SQL check against your Supabase Postgres instance.
| Your Supabase setup | Claix Core (Open Source · Self-hosted) | Claix Cloud (Hosted · Team governance) |
|---|---|---|
| Best for | Solo developers, local supabase start stacks, private VPC workers, YAML rules next to supabase/migrations | Teams on Supabase Pro/Team/Enterprise, serverless apps (Vercel, Edge Functions), Slack approvals & central audit |
| Where it runs | On your machine or container (@claix-dev/core on Node.js 22+ or ghcr.io/claix-dev/claix-core, Apache-2.0). Zero Claix signup | Hosted by Claix at claix.dev with your claix_agent password encrypted in Cloud Vault |
| Agent interfaces | Local stdio MCP (npx -y @claix-dev/core mcp) and HTTP (POST /check-sql, POST /retrieve/:agent) | HTTPS REST, Streamable HTTP MCP (https://claix.dev/mcp), and A2A, plus Claix Ingest |
| When needs_approval triggers | Returns needs_approval JSON so your IDE stops or your backend pauses execution | Routes the exact statement to Slack so a teammate or lead can approve it from a channel |
| Branching & environments | One deployment and YAML directory per environment, verified in CI via claix validate | Isolated workspaces for staging, preview branches, and production with a visual policy editor |
| Audit history | Local traces.jsonl on disk (32-day / 50,000-event window in memory for recent_actions and call_limit) | Central company audit log across every developer IDE and production microservice |
Step 1
Create the read-only claix_agent role in Supabase
Never hand Claix (or any AI tool) your postgres superuser password or service_role key. Open the Supabase SQL Editor and create a least-privilege claix_agent read-only role scoped strictly to your public application tables.
Supabase SQL Editor
-- Run once in the Supabase SQL Editor CREATE ROLE claix_agent WITH LOGIN PASSWORD 'replace-with-strong-password'; GRANT CONNECT ON DATABASE postgres TO claix_agent; GRANT USAGE ON SCHEMA public TO claix_agent; -- Grant read access only to public tables (never auth, vault, or internal schemas) GRANT SELECT ON ALL TABLES IN SCHEMA public TO claix_agent; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO claix_agent;
Connection strings
Choosing the right Supabase host (direct vs pooler)
Supabase provides multiple Postgres endpoints with different username formats. Get this right before Core or Cloud can connect.
- Direct connection (db.<PROJECT-REF>.supabase.co, port 5432) or Dedicated Pooler (port 6543 on Pro+): use the plain username claix_agent. Direct hosts use IPv6 by default unless the IPv4 add-on is enabled.
- Shared Supavisor Pooler (aws-0-<region>.pooler.supabase.com): appends your project ref to custom roles as claix_agent.<PROJECT-REF>.
- Important for Claix Cloud & Import from Core: set CLAIX_DB_USER=claix_agent on a host that accepts that exact role name (direct host or dedicated pooler) — not a shared-pooler tenant username like claix_agent.projectref — with TLS set to require or verify-full.
Option 1
Run Claix Core locally or in your VPC (open source)
Initialize ./claix beside your supabase/ folder, validate against the live catalog, then run via Docker Compose or local MCP for Cursor, Claude Code, or Codex.
- 01
Validate YAML guards and routes against Supabase
Run claix init and claix validate so every permission, route, and agent scope is checked against your live Supabase catalog with the claix_agent role.
- 02
Connect via Docker Compose or local MCP
Run ghcr.io/claix-dev/claix-core next to your backend, or wire npx -y @claix-dev/core mcp directly into your IDE. Point CLAIX_DB_HOST at db.<PROJECT-REF>.supabase.co with CLAIX_DB_USER=claix_agent and CLAIX_DB_SSL=require.
- 03
Local supabase start tip
Working offline? Point CLAIX_DB_HOST at host.docker.internal / 127.0.0.1 and port 54322 during local development, then switch to CLAIX_DB_SSL=require against your hosted project.
Core snippets
Init, validate, Docker quickstart, and Supabase Compose
Keep CLAIX_DB_USER=claix_agent on a direct or dedicated-pooler host. Mount ./claix read-only so no agent can rewrite permissions at runtime.
Init & validate
npx -y @claix-dev/core init npx -y @claix-dev/core validate
Docker quickstart
git clone https://github.com/claix-dev/claix-core cd claix-core docker compose up -d --build --wait
Compose against hosted Supabase
services:
claix:
image: ghcr.io/claix-dev/claix-core
restart: unless-stopped
ports:
- "127.0.0.1:8787:8787"
environment:
CLAIX_API_KEY: ${CLAIX_API_KEY}
CLAIX_DB_ENGINE: postgres
CLAIX_DB_HOST: db.${SUPABASE_PROJECT_REF}.supabase.co
CLAIX_DB_PORT: 5432
CLAIX_DB_NAME: postgres
CLAIX_DB_USER: claix_agent
CLAIX_DB_PASSWORD: ${CLAIX_DB_PASSWORD}
CLAIX_DB_SSL: require
CLAIX_CONFIG_DIR: /claix
CLAIX_DATA_DIR: /data
volumes:
- ./claix:/claix:ro
- claix_data:/data
volumes:
claix_data:Option 2
Connect Supabase to Claix Cloud
Most Supabase apps deploy on Vercel, Cloudflare Workers, or Supabase Edge Functions — environments where a sidecar Docker container and a persistent traces.jsonl volume are unnecessary friction.
Encrypted Vault & instant HTTPS / MCP
Save your claix_agent connection once in /dashboard/database-connection (Cloud Vault with TLS verified on save), then call Claix over HTTPS or https://claix.dev/mcp from any Edge Function, serverless route, or team IDE.
Slack approvals on sensitive mutations
When an agent attempts an action matching needs_approval_when, Claix Cloud sends the statement straight to Slack for human approval.
Workspaces & central audit
Manage staging and production Supabase projects in separate workspaces, edit permissions visually without redeploying, and keep one company-wide audit log.
Grow into Cloud
Start on Claix Core, Import into Claix Cloud in 2 minutes
If you start with Claix Core YAML beside your supabase/ directory and later move to Cloud for team workspaces and Slack approvals, use Import from Core at /dashboard/database-connection.
- 01
Gather Core files
Collect your Core .env (CLAIX_DB_HOST, PORT, NAME, USER=claix_agent — not claix_agent.projectref — PASSWORD, and SSL=require or verify-full), plus claix/guards, routes, agents YAML, and optionally traces.jsonl (up to 8 MB; Cloud imports the newest 2,000 events).
- 02
Import as workspace owner
Sign in at /dashboard/database-connection and click Import from Core. Upload your files and choose Import into Cloud. Any error before the connection saves aborts cleanly without half-applying changes.
- 03
Cloud Vault and Slack
Your claix_agent password moves into Cloud Vault, deny-by-default permissions and row scopes remain intact, and needs_approval verdicts immediately connect to Slack.
Frequently asked questions
- Why use Claix with Supabase instead of relying on Supabase RLS alone?
- Backend AI agents using service_role bypass Supabase RLS completely, and coding agents can attempt to alter or disable RLS policies. Claix enforces deterministic row scopes on reads and a deny-by-default SQL firewall on writes and schema statements with zero model calls at check time.
- Which Supabase connection string should I use with Claix Core and Claix Cloud?
- Use a dedicated read-only claix_agent role with TLS set to require or verify-full. For Claix Cloud and Import from Core, set CLAIX_DB_USER=claix_agent on a Supabase host that accepts that role directly (such as db.<project-ref>.supabase.co or a dedicated pooler), not a shared pooler username like claix_agent.projectref.
- Does Claix expose internal Supabase schemas like auth or vault to AI agents?
- No. Claix skips internal supabase_* catalog schemas automatically and only exposes the explicit tables, columns, and row scopes you grant to claix_agent and define in your routes.
- Can I migrate my local Claix Core setup for Supabase to Claix Cloud?
- Yes. Workspace owners can use Import from Core under /dashboard/database-connection to import their Supabase connection, YAML guards, routes, agents, and up to 8 MB (newest 2,000 events) of traces.jsonl into Claix Cloud.
Connect Supabase safely — Core today, Cloud when the team grows
Run Claix Core (Apache-2.0) beside supabase/ or supabase start, then Import from Core when you need Cloud Vault, Slack approvals, and a company audit log. Same deny-by-default check either way.