supabase-axi

August 9, 2026 ยท View on GitHub

Supabase for AI agents. An AXI that talks to the Supabase Management API directly.

$ supabase-axi schema users
table: public.users
rls: ON
policies: 5
rows: 2
columns[10]{name,type,nullable,default}:
  id,uuid,NO,gen_random_uuid()
  email,text,NO,null
  ...

Install

npm install
npm run build
npm link

Needs Node 20+ and a personal access token:

export SUPABASE_ACCESS_TOKEN=sbp_...

Project ref comes from --project, SUPABASE_PROJECT_REF, project_id in a nearby supabase/config.toml, or the account's only project.

Usage

Explore the database:

supabase-axi                    # project overview
supabase-axi schema             # tables; `schema <table>` for one
supabase-axi query "select 1"   # read only unless --write
supabase-axi count <table>

Find what is wrong:

supabase-axi rls                # unprotected tables first
supabase-axi indexes            # least used first
supabase-axi advisors           # --type performance, --rule <name>
supabase-axi logs postgres      # --since 6h, --level ERROR

Everything else:

supabase-axi projects           # projects view <ref>, orgs
supabase-axi functions          # functions view <slug>
supabase-axi migrations         # migrations apply <name> --sql ... --write
supabase-axi keys               # secrets, branches, extensions
supabase-axi types              # > src/database.types.ts
supabase-axi docs "rls"
supabase-axi setup hooks        # session context for your agent

--help works on every command. Every command that takes an argument also works without one, and lists.

Behaviour

  • Errors print to stdout as structured data. Exit 0 success, 1 error, 2 usage error.
  • Writes need --write. Reads run inside BEGIN TRANSACTION READ ONLY, so Postgres enforces it rather than a keyword blocklist.
  • service_role, secret keys, and secret values are never printed. The access token never appears in output or errors.
  • Rows, log lines, and doc excerpts are untrusted input. A bio column can contain instructions. Mitigated, not solved.

Development

npm test
npm run build
npm run format

License

MIT