Skip to content

A Postgres backend for Claude Code

Claude Code builds and runs a Backenly project over MCP: tables, row-level security, auth, storage and functions. One command connects it, and anything destructive waits for you.

Add it in one command. Then start a new session.

  • Remote, with a key

    Nothing to install. The key comes from your project’s Connect page, under Agents, and travels in the x-api-key header.

    bash
    claude mcp add --transport http backenly https://backenly.com/api/mcp --header "x-api-key: <scoped-key>"
  • Remote, with a browser sign-in

    No key in the command. Run /mcp, pick backenly and choose Authenticate. On backenly.com you pick the project, and Read-only access starts checked: clear it to let Claude Code make changes.

    bash
    claude mcp add --transport http backenly https://backenly.com/api/mcp
  • Local, over stdio

    The @backenly/mcp-server package, on Node.js 20 or later. It serves the same tools and results as the remote endpoint, and checks the project id against the key when it starts.

    bash
    claude mcp add backenly -- npx -y @backenly/mcp-server --project <id> --key <scoped-key>

To keep the key out of the command, run npx @backenly/mcp-server init once. It checks the key and saves it to ~/.backenly/mcp.json, readable only by you, and the command becomes claude mcp add backenly -- npx -y @backenly/mcp-server.

Tools arrive next session. The CLI works until then.

In this conversation

A server added mid-conversation is not in this conversation’s tool list, and retrying will not change that. Claude Code can call every Backenly tool from the shell instead, with the same key and the same approval rules.

bash
npx -y @backenly/cli@latest link --project <id> --key <scoped-key>
npx -y @backenly/cli@latest call read_backend_state
npx -y @backenly/cli@latest chat "add a likes counter to posts"

link checks the key belongs to the project, stores it in .backenly/config.json, and adds .backenly/ to .gitignore when the repository has one.

In the next one

Run /exit, then claude --continue, or open a new tab in the VS Code extension. /mcp lists backenly once it is connected. Then ask for the backend’s state:

Ask Claude Code
Call Backenly’s read_backend_state tool and tell me what exists in this project.

What Claude Code is told. By the server and the repo.

  • Instructions on connect

    The server sends them when the connection opens, and Claude Code adds them to the agent’s context: read the backend’s state before changing anything, say which project it is connected to, and never put the mcp_live_ key in app code.

  • The docs in one call

    fetch_docs returns Backenly’s agent guide in full: at most 40,000 characters, about 10,000 tokens, inside Claude Code’s default limit of 25,000 tokens on one tool result.

  • A skill in the repository

    One command writes .claude/skills/backenly/SKILL.md from backenly.com/skill.md: which tool does what, the order that works, the error codes to branch on, and which key an app needs.

    bash
    npx -y @backenly/cli@latest install-skill --agent claude

What the key reaches. Only what you allow.

  • One project per key

    Every key and browser sign-in is bound to one project, so a leaked credential reaches that project and nothing else. connect { action: "whoami" } tells Claude Code which one it is on.

  • Read-only, if you choose

    A read-only key or sign-in sees 16 tools instead of 23, and a write called anyway is refused with READ_ONLY_KEY. A person chooses it, and Claude Code cannot upgrade its own key.

  • Not the key your app uses

    The runtime API your app calls refuses an MCP key with MCP_KEY_IN_APP. Claude Code creates the app’s own publishable key with connect { action: "create_api_key" }.

  • Destructive actions wait for you

    apply_migration refuses DROP with DESTRUCTIVE_REFUSED. Dropping a table, deploying, rolling back and revoking a key are parked on the project’s Autonomy page until a person approves them.

Questions about Claude Code

Anything else, ask the people who built it.

The remote URL with a key is the shortest, with nothing to install. The browser sign-in puts no key in the command and starts read-only. The local package needs Node.js 20 or later and serves the same tools and results as the remote endpoint.

Give Claude Code a backend

One free project, no credit card. Connect it in one command.