# Airlock RLS MCP — Supabase leak checks inside your AI coding agent [![mateuszingano/airlock-rls-mcp MCP server](https://glama.ai/mcp/servers/mateuszingano/airlock-rls-mcp/badges/score.svg)](https://glama.ai/mcp/servers/mateuszingano/airlock-rls-mcp) > Let Cursor, Claude Code, or any MCP client **check a Supabase app for leaks while it builds it.** It catches the most common vibe-coding footgun: a `service_role` key shipped to the browser, and Row Level Security that's off or wide open. The engine is [Airlock RLS](https://github.com/mateuszingano/airlock-rls) (`npm i airlock-rls`), the CI gate for Supabase RLS. This package is a thin MCP wrapper around it. ## Ten tools ### Local (no account needed) **`scan_site_for_exposed_key`** — give it a deployed URL. It reads the page, its JS bundles and source maps for an exposed Supabase `service_role` key (a `service_role` JWT or an `sb_secret_...` key), and checks whether `/.env` is downloadable, `/.git/` is served or source maps are public. No database, no credentials, just the public URL. A key hit means anyone who reads it bypasses **every** RLS policy. It never prints a key or an `.env` value. **`audit_supabase_rls`** — give it a Postgres connection string. It reads **only** catalog metadata, never your row data, so a read-only role is enough. Returns a human-readable summary. What it checks: - tables with RLS off, and policies that are always true (`USING (true)`, `auth.uid() = x OR 1=1`); - policies that don't tie rows to the caller, for reads, inserts, updates and deletes (tenant leaks); - policies that trust `user_metadata`, which every user can edit for themselves; - Storage: public buckets and the policies on `storage.objects`; - `SECURITY DEFINER` functions anon can call, or with no pinned `search_path`; - views that run as their owner and skip RLS, and exposed materialized views; - Realtime publications that stream anon-readable rows; - default privileges that hand every future table to the API roles (the post-Oct-30 "lazy fix"); - roles with `BYPASSRLS`, and tables owned by a client role without `FORCE ROW LEVEL SECURITY`. Auth settings and Edge Functions code aren't in the database catalog, so they're out of scope. **`get_findings`** — same audit as `audit_supabase_rls`, but returns machine-readable structured JSON: findings grouped by severity, severity counts, table count, allowed (waived) findings, and stats. Built for agents that need to iterate over findings, generate fixes, or build reports programmatically. **`explain_finding`** — pure lookup, no database needed. Give it a finding `kind` string (e.g. `rls_disabled`, `permissive_true`, `cross_tenant_read_leak`) and it returns: what it means, why it's dangerous, how to fix it with example SQL, and related finding kinds. Use after `get_findings` or `audit_supabase_rls` to understand a finding before fixing it. **`generate_fix`** — pure function, no database needed. Give it a finding `kind`, a `table_name`, and optionally a `policy_name`, and it returns the exact SQL to fix that specific finding, ready to paste into a migration file. ### Hosted Monitor (needs an API key) These tools talk to the [Airlock Monitor](https://monitor.shipsealed.com) REST API. Create a key in the Monitor dashboard (**API keys**, at the bottom) and set it once in your MCP client config, so it never passes through the conversation: ```json "airlock": { "command": "npx", "args": ["-y", "airlock-rls-mcp"], "env": { "AIRLOCK_API_KEY": "amk_…" } } ``` Each tool also takes an `api_key` argument, which wins over the environment when given. Runs you start count toward your plan's on-demand runs. **`list_monitor_projects`** — list the Supabase projects connected to your Monitor account. **`start_monitor_run`** — start an RLS audit + DAST run on a connected project. Returns a run id to poll. **`get_monitor_run`** — check the status of a run (queued → running → completed/failed). **`get_monitor_findings`** — get the findings (leaks, warnings, suggested SQL fixes) from a completed run. **`get_monitor_attestation`** — download the signed attestation (Ed25519 + SHA-256) for a completed run. Anyone can verify it at shipsealed.com/verify without an account. ## Add it to your MCP client ```json { "mcpServers": { "airlock": { "command": "npx", "args": ["-y", "airlock-rls-mcp"] } } } ``` That's the same block for Cursor (`~/.cursor/mcp.json`), Claude Desktop (`claude_desktop_config.json`) and other MCP clients. With Claude Code: ```bash claude mcp add airlock -- npx -y airlock-rls-mcp ``` Then ask the agent things like *"scan https://myapp.com for an exposed Supabase key"*, *"audit the RLS on this database"*, *"explain the rls_disabled finding"*, *"generate the fix for permissive_true on my profiles table"*, or *"run a Monitor check on my project and show the findings"* and it calls the tools. ## MCP 2.0 (protocol 2026-07-28) Since 0.3.0 the server speaks both MCP eras from the same process, on the official MCP TypeScript SDK v2: - **2025-era clients** (they open with `initialize`, like Cursor and Claude Desktop today) work exactly as before: same ten tools, same arguments, same results. - **2026-07-28 clients** discover the server with `server/discover` and get two extras, each one only if the client declares it: - **Skill `auditoria-rls`** ([Skills extension](https://modelcontextprotocol.io/extensions/skills/overview)) — the method that comes with the tools: when to audit, the order to run the tools in, how to rank findings P0/P1/P2, the traps that leak with RLS on, and the rule to audit staging, not production, unless you say so. - **Background audits** ([Tasks extension](https://modelcontextprotocol.io/extensions/tasks/overview)) — `audit_supabase_rls` and `get_findings` return a task handle right away and the client polls for the result, so a big schema doesn't block the agent. Clients without the extension get the same tools, synchronous. - **"Which schema?"** (elicitation) — when an audit finds no tables or policies in the schema it was given (your tables live in another schema, or a typo), a client that supports elicitation is asked which schema to audit, and the audit re-runs there. Other clients get the result as before, which says nothing was audited. Which clients support which extension changes fast; see the official [extension support matrix](https://modelcontextprotocol.io/extensions/client-matrix). A client that supports neither still gets every tool. Nothing to configure: the same `npx -y airlock-rls-mcp` serves every client. ## Requirements Node.js 20 or newer (since 0.3.0; required by the MCP SDK v2). ## Develop ```bash npm install npm test # smoke.mjs (2025-era client) + the 2026-07-28 client, skills and tasks tests ``` The audit test needs a throwaway Postgres in `AIRLOCK_TEST_DB_URL` (e.g. `docker run --rm -d -p 127.0.0.1::5432 -e POSTGRES_PASSWORD=postgres postgres:17`); without it that one test is skipped. ## More Guides on Supabase RLS, a live cross-tenant demo, and the hosted Airlock Monitor (continuous checks of your live database): [shipsealed.com](https://shipsealed.com/?utm_source=readme&utm_medium=referral&utm_campaign=airlock-rls-mcp) ## License MIT © Mateus Zingano