Skip to content
MCP server
Registry

supabase-rls-check MCP Server

Read-only Supabase RLS checks: explain rules, analyze/diff SQL exports, scan public env vars.

supabase-rls-check scores 66 (Good), licensed MIT and written in Python. It installs as a local process. It declares 3 tools. Filed under Databases. GitHub shows 0 stars. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.

by tthanh2k6MITPython0 stars
Trust score
66Good
Trust score 66 of 100, Good

Good trust

66 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: mit.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 66 comes from

22 + 20 + 0 + 10 + 4 + 10 = 66. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity0 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 0 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs10 / 10

A real summary, a README with depth, listed tools.

Docs: 10 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "tthanh2k6-supabase-rls-check": {      "command": "uvx",      "args": [        "supabase-rls-check"      ]    }  }}

Environment variables

This server does not declare environment variables.

Tools3Tool docs quality grade D

All capabilities
  • 1. Export catalog metadata with

  • commented review template wrapped in BEGIN; ... ROLLBACK;. The tool never runs it. Replace userid with your ownership column and test on staging first.

  • standalone, works offline, A4 landscape print stylesheet for Save as PDF.

About

supabase-rls-check

PyPI

A command-line tool that reads PostgreSQL catalog metadata from a Supabase project and flags Row Level Security (RLS) mistakes: tables without RLS, USING (true) policies, SECURITY DEFINER functions callable by anon, public Storage buckets and 16 other patterns. It also scans a local app folder for leaked service_role keys. It never needs a database password or a service_role key, and it never reads table rows. It also ships as an MCP server and a GitHub Action. Python 3.11+, PostgreSQL 15+.

It is for people who ship a Supabase app with the anon key in the browser and want to check what that key can reach. It is a review aid, not a penetration test (see Limitations).

pipx install supabase-rls-check      # or: uvx supabase-rls-check --help
supabase-rls-check report --from demo/todo_ai.csv --out-dir demo --project "todo-ai (fictional demo)" --i-own-this-project

The second command runs on the fictional dataset in demo/todo_ai.csv:

rule,schema_name,object_name,policy_name
rls_disabled,public,todos,
policy_true,public,profiles,read_every_profile
public_bucket,storage,todo-attachments,

It writes demo/report.md, demo/report.html and demo/fix.sql. The Markdown report contains this table:

SeverityFinding / objectEvidence
HighUnconditional policy expression: public.profilespolicy_true: read_every_profile
HighRow security is disabled: public.todosrls_disabled
MediumStorage bucket is public: storage.todo-attachmentspublic_bucket

fix.sql is a review template that starts with BEGIN; and ends with ROLLBACK;. It enables RLS on profiles and todos and leaves a commented example policy for you to adapt.

Sample HTML report preview

Install

pipx install supabase-rls-check
pipx install "supabase-rls-check[mcp]"   # adds the MCP server (mcp>=1.10)
pip install -e ".[dev]"                  # from a source checkout

Usage

1. Export catalog metadata with check.sql

supabase-rls-check sql --print-sql > check.sql

Paste check.sql into the Supabase SQL Editor, adjust the sensitive-table name pattern if needed, run it, and export the single result set as CSV or JSON (columns rule,schema_name,object_name,policy_name,basis). The query reads catalogs only, never application rows. The query file is also at src/supabase_rls_check/sql/check.sql.

Validate and normalize the export:

supabase-rls-check sql --from export.csv --out sql_results.json --i-own-this-project

2. Optional: check anonymous read access with probe

probe asks your project, with the public key only, which tables an unauthenticated visitor can read. With --site it also looks for a service_role JWT in your frontend.

