RattleCheck GitHub

Review Supabase migrations locally

RattleCheck is an open-source local MCP server and CLI for Supabase migration review. It reads the PostgreSQL files in supabase/migrations in order and flags row-level security (RLS) mistakes and overly broad column grants before you merge.

Run it on a checkout

From the repository root, run this command with Node.js 20 or newer. The first install fetches the package from npm. The static review itself works offline and requires no database credentials.

npx rattlecheck@latest --json

Start with coverage.tables. If it is zero, the scan gives you no evidence about table permissions. For each finding, the report gives the rule, object, migration file, and SQL line where available.

Use it from an MCP client

Configure a local stdio server with the command npx and these arguments. Clients that use an mcpServers configuration accept this entry.

{
  "mcpServers": {
    "rattlecheck": {
      "command": "npx",
      "args": ["-y", "rattlecheck@latest", "mcp"]
    }
  }
}

When the server starts in the repository root, this tools/call request reviews that checkout. If the client starts elsewhere, set path to the absolute project directory containing supabase/migrations.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "scan",
    "arguments": { "path": ".", "live": false }
  }
}

Find the server in the official MCP Registry

What changed in the pull request?

Scan the full migration history twice, once at the merge base and once at the PR head. Compare findings by rule, object, and affected field. An older grant can still apply after a later migration adds a column, so checking only the changed SQL can miss the reason a new field is readable.

In the public directory example, anonymous visitors should see a display name. A table-wide SELECT also gives them private_email. RattleCheck reports RC006. After the migration revokes the table grant and grants access to just id and display_name, RC006 clears. The warning about intentionally public rows remains. Compare the two grants and scanner reports.

Review views, custom role memberships, and policies whose correctness depends on your business rules separately. Local files also cannot show changes made only in a hosted database. Read the column rule’s coverage.