sbarbase
Contents

AI agents and the API

An AI agent, such as Claude Code, Cursor or Codex, can work on this server the way it works on Supabase. From a project's folder, tell it "deploy this app to Sbarbase", and it can:

It connects with a personal access token and the server's MCP endpoint, which runs Supabase's own MCP server.

1. Create an access token

  1. In the console, open Access tokens (under Workspace).
  2. Give the token a name, such as "Claude Code on my laptop".
  3. Choose what it can reach:
    • everything you can reach;
    • one organization;
    • one project.
  4. Choose read only if you only want the agent to look. A read-only token runs SQL read only and cannot change anything.
  5. Choose when it expires, then press Create token. Copy it: it is shown only once.

A token is sbp_ followed by 40 characters, the form of a Supabase personal access token. It acts as you, with your role in each organization. A viewer's token can list organizations, projects and functions; SQL, API keys, function code and every change need an owner or admin. Sbarbase keeps only its hash.

2. Connect the agent

The address is your console's address followed by /mcp, for example https://console.example.com/mcp.

Claude Code, once, in a terminal:

claude mcp add --transport http sbarbase https://console.example.com/mcp --header "Authorization: Bearer sbp_..."

Cursor (.cursor/mcp.json), VS Code (.vscode/mcp.json, with "type": "http") and others that take a URL and headers:

{
  "mcpServers": {
    "sbarbase": {
      "url": "https://console.example.com/mcp",
      "headers": {"Authorization": "Bearer ${env:SBARBASE_ACCESS_TOKEN}"}
    }
  }
}

Codex (~/.codex/config.toml):

[mcp_servers.sbarbase]
url = "https://console.example.com/mcp"
bearer_token_env_var = "SBARBASE_ACCESS_TOKEN"

Keep the token out of files you commit; the examples above read it from an environment variable where the client allows it.

3. Ask

In any project's folder: "Deploy this app to Sbarbase: create a project, apply the migrations in supabase/migrations, deploy the functions in supabase/functions, and write the URL and publishable key to .env." The Sbarbase skill teaches Claude Code those steps.

What the agent can do

The tools are Supabase's own, from the official MCP server:

Group Tools
Account list_organizations, get_organization, list_projects, get_project, create_project (with get_cost and confirm_cost first; the cost is always zero here, and the region it asks for is ignored)
Database list_tables, list_extensions, list_migrations, apply_migration, execute_sql
Edge Functions list_edge_functions, get_edge_function, deploy_edge_function
Development get_project_url (this server's address), get_publishable_keys (with a token that can write, it makes one named default when the project has none it can show)
Debugging get_logs (requests, Auth, Storage, Realtime and Edge Functions logs), get_advisors (security: public tables without row level security)

A read-only token gets only the tools that read.

What is not there yet:

How it is kept safe

Agent output is not a review: read what an agent changed before you rely on it, as with any automated change. Give each agent its own token, so you can revoke one alone.

The Supabase-compatible API

The same token works with the parts of Supabase's Management API that tools use, at https://console.example.com/v1/...:

curl -H "Authorization: Bearer $SBARBASE_ACCESS_TOKEN" https://console.example.com/v1/projects
Supabase API On Sbarbase
GET /v1/organizations, /v1/organizations/{slug} Your organizations
GET /v1/projects, /v1/projects/{ref}, POST /v1/projects Each environment is a Supabase "project": ref is 20 letters, api_url its address here; POST creates a project with its production environment
GET, POST /v1/projects/{ref}/api-keys, DELETE .../api-keys/{id} API keys; a publishable key's api_key is readable, a secret key's only when it is created
POST /v1/projects/{ref}/database/query SQL: {query, parameters?, read_only?}
GET, POST /v1/projects/{ref}/database/migrations Migration history in supabase_migrations.schema_migrations, as the Supabase CLI keeps it
GET /v1/projects/{ref}/functions, .../functions/{slug}, .../functions/{slug}/body, POST .../functions/deploy?slug=, DELETE .../functions/{slug} Edge Functions
GET, POST, DELETE /v1/projects/{ref}/secrets Function secrets, listed by name only
GET /v1/projects/{ref}/analytics/endpoints/logs, /advisors/security, /advisors/performance Logs and advisors

Anything else answers 404 or 501 with a message.

The official Supabase MCP server on your machine

Supabase's MCP server can also run on your machine and point at this server:

npx -y @supabase/mcp-server-supabase@latest --api-url https://console.example.com --access-token sbp_...

It works, with differences: its get_project_url names a supabase domain instead of this server, and it lists a ClickHouse log query tool and health advisors that this server does not answer. The hosted endpoint above gives the right address and only the tools that work, so prefer it.

The Supabase CLI

The Supabase CLI talks to this server through a profile file:

name: sbarbase
api_url: https://console.example.com
dashboard_url: https://console.example.com
project_host: console.example.com
export SUPABASE_ACCESS_TOKEN=sbp_...
supabase --profile ./sbarbase-profile.yaml projects list
supabase --profile ./sbarbase-profile.yaml functions deploy hello --project-ref <ref> --use-api
supabase --profile ./sbarbase-profile.yaml secrets set STRIPE_KEY=... --project-ref <ref>

These three were run against a real server. functions deploy needs --use-api: without it the CLI bundles with Docker and uploads a format this server does not read. Commands that connect to the database by the project's host name, such as db push --linked, do not work; see database access for migrations.

The Sbarbase skill for Claude Code

The repository has a skill that tells Claude Code what "deploy to Sbarbase" means: the order of the steps, where to write the URL and key, and what to check afterwards. Copy it once:

mkdir -p ~/.claude/skills/sbarbase && curl -fsSL https://raw.githubusercontent.com/M7MMAD-OMAR/sbarbase/main/deploy/agent-skill/sbarbase/SKILL.md -o ~/.claude/skills/sbarbase/SKILL.md

Limits

Edit on GitHub