supabase-rls-check probe \
  --url https://YOUR_PROJECT.supabase.co \
  --anon-key YOUR_ANON_OR_PUBLISHABLE_KEY \
  --site https://your-app.example \
  --out probe_results.json \
  --i-own-this-project
  • Pass the project origin to --url, not /rest/v1/.
  • Only anon JWTs and sb_publishable_ keys are accepted. service_role and authenticated tokens are rejected before any request is sent.
  • If OpenAPI discovery is off on PostgREST, name the tables yourself with --tables todos profiles.
  • Set SUPABASE_ANON_KEY instead of --anon-key to keep the key out of shell history.

It adds two findings: anon_readable (High; column names and visible row count only) and service_role_exposed (Critical; a JWT with role = "service_role" found in the page HTML or a same-origin script).

3. Build the report

supabase-rls-check report \
  --from sql_results.json probe_results.json \
  --out-dir review_out \
  --project "My Supabase App" \
  --i-own-this-project

Output in review_out/:

  • report.html: standalone, works offline, A4 landscape print stylesheet for Save as PDF.
  • report.md: summary for issues or pull requests.
  • fix.sql: commented review template wrapped in BEGIN; ... ROLLBACK;. The tool never runs it. Replace user_id with your ownership column and test on staging first.

Add --lang vi for Vietnamese text. A Vietnamese demo is in demo/vi/report.md.

Scan your app folder for leaked secrets

scan-env reads local files only, needs no network and no consent flag, and masks every secret it prints (first 6 characters, then …, then last 4).

supabase-rls-check scan-env . --out envscan.json
supabase-rls-check report --from sql_results.json envscan.json --out-dir review_out --project "My Supabase App" --i-own-this-project

It reads .env, .env.*, app.json, app.config.*, eas.json, AI agent and MCP config files (.claude/settings.json, .claude/settings.local.json, .cursor/mcp.json, .mcp.json, .vscode/mcp.json) and client source files (*.js, *.jsx, *.ts, *.tsx, *.mjs, *.cjs, *.vue, *.svelte). It skips node_modules, .git, virtualenvs, build output (dist, build, web-build, android/app/build, ios/build, ios/Pods), binary files and files over 2 MB.

It reports:

  • public_env_service_role (Critical) and public_env_secret_key (High): secrets in variables that get bundled into the client (EXPO_PUBLIC_, NEXT_PUBLIC_, VITE_, REACT_APP_, PUBLIC_, NUXT_PUBLIC_).
  • service_role_in_client_code and db_url_in_client_code (both Critical): service_role JWTs, sb_secret_ keys or Postgres URLs with a password in client files. supabase/functions/, server/, api/, scripts/ and backend/ are excluded.
  • agent_config_secret (Critical): the same secrets in agent or MCP config files, reported with the file path and, for valid JSON, the key path.

The anon JWT and sb_publishable_ keys belong in a client app and are never reported. Matching is line by line, so obfuscated, split or encoded keys can be missed.

Explain a rule, run the MCP server

supabase-rls-check explain rls_disabled
supabase-rls-check explain definer_anon_exec
supabase-rls-check mcp        # needs the [mcp] extra; stdio transport

The MCP server has five local, read-only tools: analyze_sql_export(path), explain_rule(rule), scan_public_env(path), diff_results(old_path, new_path) and list_rules(). Rule listing and export analysis use the same rule table, including the Realtime and MFA checks. probe is not exposed, so an AI client never handles your API key or makes HTTP requests through this tool.

Compare two runs with diff

supabase-rls-check diff \
  --old baseline_results.json \
  --new sql_results.json \
  --out diff.json \
  --fail-on-new high

diff lists findings that are new or resolved between two local CSV or JSON files. With --fail-on-new (critical, high, medium or low) it exits 1 when a new finding at or above that severity appears. A finding is keyed by (rule, schema_name, object_name, policy_name, basis). basis says why a heuristic rule fired, for example table name matches pattern 'payment' or table comment tag 'pii'. Adding a pii comment to a table therefore shows up as a new finding, and the earlier pattern-based one as resolved. JSON files without a basis key still load, with basis set to "".

