KosmoKrator

data

Supabase Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Supabase KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.supabase.*. Use lua_read_doc("integrations.supabase") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic Supabase workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.supabase.get_current_user({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("supabase"))' --json
kosmo integrations:lua --eval 'print(docs.read("supabase.get_current_user"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local supabase = app.integrations.supabase
local result = supabase.get_current_user({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.supabase, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.supabase.default.* or app.integrations.supabase.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Supabase, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Supabase Lua Reference

Namespace: supabase

Supabase tools call the official Management API at https://api.supabase.com/v1 with Authorization: Bearer <access_token>. Use a personal access token for internal automation or an OAuth access token for third-party user authorization.

These tools manage Supabase account resources such as projects, organizations, members, and project API keys. They do not call a project’s generated Data REST API at https://<project_ref>.supabase.co/rest/v1/.

Common Patterns

List projects:

local projects = app.integrations.supabase.list_projects({})

Get a project:

local project = app.integrations.supabase.get_project({
  project_ref = "abcdefghijklmnopqrst"
})

Create a project:

local project = app.integrations.supabase.create_project({
  name = "Example App",
  db_pass = "use-a-secret-from-your-host",
  organization_slug = "example-org"
})

List organizations:

local organizations = app.integrations.supabase.list_organizations({})

List organization projects:

local projects = app.integrations.supabase.list_organization_projects({
  slug = "example-org",
  limit = 20
})

Get project API keys:

local keys = app.integrations.supabase.get_project_api_keys({
  project_ref = "abcdefghijklmnopqrst"
})

Tool Families

  • Account: get_current_user
  • Projects: list_projects, get_project, create_project, delete_project, get_project_api_keys
  • Organizations: list_organizations, get_organization, list_organization_members, list_organization_projects

For create_project, pass either the documented fields directly (name, db_pass, organization_slug, plus optional fields such as region) or a full body object if you need a newer Management API field before this package adds a first-class parameter.

Use fake project refs, organization slugs, database passwords, and API keys in examples and tests. Do not store real Supabase access tokens, project refs, organization slugs, or project API keys in committed fixtures.

Raw agent markdown
# Supabase Lua Reference

Namespace: `supabase`

Supabase tools call the official Management API at `https://api.supabase.com/v1` with `Authorization: Bearer <access_token>`. Use a personal access token for internal automation or an OAuth access token for third-party user authorization.

These tools manage Supabase account resources such as projects, organizations, members, and project API keys. They do not call a project's generated Data REST API at `https://<project_ref>.supabase.co/rest/v1/`.

## Common Patterns

List projects:

```lua
local projects = app.integrations.supabase.list_projects({})
```

Get a project:

```lua
local project = app.integrations.supabase.get_project({
  project_ref = "abcdefghijklmnopqrst"
})
```

Create a project:

```lua
local project = app.integrations.supabase.create_project({
  name = "Example App",
  db_pass = "use-a-secret-from-your-host",
  organization_slug = "example-org"
})
```

List organizations:

```lua
local organizations = app.integrations.supabase.list_organizations({})
```

List organization projects:

```lua
local projects = app.integrations.supabase.list_organization_projects({
  slug = "example-org",
  limit = 20
})
```

Get project API keys:

```lua
local keys = app.integrations.supabase.get_project_api_keys({
  project_ref = "abcdefghijklmnopqrst"
})
```

## Tool Families

- Account: `get_current_user`
- Projects: `list_projects`, `get_project`, `create_project`, `delete_project`, `get_project_api_keys`
- Organizations: `list_organizations`, `get_organization`, `list_organization_members`, `list_organization_projects`

For `create_project`, pass either the documented fields directly (`name`, `db_pass`, `organization_slug`, plus optional fields such as `region`) or a full `body` object if you need a newer Management API field before this package adds a first-class parameter.

Use fake project refs, organization slugs, database passwords, and API keys in examples and tests. Do not store real Supabase access tokens, project refs, organization slugs, or project API keys in committed fixtures.
Metadata-derived Lua example
local result = app.integrations.supabase.get_current_user({})
print(result)

Functions

get_current_user Read

Get the currently authenticated Supabase user profile information.

Lua path
app.integrations.supabase.get_current_user
Full name
supabase.supabase_get_current_user
ParameterTypeRequiredDescription
No parameters.
list_projects Read

List all Supabase projects in the organization. Returns project IDs, names, and regions.

Lua path
app.integrations.supabase.list_projects
Full name
supabase.supabase_list_projects
ParameterTypeRequiredDescription
No parameters.
get_project Read

Get details of a specific Supabase project by its reference ID.

Lua path
app.integrations.supabase.get_project
Full name
supabase.supabase_get_project
ParameterTypeRequiredDescription
project_ref string yes The project reference ID.
create_project Write

Create a Supabase project in an organization using the Management API.

Lua path
app.integrations.supabase.create_project
Full name
supabase.supabase_create_project
ParameterTypeRequiredDescription
name string yes Project name.
db_pass string yes Initial database password for the project.
organization_slug string yes Organization slug that owns the project.
region string no Optional legacy region value accepted by Supabase.
desired_instance_size string no Optional compute size accepted by Supabase.
body object no Optional full request body. Overrides individual fields when present.
delete_project Write

Delete a Supabase project by project ref.

Lua path
app.integrations.supabase.delete_project
Full name
supabase.supabase_delete_project
ParameterTypeRequiredDescription
project_ref string yes Project ref.
list_organizations Read

List Supabase organizations visible to the authenticated account.

Lua path
app.integrations.supabase.list_organizations
Full name
supabase.supabase_list_organizations
ParameterTypeRequiredDescription
No parameters.
get_organization Read

Get a Supabase organization by slug.

Lua path
app.integrations.supabase.get_organization
Full name
supabase.supabase_get_organization
ParameterTypeRequiredDescription
slug string yes Organization slug.
list_organization_members Read

List members of a Supabase organization.

Lua path
app.integrations.supabase.list_organization_members
Full name
supabase.supabase_list_organization_members
ParameterTypeRequiredDescription
slug string yes Organization slug.
list_organization_projects Read

List Supabase projects for an organization.

Lua path
app.integrations.supabase.list_organization_projects
Full name
supabase.supabase_list_organization_projects
ParameterTypeRequiredDescription
slug string yes Organization slug.
offset integer no Offset for pagination.
limit integer no Maximum number of projects to return.
get_project_api_keys Read

Get API keys for a Supabase project.

Lua path
app.integrations.supabase.get_project_api_keys
Full name
supabase.supabase_get_project_api_keys
ParameterTypeRequiredDescription
project_ref string yes Project ref.