Rls Doctor logo

Rls Doctor

Audits Postgres/Supabase RLS and runs rollback-only probes to verify row access.

Install Rls Doctor

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "rls-doctor": {
      "command": "npx",
      "args": [
        "-y",
        "rls-doctor"
      ],
      "env": {
        "DATABASE_URL": "YOUR_VALUE_HERE",
        "SUPABASE_DB_URL": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

The install command installed and started the server, which then stopped for configuration (such as an API key) that our sandbox does not have — expected for servers that connect to your account.

npx -y rls-doctor

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The rls-doctor MCP server audits PostgreSQL and Supabase Row Level Security configuration and exposes read-only analysis over MCP. It reads catalog metadata, evaluates policies, roles, grants, memberships, and default privileges, then reports findings by severity. Its probe capability impersonates application roles, sets Supabase JWT claims, and counts accessible rows inside a transaction that rolls back. Use it when static policy review is insufficient or you need to test cross-tenant isolation.

Use cases

  • Audit Supabase schemas for high-risk RLS policies
  • Probe cross-tenant row visibility for application roles
  • Explain the effective RLS configuration of a table
  • Run read-only RLS checks against a production replica
  • Compare static policy analysis with disposable-database behavior

Key features

  • PostgreSQL and Supabase RLS catalog auditing
  • Rollback-only behavioral row-access probes
  • Role, membership, grant, and default-privilege analysis
  • Severity-based findings with JSON and SARIF output
  • Schema-file and migration analysis without a database
  • Read-only MCP tools over stdio

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

8/8 checks healthy over the last 32d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · rls-doctor (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads522Package downloads in the last 30 days.
Last commit11d agoMost recent push to the default branch.
Install checkRunsOur sandbox started it; it then asked for an API key or config.

How Rls Doctor works

What the rls-doctor MCP server does

The rls-doctor MCP server examines PostgreSQL or Supabase databases for configuration patterns that can expose rows or permit unintended writes. It focuses on Row Level Security, including whether RLS is enabled or forced, which policies apply, how roles reach tables, and whether privileges or role attributes bypass policy enforcement.

The audit reports findings with critical, high, medium, low, and informational severities. It can identify unconditional public-style policies, reachable TRUNCATE, application paths to SUPERUSER or BYPASSRLS, broad default privileges, missing effective write checks, permissive policy combinations, and tables that are disabled or inaccessible under RLS. It also reports current access separately from default privileges that affect future tables.

How it works

Static analysis reads database catalog information and applies PostgreSQL command semantics. SELECT and DELETE use USING; INSERT uses WITH CHECK; and UPDATE evaluates both. When an UPDATE or ALL policy omits WITH CHECK, the tool analyzes PostgreSQL’s fallback to the USING expression. Direct, inherited, and SET ROLE membership paths are included, along with PostgreSQL 16 membership options.

Behavioral verification is available through probe. The rls-doctor MCP server can impersonate specified application roles, set request.jwt.claims for supplied Supabase user IDs, and compare rows across owner or tenant columns. The operation runs in a read-only transaction and always rolls back, so it does not mutate the target database.

Setup and configuration

Install with npx rls-doctor, or install the package globally with npm. Node.js 20 or newer is required. Database access can come from DATABASE_URL or SUPABASE_DB_URL; a connection string may also be supplied directly to the command-line interface. Read-only audit credentials are recommended. Passing a secret through a command-line option can expose it in shell history and process listings.

The MCP entry point is started with the mcp command and serves read-only tools over stdio. Audit scope can be limited to one or more schemas, with public as the default. Generic PostgreSQL deployments should specify the application roles whose grants and memberships need to be assessed, rather than relying only on Supabase’s authenticated role.

Tools and capabilities

Available command capabilities include:

  • Auditing schemas and producing text, JSON, or SARIF findings.
  • Explaining the RLS configuration for an individual table.
  • Probing row visibility for application roles and simulated subjects.
  • Replaying migrations in disposable PostgreSQL and comparing static results with live behavior.
  • Proving isolation claims offline and generating repairs for verification in a shadow database.
  • Running a disposable demonstration that shows a cross-tenant leak.

Audit runs can fail on a selected severity, compare against a baseline, emit a score or badge URL, and write a digest-verified coverage receipt. Probe sampling supports configurable owner or tenant columns and row limits.

Limitations and notes

The probe requires application roles and is designed around PostgreSQL access patterns, with Supabase JWT claims used when subjects are supplied. It reports unavailable roles and probe errors separately from confirmed cross-owner or cross-subject reads. A successful static audit does not replace behavioral testing when policies depend on runtime identity or database state.

The tool is read-only for probing, but the broader command set includes repair generation and shadow verification; use the MCP interface when only the read-only capabilities are appropriate. RLS does not protect TRUNCATE, table owners can bypass RLS unless forced, and SUPERUSER or BYPASSRLS paths remain relevant even when FORCE ROW LEVEL SECURITY is enabled.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Rls Doctor

rls-doctor is an MCP server that connects to PostgreSQL and Supabase databases to audit Row Level Security and verify row visibility. Its main capabilities cover schema checks, table explanations, and rollback-only probes that impersonate application roles and test whether users can read other users’ or tenants’ rows.

Install it with `npx rls-doctor` or install the npm package globally with `npm install -g rls-doctor`. Node.js 20 or later is required. Start its MCP interface with the `mcp` command and provide database access through the supported connection environment variables.

Yes, rls-doctor supports Supabase databases and can simulate Supabase users by setting `request.jwt.claims` during probes. Supply application roles and, when needed, user UUIDs with the probe options to test whether each identity can read rows belonging to other subjects.

Yes, the probe opens a read-only transaction and always rolls it back, so it does not mutate the database. The project recommends read-only audit credentials and notes that a read replica can be used for this operation.

It detects issues including reachable tables with RLS disabled, unconditional public-like read or write policies, reachable `TRUNCATE`, bypass paths through privileged roles, broad default privileges, omitted effective `WITH CHECK` rules, and multiple permissive policies. Findings are assigned severity levels.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewRls Doctor AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/rls-doctor?style=directory)](https://allmcps.com/mcp/rls-doctor)
HTML Embed
<a href="https://allmcps.com/mcp/rls-doctor"><img src="https://allmcps.com/api/badge/rls-doctor?style=directory" alt="Rls Doctor on AllMCPs" /></a>