scribase

Give Cursor a real backend: Postgres, auth and storage

Drop one JSON file into your project and Cursor can create a Scribase backend, run migrations after a row-level-security test, and ask before touching production.

1.Connect Cursor to Scribase

For clients that need a header, create an agent token (it starts with scb_agt_: scoped, expiring and revocable) and keep it in the SCRIBASE_ACCESS_TOKEN environment variable, never in the repository. Never hand an agent a personal access token or a service-role key. Cursor also supports MCP browser sign-in: remove the headers line and approve on the Scribase consent page.

.cursor/mcp.jsonjson
{
  "mcpServers": {
    "scribase": {
      "url": "https://api.scribase.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:SCRIBASE_ACCESS_TOKEN}"
      }
    }
  }
}

2.Tell it the rules

Cursor reads .cursor/rules/scribase.mdc on every task. These five lines keep it on the safe path: preview first, prove row-level security, ask before production.

.cursor/rules/scribase.mdcmarkdown
---
description: Scribase backend rules
alwaysApply: true
---

## Scribase backend
- The backend is Scribase (Postgres, Auth, Storage, Realtime). App code uses @supabase/supabase-js with the URL and anon key that `npx scribase init` writes.
- Never ask me for keys. To sign in, run `scribase login --json`, show me the link and code, and wait for my approval.
- Schema changes are SQL files in supabase/migrations/, rehearsed on a preview branch; every new table enables row-level security with owner policies.
- Merging into production, deleting environments and rotating keys need my explicit approval for that operation.
- Never print, log or commit keys. Full rules: https://docs.scribase.com/llms.txt

3.Ask for the app

Paste this. The agent runs init, shows you one link to approve in the browser, creates the table with a tested policy and builds the screen.

First promptprompt
Build me a small app with sign-in and a todo list, on a Scribase backend.
1. Run `npx scribase init --yes --json` in the project root. If it returns authorization_pending, show me the link and code, wait until I approve, then run it again.
2. Create a `todos` table owned by the signed-in user, with row-level security so each user only sees their own rows. Use the Scribase MCP tools (policy.test before schema.apply), not the service-role key.
3. Add email sign-in and the todo screen using the generated client.
4. Never print, log or commit the env file.

Every tool the agent can call is listed on the MCP page. Full reference: agent setup docs.

FAQ

Common questions

Project or global config?

Either. .cursor/mcp.json applies to one project; ~/.cursor/mcp.json applies everywhere. The token stays in your environment in both cases.

Can the agent break production?

Every write tool waits for an explicit confirm, and schema.apply only accepts a token that policy.test issued for the same schema, so an unproven row-level-security policy cannot be applied. Agent tokens are scoped and expiring, and every call is audited.

What does it cost?

Scribase is priced per project, flat, with no usage surprises. See the pricing page for the current price. Sign-up includes a $1 card check that is credited back.

Can I leave?

Yes. export.run produces a portable bundle (Postgres dump, auth users, storage objects) you can restore anywhere Postgres runs.