One consequence: a baseline exported before 0.6.1 lists an extension-owned table with an empty basis. The first diff against it reports that table as new (with owned by extension <name>) and the old entry as resolved, so --fail-on-new high exits 1 once. Export the baseline again with 0.6.1 or later to clear it.

GitHub Action

The repository is a composite action. It runs check.sql with psql inside a default_transaction_read_only session, writes report.md, report.html and fix.sql, adds a summary table to the job page, and fails the job when a finding is at or above fail-on. Unlike the flow above, it needs a Postgres connection string. Store it as a repository secret and point it at staging or a read-only role. The action refuses to run unless i-own-this-project is "true". Outputs: findings (total) and failing (at or above fail-on).

name: RLS check
on: [pull_request]
jobs:
  rls:
    runs-on: ubuntu-latest
    steps:
      - uses: Tthanh2k6/supabase-rls-check@main
        with:
          database-url: ${{ secrets.STAGING_DATABASE_URL }}
          i-own-this-project: "true"
          fail-on: High        # Critical, High, Medium, Low or none
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: rls-report
          path: rls-report/

To catch schema drift outside pull requests, run check.sql on a schedule and diff it against a baseline, for example .rls-baseline.json committed to the repository:

name: RLS drift check
on:
  pull_request:
  schedule:
    - cron: "0 6 * * *"
jobs:
  drift:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Run check.sql and diff against baseline
        env:
          DATABASE_URL: ${{ secrets.STAGING_DATABASE_URL }}
        run: |
          python -m pip install supabase-rls-check
          supabase-rls-check sql --print-sql > check.sql
          PGOPTIONS='-c default_transaction_read_only=on' \
            psql "$DATABASE_URL" -v ON_ERROR_STOP=1 --csv -f check.sql > current.csv
          supabase-rls-check sql --from current.csv --out current.json --i-own-this-project
          supabase-rls-check diff \
            --old .rls-baseline.json \
            --new current.json \
            --out diff.json \
            --fail-on-new high
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: rls-diff
          path: |
            current.json
            diff.json

Rules

check.sql has 20 rules. It queries PostgreSQL 15+ system catalogs and storage.buckets in one read-only query. The table also lists two scan-env rules that read local files.

