Also available: Markdown version · llms.txt · full site content
Agents
Using CubiBase with AI agents
CubiBase is built to be operated by AI agents end to end: discover the API, authenticate with a personal access token, and act through an MCP server, a CLI, or plain HTTPS.
The agent surfaces
| Surface | Where | What it is for |
|---|---|---|
| MCP server | npx -y @cubibasehq/mcp | Tools for chat and IDE agents (Claude, Cursor, Codex): projects, full schema, rows, SQL, storage uploads, function deployments, logs, Data API, docs search |
| CLI | npx -y @cubibasehq/cli | Shell agents and scripts; JSON output on stdout, structured errors on stderr. Same console parity as the MCP tools |
| TypeScript client | npm install @cubibasehq/client | Typed ControlClient and DataClient for code agents |
| Control API OpenAPI | https://api.cubibase.com/v1/openapi.json | OpenAPI 3.1 with operationIds and typed errors for the whole Control API |
| Data API OpenAPI | https://{slug}.api.cubibase.com/rest/v1/openapi.json | Per-project spec generated from the live schema: exposed tables, columns, filters, RPC functions |
| Skill file | https://cubibase.com/SKILL.md | A loadable skill (agentskills.io format) that teaches an agent the whole CubiBase workflow. Canonical repo: github.com/cubibase/skills; also inside the @cubibasehq/mcp and @cubibasehq/cli packages |
Source for all three packages: github.com/cubibase/cubibase-agent (MIT).
Authentication an agent can finish
Create a personal access token
Console → Account → Access tokens. Scope read for inspection, write for building, admin for destructive operations. Optionally restrict the token to one project.
Give the token to the agent
Set CUBIBASE_TOKEN in the agent environment (MCP env block or shell). The token is a cb_pat_… string, shown once.
Optional: add a service key for data access
For Data API tools, create a secret key (cb_sec_…) in the project’s API keys and set CUBIBASE_SERVICE_KEY. It acts as the service actor; row-level security still applies.
MCP setup
Add the server to any MCP client (Claude Desktop, Cursor, Codex, and others):
{
"mcpServers": {
"cubibase": {
"command": "npx",
"args": ["-y", "@cubibasehq/mcp"],
"env": {
"CUBIBASE_TOKEN": "cb_pat_…",
"CUBIBASE_SERVICE_KEY": "cb_sec_… (optional)"
}
}
}
}76 tools in seven groups. Projects: list, get, create, update, delete. Database: tables, columns, exposure, policies, PostgreSQL triggers, indexes, enum/composite types, views, rows (list/insert/update/delete), read-only SQL, SQL functions. Storage: bucket CRUD, object listing, cubibase_upload_file (end-to-end upload from text or base64), presigned upload URLs for large files, signed download links. Functions: create from source or template, deploy, activate deployments, secrets, http/database/storage/schedule triggers, test invocation, execution logs. Data API: cubibase_data_list, cubibase_data_rpc, cubibase_data_openapi. Observability: API keys, request logs, audit logs, usage, and cubibase_additional_usage (read-only V4.5 overage settings, per-resource excess and estimated costs, invoice preview — enabling overages stays a Console-only owner action). Docs: cubibase_search_docs searches the bundled documentation offline and returns excerpts with URLs.
| Environment variable | Effect |
|---|---|
CUBIBASE_READ_ONLY=1 | Hides every mutating tool from the tool list. Pair with a read-scope token for safe exploration agents |
CUBIBASE_FEATURES=database,storage | Only register the listed tool groups: projects, database, storage, functions, data, observability, docs |
{
"mcpServers": {
"cubibase": {
"command": "npx",
"args": ["-y", "@cubibasehq/mcp"],
"env": {
"CUBIBASE_TOKEN": "cb_pat_…",
"CUBIBASE_READ_ONLY": "1"
}
}
}
}CLI setup
export CUBIBASE_TOKEN=cb_pat_…
npx -y @cubibasehq/cli projects list
npx -y @cubibasehq/cli tables list <projectId>
npx -y @cubibasehq/cli rows list <projectId> notes --filter status=eq.active --limit 10
npx -y @cubibasehq/cli sql <projectId> 'select count(*) from notes'
npx -y @cubibasehq/cli storage upload <projectId> --bucket avatars --path u1.png --file ./u1.png
npx -y @cubibasehq/cli functions create <projectId> --name hello --file ./hello.ts
npx -y @cubibasehq/cli functions deploy <projectId> helloCommand groups: projects, tables, rows, sql, rpc, exposure, policies, triggers, indexes, types, views, storage, functions, keys, logs, usage, tokens. Every command prints JSON. Errors print {"error":{code,message,status,retryAfterSeconds}} to stderr and exit 1.
Errors and retries
- Every error carries a stable machine code (e.g. invalid_token, insufficient_scope, quota_exceeded) and a requestId for support.
- 429 responses include a Retry-After header (seconds). Wait, then retry — do not hammer.
- 401 means re-authenticate or check the token scope; 403 means the action is not allowed for this actor; 402 means a plan quota was reached.
- The full error catalogue is on the error codes reference page.
Machine-readable discovery files
- llms.txt — product summary and page index: https://cubibase.com/llms.txt
- llms-full.txt — the entire site content in one file: https://cubibase.com/llms-full.txt
- Markdown mirrors — every page is also served as {path}.md, e.g. https://cubibase.com/docs/quickstart.md
- Pricing as text: https://cubibase.com/pricing.md
- AI catalog: https://cubibase.com/.well-known/ai-catalog.json
- Skill file: https://cubibase.com/SKILL.md