# Backenly

> Autonomous backend platform. Your coding agent builds it over MCP, Backenly keeps it running: Postgres, REST APIs, auth, storage, realtime, and functions, with every change governed, verified, and reversible.

- **Type:** MCP server
- **Install:** `agentstack add mcp-backenly-backenly`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [backenly](https://agentstack.voostack.com/s/backenly)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [backenly](https://github.com/backenly)
- **Source:** https://github.com/backenly/backenly
- **Website:** https://backenly.com

## Install

```sh
agentstack add mcp-backenly-backenly
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Backenly

### Your coding agent builds it. Backenly keeps it running.

The autonomous backend platform for agentic coding. PostgreSQL, REST APIs, auth,
storage, realtime, and functions, driven by your coding agent over MCP, with every
change planned, verified, and reversible.

[](LICENSE)
[](packages/)
[](https://www.npmjs.com/package/@backenly/mcp-server)
[](https://github.com/backenly/backenly/graphs/contributors)
[](https://github.com/backenly/backenly/stargazers)

[](https://x.com/Backenly)
[](https://www.linkedin.com/company/117034579)
[](https://github.com/backenly/backenly)

**[backenly.com](https://backenly.com)** &nbsp;·&nbsp; [Quickstart](https://backenly.com/quickstart) &nbsp;·&nbsp; [Resources](https://backenly.com/resources) &nbsp;·&nbsp; [Pricing](https://backenly.com/pricing) &nbsp;·&nbsp; [Client libraries](https://github.com/backenly/backenly-js)

https://github.com/user-attachments/assets/2b215d72-4b1b-4a4c-8290-a94553be192d

> ⭐ **Star the repo** to follow releases and help other builders find Backenly.

---

## What this is

Most backend platforms hand you primitives and leave you owning schema design,
API wiring, RLS policies, monitoring, and recovery. Newer agent-native backends
hand an agent raw SQL and no safety net.

Backenly does neither. You describe the product you're building through the
coding agent you already use (Claude Code, Cursor, Codex) over an MCP server.
Backenly derives the data model, generates the endpoints, writes the policies,
applies the change, and then **verifies it against the live runtime**. A
continuous autonomy loop keeps watching after that, repairing drift, missing
indexes, broken triggers, and RLS gaps on its own.

The distinction that matters: Backenly does not just *generate* backend
resources, it *manages backend change safely*. Every mutation, whether it comes
from an agent, from the dashboard, or from an automated repair, goes through one
typed action kernel with dry-run, audit, and rollback. There is deliberately no
raw-SQL path for mutating structure. Reads are standard SQL, and your data is
never locked in: direct Postgres connection strings and full `pg_dump` exports
are one command away.

## How it works

  

- **Intent-first.** An LLM planner derives entities, relations, and actions from
  natural language. No table designer, no hand-written migrations.
- **One governed kernel.** Every mutation flows through `executeAction`, so the
  agent's model of the database and the database itself cannot silently diverge.
- **Closed-loop autonomy.** The loop heals the reversible safe band by itself.
  Anything risky, such as auth, external credentials, or destructive and
  irreversible changes, always waits for a human.
- **Multi-tenant by construction.** Each project gets its own PostgreSQL schema
  (`workspace_{projectId}`). Isolation is enforced by Postgres grants and RLS,
  never by application-level string filtering.
- **PostgREST data plane.** Tables are served through PostgREST, so the query
  grammar you already know works unchanged.

## Core capabilities

| Capability | What you get |
|---|---|
| **Database** | PostgreSQL with a schema per project, served through PostgREST |
| **Auth & Users** | Email/password and social sign-in, JWT sessions, RLS-forced user tables |
| **Storage** | Public and private buckets with per-file access control |
| **Realtime** | Shared `LISTEN`/`NOTIFY` hub for table change subscriptions |
| **Functions** | Serverless route modules, validated before they ship and self-healed if they break |
| **Integrations** | One `ctx.integrations..request()` surface for third-party APIs |
| **Autonomy** | MAPE-K loop that observes, detects, proposes, applies, and verifies repairs |
| **Monitoring** | Request logs with stability and reliability scoring |
| **Branches** | Preview branches with their own sequences, plus diff and merge |
| **Deploy** | Governed rollout with restore points and an audit ledger |

## What your agent can actually do

The MCP server advertises **20 tools**. The catalog is capped deliberately, because
tool-selection accuracy degrades as it grows, while the dispatcher stays wider so an
agent pinned to an older manifest never gets a 404.

| Group | Tools |
|---|---|
| **Understand** | `read_backend_state` · `get_table_schema` · `run_query` · `fetch_docs` |
| **Build** | `apply_migration` · `enable_auth` · `set_rls` · `create_bucket` · `generate_function` · `enable_realtime` |
| **Data** | `db_insert` · `db_update` · `db_delete` |
| **Operate** | `branch` · `create_api_key` · `set_env_var` · `get_database_credentials` · `check_approval` · `generate_types` |
| **Natural language** | `backend_chat`, the fall-through for anything not named above |

Agents can also browse live project state as MCP **resources** (`backenly://state`,
`tables`, `apis`, `buckets`, `triggers`) instead of spending a tool call to ask.

## Quick start

### Cloud