Rule IDSeverityWhat it flags
rls_disabledHighTable or partitioned table in public with RLS off. If an extension owns the table (for example PostGIS spatial_ref_sys), it is still reported with basis = owned by extension <name>, and fix.sql suggests moving the extension to an extensions schema, because ENABLE ROW LEVEL SECURITY fails there with "must be owner" (see supabase/supabase discussion #52767). Detection uses pg_depend (deptype = 'e') and covers direct extension members only. Some extensions cannot be relocated, so check first.
policy_trueHighPolicy in public with USING (true) or WITH CHECK (true).
policy_true_writableCriticalPermissive UPDATE, DELETE or ALL policy for anon, authenticated or public with USING (true), on a table where anon or authenticated holds UPDATE or DELETE. Anyone with that role can change or delete every row.
sensitive_anon_policyHighPolicy granted to anon or public on a table whose name matches user, profile, order, payment, invoice, customer, patient, secret, token or document, or that has a pii table comment. basis records which one matched.
definer_anon_execHighNon-trigger SECURITY DEFINER function in public that anon can execute (callable at /rest/v1/rpc/*).
definer_search_pathHighSECURITY DEFINER function in public with no fixed search_path.
view_not_invokerHighView in public without security_invoker, so it runs with the owner's privileges.
public_bucketMediumStorage bucket with public = true.
public_bucket_listableMediumPublic bucket that also has an anon or public SELECT (or ALL) policy on storage.objects matching the bucket id or true, so anyone can list its file names.
public_extensionLowExtension installed in public instead of an extensions schema.
policy_user_metadataHighPolicy in public that reads user-editable user_metadata from auth.jwt() or request.jwt.claims. Use app_metadata or an authorization table.
policy_auth_per_rowLowPolicy on an RLS-enabled table that calls auth.uid(), auth.jwt(), auth.role() or current_setting() without a sub-select. This is a performance finding: write (select auth.uid()).
auth_users_exposedCriticalView in public that depends directly on auth.users, lets anon or authenticated SELECT, and is materialized or lacks security_invoker.
matview_api_exposedHighMaterialized view or foreign table in public that anon or authenticated can SELECT. RLS does not apply to materialized views, so every row is readable through the Data API.
policy_any_authenticatedMediumPolicy that only checks the caller is signed in (auth.role() = 'authenticated' or auth.uid() IS NOT NULL), so every account gets the same access.
secret_column_exposedMediumColumn in public named or ending in api_key, apikey, secret, client_secret, access_token, refresh_token, private_key or password that anon or authenticated can SELECT (basis = column name). RLS limits rows, but the client still receives the plaintext value.
definer_trusts_id_argMediumSECURITY DEFINER function in public, executable by anon or authenticated, with an argument ending in _id or equal to uid, user, org or tenant, whose source never references auth.uid() or auth.jwt() (basis = argument names). Needs review: it misses functions that delegate the check to a helper and may flag ones that validate the ID against a membership table.
db_url_in_client_codeCriticalscan-env: a postgres(ql)://user:password@ URL in a client-bundled file. Placeholders such as ${DB_PASSWORD} are ignored.
realtime_messages_no_policyMediumrealtime.messages has RLS enabled but no policy explicitly targeting authenticated or PUBLIC; private channel joins lack authorization. Skips missing Realtime objects; inherited roles are not resolved.
realtime_messages_policy_trueHighA policy on realtime.messages for anon, authenticated or PUBLIC has constant true in USING or WITH CHECK (basis = policy name and command). Review effective grants and restrictive policies before inferring access to every private topic.
mfa_table_without_aal2MediumReview needed: a table in public tagged mfa in its comment or named mfa_* / *_mfa lacks a RESTRICTIVE policy expression containing auth.jwt() and aal2 (case-insensitive, whitespace tolerant). basis identifies the tag or name convention. This does not verify command/role coverage or prove MFA enforcement.
agent_config_secretCriticalscan-env: an sb_secret_ key, service_role JWT or Postgres URL with a password in an agent or MCP config file.

policy_true_writable, policy_user_metadata, policy_auth_per_row, auth_users_exposed, matview_api_exposed, public_bucket_listable, policy_any_authenticated, secret_column_exposed, definer_trusts_id_arg and all three Realtime/MFA rules add only commented guidance to fix.sql, never DDL. To make sensitive_anon_policy independent of table names, tag tables with COMMENT ON TABLE public.x IS 'pii'.

Realtime and MFA: Private Broadcast/Presence channels use realtime.messages policies: SELECT authorizes receiving and INSERT authorizes sending; scope them by realtime.topic() and membership (Realtime authorization). To opt a table into MFA review, use COMMENT ON TABLE public.x IS 'mfa' or the name conventions above. An aal2 check in a PERMISSIVE policy can be bypassed by another permissive grant, so the check looks for RESTRICTIVE (MFA guide). These are catalog heuristics; test channel access and both aal1/aal2 sessions separately.

Some rules overlap on purpose. policy_true fires on the same policy as policy_true_writable. A materialized view over auth.users produces both auth_users_exposed and matview_api_exposed. A regular view over auth.users can also trigger view_not_invoker. A listable public bucket produces both public_bucket and public_bucket_listable.

Policy checks are heuristics over PostgreSQL's deparsed SQL. The per-row auth check only recognizes calls wrapped directly in a SELECT; complex subqueries need manual review. The auth.users check follows direct dependencies and returns nothing when auth.users does not exist.

How it is tested

  • pytest runs the offline suite (python -m pytest -q; probe tests block real HTTP requests). It covers consent, probing limits and redaction, scan-env, diff, escaping, English/Vietnamese output, exports for all 20 catalog rules, and MCP tools (including list_rules, excluding probe). Live PostgreSQL tests skip unless RLS_CHECK_TEST_DATABASE is explicitly set.
  • GitHub Actions runs check.sql on PostgreSQL 15. tests/fixtures/seed_pg.sql plants issues for 19 rules next to controls, and CI compares 38 expected findings (with basis) exactly. The mutually exclusive no-policy case uses seed_realtime_no_policy.sql and realtime_no_policy.csv. CI also checks missing Auth/Realtime objects, anonymous-only and PUBLIC policies, disabled RLS, both policy expressions and restrictive MFA checks.
  • A second CI job, diff-e2e (also runnable as scripts/e2e_diff.py with psql available), applies a small schema, builds a report, reruns unchanged (diff --fail-on-new high exits 0), adds COMMENT ON TABLE ... IS 'pii', reruns, and checks that the same command now exits non-zero on sensitive_anon_policy.

Safety rules

  • Use it only on projects you own or have written permission to test, including any --site domain. Commands that process project exports or targets need --i-own-this-project or --have-written-consent, and exit before touching the network without one.
  • probe sends GET and HEAD only. It does not follow redirects, sets trust_env to false, caps responses at 5 MB and uses a 20 second timeout.
  • probe asks for at most limit=1 row per relation, keeps it in memory, extracts column names, discards the values and replaces JWT patterns with [REDACTED] in metadata and error messages.

Limitations

This is a configuration and anonymous-read review aid. It is not a penetration test or a security certification.

  • Findings are review signals. A public bucket or an anonymous SELECT policy is sometimes intended.
  • An empty result, an HTTP 200 [] or a 401/403 on one request does not show the project is safe.
  • It does not test cross-user isolation between authenticated users, INSERT/UPDATE/DELETE permissions, function bodies, Edge Functions, custom Auth hooks or complex storage.objects policy combinations.
  • --site reads the entry HTML and up to 20 directly linked same-origin HTTPS <script src> files. Dynamically imported chunks, source maps, split or obfuscated tokens and sb_secret_* keys are outside its reach, and JWT signatures are not verified.
  • fix.sql is a starting template ending in ROLLBACK;. A new permissive policy does not override existing broad ones. Export the current policies and grants, and test with two users on staging before committing changes.

Related

  • Agent skill for Claude Code, Cursor, Codex and other SKILL.md agents: Supabase RLS Review on Agensi. It walks the agent through the review, policy fixes and a two-user isolation test on staging.
  • MCP listings: Glama and mcprush.
  • Paid manual review of RLS policies, SECURITY DEFINER bodies and two-user isolation on staging, from $69 (report plus a ROLLBACK-wrapped fix script): Upwork, Contra.

License

Code: MIT License, Copyright (c) 2026 Trung Thanh Tran. The Bricolage Grotesque report fonts in assets/ are under the SIL Open Font License 1.1 (assets/BricolageGrotesque-OFL.txt).

Frequently asked questions

What is supabase-rls-check MCP Server?

Read-only Supabase RLS checks: explain rules, analyze/diff SQL exports, scan public env vars.

How do I install supabase-rls-check MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. supabase-rls-check MCP Server runs locally from the PyPI package supabase-rls-check with the command uvx supabase-rls-check.

Is supabase-rls-check MCP Server free and open source?

Yes. supabase-rls-check MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does supabase-rls-check MCP Server support remote (HTTP) connections?

No remote endpoint is listed for supabase-rls-check MCP Server. It runs locally on your machine over stdio, started by your MCP client.

What tools does supabase-rls-check MCP Server provide?

supabase-rls-check MCP Server provides 3 tools: check.sql, fix.sql, and report.html. See the full tool list for descriptions and parameters.

How is supabase-rls-check MCP Server's trust score calculated?

supabase-rls-check MCP Server scores 66 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

—Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server