How to connect Supabase to Toolspoke
Let your Toolspoke agents read your Supabase projects, schema, advisors and logs, and optionally run SQL and apply migrations. A scoped personal access token for the Management API, and an agent that checks your projects for you.
Checked against Supabase's documentation on 2026-11-25.
Toolspoke's Supabase toolkit calls the Supabase Management API at https://api.supabase.com/v1 with a personal access token. It doesn't use your project's anon or service role keys, and it doesn't connect to Postgres with a password. Once it's installed, any agent in the project can use it.
Supabase now lets you scope a personal access token to particular projects and permissions. This guide uses that to give your agents exactly what they need: schema, advisors and logs first, and writes only if you add them. Then it builds an agent that runs the security advisor every week. It takes about five minutes.
What an agent can do once it's connected
The toolkit has 20 named actions. Eighteen of them only read:
- Projects:
list_projectsreturns every project the token can reach, with the project ref the other actions need.get_projectandcheck_healthsay whether a project and its services are up. - Schema:
list_tableslists tables and views with row estimates and whether row-level security is on.list_table_columnsadds every column.generate_typescript_typesproduces types for your client code. - Migrations and advisors:
list_migrationsshows applied schema changes.list_advisorsruns Supabase's security or performance advisors, which flag things like missing RLS policies and unindexed foreign keys. - Edge functions and storage:
list_edge_functionsandlist_storage_buckets, including whether each bucket is public. - Logs:
logs_api,logs_postgres,logs_auth,logs_storage,logs_realtime,logs_edge_function,logs_edge_function_runtimeandlogs_branch_action. Each returns the 50 most recent lines, from the last minute unless the agent passes a time range.
The other two change things:
| Action | What it changes | Kind |
|---|---|---|
query | Runs SQL against the project's database. Read-only by default, but can be told to write | Write |
apply_migration | Applies a named DDL migration and records it in the migration history | Write |
Both act on the real database of whichever project the agent picks, which may be production. You decide which of these your agents may call (step 3).
What you need
- A Supabase account with a role on the organization or projects your agents should reach. A token can never do more than your own role allows.
- A Toolspoke workspace, and a project to install the toolkit in.
Step 1: Create a scoped personal access token
Supabase still lets you create a token with your account's full access, shown with a Legacy badge. Don't use one for Toolspoke. A full-access token reaches every organization and project you belong to, including ones you create later.
- Open the Supabase dashboard, select your profile icon, choose Account, then Access Tokens. The direct address is
supabase.com/dashboard/account/tokens. - Generate a new token and give it a name, for example
toolspoke. - Choose the resources: the organization, and only the projects your agents should see.
- Grant these permissions with Read access for the eighteen read actions:
| Permission | Access | Unlocks |
|---|---|---|
| Projects (account-wide) | Read | list_projects |
| Project Settings | Read | get_project, check_health |
| Database | Read | list_tables, list_table_columns, generate_typescript_types, query |
| Migrations | Read | list_migrations |
| Advisors | Read | list_advisors |
| Edge Functions | Read | list_edge_functions |
| Storage | Read | list_storage_buckets |
| Logs | Read | all eight logs_* actions |
- Add Migrations with Read-write only if agents should run
apply_migration. - Set an expiry. Supabase offers preset durations, a custom date up to a year out, or no expiry.
- Copy the token. Scoped tokens start with
sbp_fc.
- Account
- Access Tokens
Leave out API Keys, API Key Secrets and Edge Function Secrets. None of the toolkit's actions need them.
Note the Database row. Supabase lists the endpoint behind query under Database (Read), and the toolkit's list_tables and list_table_columns use the same endpoint. So any token that can list your tables can also reach query. The token isn't what keeps an agent from writing with SQL. The query switch in step 3 is.
Step 2: Install the Supabase toolkit in Toolspoke
- In Toolspoke, open the project your agents work in. Find Supabase in the marketplace and add it.
- Paste the Personal access token from step 1.
list_projects answered. The credential works.
There's no URL to enter. The toolkit always calls api.supabase.com, for every region.
Toolspoke checks the connection by listing projects. If that fails, see Troubleshooting.
The token is encrypted at rest and attached to each request by the gateway. The agent never sees it, and it never appears in the arguments an agent sends or in the audit log.
Step 3: Decide what agents may change
In the project's toolkit settings, Supabase's actions are grouped as read, write and destructive. Each one can be switched on or off for everyone in the project. An action that's switched off can't be called, whatever the prompt says.
A sensible start: leave the eighteen reads on, switch off query and apply_migration, and then decide about each one separately.
Supabase actions in your project
Agents can call 18 of 20, and none of them change anything.
list_projectsList the Supabase projects this access token can reach, with their project ref, region and status.get_projectFetch one project's name, region, status and Postgres version.check_healthReport the health of a project's services (auth, db, pooler, realtime, rest, storage).list_tablesList the tables and views in a project's database with their row estimates and whether row-level security is on.list_table_columnsList tables and views together with every column's name, type and nullability.list_migrationsList the migration history recorded for a project, newest last.list_advisorsRun Supabase's security or performance advisors and return the outstanding lints — missing RLS policies, exposed views, unindexed foreign keys, unused indexes.list_edge_functionsList a project's deployed edge functions with their slug, status and version.list_storage_bucketsList a project's storage buckets and whether each one is public.generate_typescript_typesGenerate TypeScript types for a project's database schema, ready to paste into a Database type file.logs_apiAPI and edge request logs: method, path and response status for each request.logs_postgresPostgres server logs, including query errors and their severity.logs_edge_functionEdge function request logs, with per-invocation execution time and status.logs_edge_function_runtimeOutput written by edge function code itself — console logs and uncaught errors.logs_authAuth service logs: sign-ins, token refreshes, and the reason a login failed.logs_storageStorage service logs.logs_realtimeRealtime service logs.logs_branch_actionBranch workflow run logs.
queryRun SQL against the project's Postgres database and return the result rows.apply_migrationApply a named DDL migration to the project's database and record it in the migration history.
queryis the one people want, because "how many signups last week" is a SQL question. It runs read-only unless the agent sets it to write. If your token reaches production, think about whether you're comfortable with that being one argument away. Results come back to the agent verbatim and are recorded in the audit log, so be careful with tables holding personal data.apply_migrationchanges your schema and records it. Leave it off for production projects, and on for a development project if you want an agent to draft and apply migrations there.
If you want both, the cleanest split is two tokens: one scoped to development with Migrations Read-write, and one scoped to production with Read only. Install them in separate Toolspoke projects and switch the write actions off in the production one.
Every call is recorded with the agent and person behind it, the request, the response and the duration.
Step 4: Build an agent that uses it
In Toolspoke, create an agent and describe its job in one sentence. The builder proposes the instructions, the toolkits it needs, a schedule and where it should answer. You add or skip each one, then create the agent. Every piece stays editable afterwards.
It only reads, so it works with query and apply_migration switched off. The same agent answers when someone asks it in Slack or emails it, and it replies in the thread it was asked in.
Try it
Ask the agent in Slack, by email or in its chat:
- Which of my Supabase projects are paused or unhealthy?
- Run the security advisor on acme-prod. Which tables have RLS turned off?
- List the tables in the public schema with their row estimates.
- Logins started failing ten minutes ago. Check the auth logs and tell me why.
- Show Postgres errors from the last hour.
- How many rows were added to orders yesterday?
- Write a migration that adds an index on orders.customer_id, apply it to acme-dev, then rerun the performance advisor.
The last two need query and apply_migration switched on. Logs default to the last minute. If the agent finds nothing, ask for a specific window, like "the last two hours". The Supabase toolkit page lists every action.
Troubleshooting
401 on every call.
The token is wrong, revoked or expired. Check the Expires column under Account → Access Tokens, then generate a new one and paste it in.
403 on some actions, while others work.
The scoped token lacks the permission for that endpoint. Supabase returns 403 for an endpoint outside the token's scope. Match the action to the table in step 1, then create a token that has the permission and paste it in.
listprojects returns fewer projects than you expect.
The token is scoped to particular projects, or your own role doesn't reach the others. A token's permissions only narrow your role, never extend it.
429 Too Many Requests.
The Management API allows 120 requests a minute per user, per project or organization, per endpoint. Logs and migrations have their own limits. Wait for the reset and retry.
applymigration fails with 403 while listmigrations works.
The token has Migrations Read but not Read-write.
Questions
Does the agent get my service role key or database password?
No. The toolkit uses only the Management API with your access token, and none of its actions read API keys or secrets. The token itself is attached by Toolspoke's gateway and never shown to the agent.
Can an agent delete a project, pause it, or deploy edge functions?
No. The toolkit only has the 20 actions above. Project lifecycle, edge function deploys, secrets and branching aren't reachable through it.