Create a project at **[backenly.com](https://backenly.com)**, then point your agent
at it. Nothing to install or operate.

### Self-hosted

Requires Node 20+, and Docker (or your own PostgreSQL 14+ instance).

```bash
git clone https://github.com/backenly/backenly.git
cd backenly
npm install

cp .env.example .env          # then set OPENAI_API_KEY and JWT_SECRET

# PostgreSQL + Redis, matching the defaults already in .env.example
docker compose -f docker-compose.dev.yml up -d

npm run db:generate && npm run db:push
npm run dev                   # dashboard :3000 · runtime :3001
```

`npm run dev` starts both processes together. If you already have PostgreSQL
running, skip the Docker step and point `DATABASE_URL` at it instead — in which
case enable `pg_stat_statements` yourself:

```conf
# postgresql.conf, then restart the server
shared_preload_libraries = 'pg_stat_statements'
```
```sql
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
```

It is how Backenly finds indexes that are missing by *measurement* — the columns
Postgres is actually spending milliseconds filtering on — rather than only by
schema shape. Without it that check reports itself as unchecked rather than
passing, so nothing claims a guarantee it never evaluated. The Docker stack
above already sets both.

Two variables are not optional:

- `JWT_SECRET` signs every platform session. Generate one per deployment with
  `openssl rand -hex 32`.
- `OPENAI_API_KEY` powers planning and the autonomy loop.

See [`.env.example`](.env.example) for the rest.

## Connecting a coding agent

Backenly is built to be driven over MCP. Point your agent at the MCP server:

```bash
npx @backenly/mcp-server init
```

Works with Claude Code, Cursor, Codex, Cline, and Claude Desktop. Keys are scoped
and revocable, and read-only keys serve a reduced tool set.

> **Restart your MCP host after installing.** Tools stay absent until it
> reconnects, which looks like a broken install but is not one.

Verify the connection by asking your agent:

```
Call Backenly's read_backend_state tool and tell me what exists in this project.
```

Then describe what you want. The SDK is for the app you ship:

```js
const backend = new BackenlyClient({ projectId, apiKey })
await backend.auth.signUp({ email, password })
await backend.posts.create({ title: 'Hello' })
await backend.posts.list({ filter: { published: true } })
```

## Repository layout

| Path | What lives there |
|------|------------------|
| `app/` | Next.js routes: dashboard UI, platform APIs, and the public `/api/v1/*` runtime |
| `lib/ai/` | The Brain: planning, the tool loop, and `executeAction`, the governed mutation kernel |
| `lib/orchestration/` | The nine-phase pipeline from intent to verified change |
| `lib/autonomy/` | The MAPE-K loop that monitors and repairs running backends |
| `lib/execution/` | Schema writes, migrations, and rollback beneath the kernel |
| `lib/tenant/` | Schema isolation and the tenant boundary |
| `packages/` | Client libraries: SDK, CLI, MCP server (MIT) |
| `prisma/` | Platform schema: the `public` schema, not tenant data |
| `server/` | Express runtime serving the end-user API |
| `scripts/` | Operational tooling, probes, and the demo recording pipeline |

[`AGENTS.md`](AGENTS.md) is the deeper architectural guide, and is written for
coding agents working in this repo as much as for people.

## Self-hosting vs Cloud

Self-hosting is free and complete. This repository is the whole platform:
runtime, governance, and the full self-healing engine, not a stripped community
edition. You bring the servers, the Postgres, and the OpenAI key.

[Backenly Cloud](https://backenly.com/pricing) runs the same codebase, and
handles infrastructure, backups, upgrades, and the autonomy tokens. `pg_dump`
moves your data between the two in either direction.

## Contributing

**Pull requests are open and welcome.** Bug reports, feature requests, questions,
and code all help. Good first places to look are open issues, the probe and
detector suite under `lib/autonomy/`, and client library ergonomics in
`packages/`. If a change is large or moves an architectural boundary, open an
issue first so we can agree the approach before you spend the time.

Before opening a PR:

```bash
npm run lint
npx tsc --noEmit
npm test
npx tsx scripts/preflight-oss.ts --tree    # no credentials in what you committed
```

Two things worth knowing before you write code here. Tests run against a real
PostgreSQL instance, and the database is never mocked, because mocking it has
caused production incidents here before. And every schema mutation goes through
`executeAction`; a patch that writes DDL around the kernel will be sent back, no
matter how correct the SQL is.

See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide.

## Security

Please do not open a public issue for a security problem. See
[SECURITY.md](SECURITY.md) for the private reporting route.

## License

The platform is licensed under the [Apache License 2.0](LICENSE).

The client libraries under [`packages/`](packages/), the SDK, CLI, and MCP
server, are MIT, so they impose nothing on the applications that embed them.

## Trademark

Apache-2.0 §6 grants no rights to the Backenly name or logo, and this project
does not grant them separately. You may fork, modify, self-host, and
commercialise the software. Distributing it under the Backenly name requires
written permission.

Describing your project as "built on Backenly" or "a fork of Backenly" is
accurate and always welcome. See [TRADEMARK.md](TRADEMARK.md) for the full
policy, including what you may do without asking.

---

**[Star Backenly on GitHub](https://github.com/backenly/backenly)** to get notified about new releases.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [backenly](https://github.com/backenly)
- **Source:** [backenly/backenly](https://github.com/backenly/backenly)
- **License:** Apache-2.0
- **Homepage:** https://backenly.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-backenly-backenly
- Seller: https://agentstack.voostack.com/s/backenly
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
