# Install with your coding agent

> One command connects your app and its coding agent to a project: keys, the MCP server, the agent's skills, a machine client for your backend and typed tables.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://data.docs.sypnia.com/start/install-with-your-agent/

For agents: For coding agents: in the app's folder run `npx @sypnia/data init --project <ref>` (add --server for the backend's machine client, --cases for Sypnorm + Sypnia Cases, or --orm none|sql|prisma|drizzle, --yes to never ask). It signs in with the device flow (the person approves a code in the browser; DPoP-bound session in ~/.config/sypnia, mode 600), writes SYPNIA_URL and SYPNIA_PUBLISHABLE_KEY to .env.local, adds the MCP server https://mcp.data.sypnia.com to .mcp.json / .cursor/mcp.json, installs the sypnia-data skill into .claude/skills plus an AGENTS.md section, records choices in sypnia.toml (top-level project + [data] table), and pulls types. With --cases it also installs @sypnia/cases in the app with its package manager (npm, pnpm, yarn or bun; --no-install skips it), installs the sypnia-cases skill and writes src/use-cases/ for @sypnia/cases/sypnorm; `npx @sypnia/cases map --upload --project <ref>` sends the map to the project's Use cases; for a Cases project the agent adds the Cases MCP server https://mcp.cases.sypnia.com and creates and links it with the Cases MCP tools create_project, link_data_project, upload_map. Idempotent. Never ask the user to paste a secret key, password or token into the conversation.

Everything in Sypnia Data can be done without a screen, so your coding agent can set up and run your backend. One command connects the app in the current folder, and the agent working on it, to your project. The console shows the same steps, ready to copy, on every project's home («Connect your agent»).

## Paste this into your agent

```text
Connect this app to my Sypnia Data project (<ref>).
1. In the app's folder run: npx @sypnia/data init --project <ref>
   If the app has a backend, add --server. If we will work use case first (Sypnorm and Sypnia Cases), add --cases; otherwise it asks which ORM, if any.
   It shows a code: give it to me and I approve it in the browser. Never ask me for keys or passwords.
2. Use the MCP server https://mcp.data.sypnia.com (init added it to .mcp.json / .cursor/mcp.json).
3. Read .claude/skills/sypnia-data/SKILL.md (and sypnia-cases if it was installed) before touching the database. With Cases, create and link the Cases project with the Cases MCP tools.
4. Before writing code, propose the app's flows: who does what, which tables each one touches and how it can fail. Then create the tables with migrations and row-level security.
```

## What `init` does

```bash
npx @sypnia/data init --project <ref> [--server] [--cases | --no-cases | --orm none|sql|prisma|drizzle] [--agent claude,cursor,other|all] [--env-file .env.local] [--no-pull] [--no-install] [--yes]
```

1. **Signs the machine in** with your Sypnia account through the [device flow](https://data.docs.sypnia.com/machines/device-flow-and-agents): it prints an address and a code, and you approve in the browser. The session is bound to a key that never leaves the machine (`~/.config/sypnia/`, mode 600), has `data:read data:write offline_access`, and lasts until you revoke it (Account → Agents and devices).
2. **Picks the project**: `--project <ref>`, the only one you have, or it asks.
3. **Writes the app's settings** to `.env.local` (`--env-file` to choose another): `SYPNIA_URL` and `SYPNIA_PUBLISHABLE_KEY`. A key that already has a different value is kept, never overwritten.
4. **With `--server`**, creates a [machine client](https://data.docs.sypnia.com/machines/client-credentials) for your backend: `private_key_jwt` with DPoP. The private key is written to `.sypnia/client-key.json` (mode 600, added to `.gitignore`) and only `SYPNIA_CLIENT_ID` goes to the env file.
5. **Connects the agent's MCP**: `.mcp.json` for Claude Code and `.cursor/mcp.json` for Cursor, with the [MCP server](https://data.docs.sypnia.com/machines/mcp) `https://mcp.data.sypnia.com`. The first call opens the browser to approve the client.
6. **Installs the agent's skills** into `.claude/skills/`: `sypnia-data` (the data layer: Data API, SQL, row-level security, transactions, machines, MCP, and notes for your ORM). It also adds a section to `AGENTS.md` for agents other than Claude.
7. **Asks whether the app will use Sypnorm and Sypnia Cases** (`--cases` or `--no-cases`). With Cases it installs `@sypnia/cases` in the app with its own package manager (npm, pnpm, yarn or bun; `--no-install` skips it, and an app that already has it is left alone), installs the `sypnia-cases` skill and writes `src/use-cases/`, one file per use case for `@sypnia/cases/sypnorm`. Once there is code, `npx @sypnia/cases map --upload --project <ref>` sends the map to the project's [Use cases](https://data.docs.sypnia.com/console/auth-machines-and-use-cases#use-cases), and, once the project is linked to a Cases map, to that map as a draft proposal. To keep the map in a Cases project, your coding agent, signed in with the same Sypnia account, adds the Cases MCP server `https://mcp.cases.sypnia.com` and creates and links the project with the [Cases MCP tools](https://cases.docs.sypnia.com/tools/mcp/): `create_project`, `link_data_project`, then `upload_map` ([Linking Data and Cases](https://cases.docs.sypnia.com/links/data/)). Without Cases it asks which ORM, if any.
8. **Records the choices** in `sypnia.toml` at the root of the repository, the project's one configuration file for every Sypnia product: the project at the top, and the address, MCP, ORM and Cases in its `[data]` table. Nothing secret goes there, and `init` touches only `project` and `[data]`. `pull` and `migrate` read their defaults from it.
9. **Pulls the types** into `src/db/schema.gen.ts` (not with Prisma or Drizzle, which generate their own).

Running it again changes only what is missing. With `--yes` it never asks: no Cases and no ORM unless you pass `--cases` or `--orm`.

## Which ORM

Sypnia Data is only the data layer: use the ORM you want, or none.

| Choice                  | How the app reaches the data                                                                                                                                                                            |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| none (`--orm none`)     | the Sypnia client over the Data API, with row-level security, on every project                                                                                                                          |
| plain SQL (`--orm sql`) | a driver with a direct URL, or the [SQL endpoint](https://data.docs.sypnia.com/data/sql-and-migrations) from a server                                                                                   |
| Prisma, Drizzle         | a direct `postgres://` URL: a project with your own Postgres or a dedicated database. Managed shared projects have no direct URL.                                                                       |
| Sypnorm (`--cases`)     | Sypnia's use-case ORM, part of [Sypnia Cases](https://cases.docs.sypnia.com/sypnorm/) (`@sypnia/cases/sypnorm`); it runs over the Data API, and a case other cases listen to runs in its area's service |

## Without `init`

- **Only the session**: `npx @sypnia/data login`. With it, `pull` and `migrate` work on your Cloud projects through the Cloud API, with your organization role.
- **Only the MCP server**: `claude mcp add --transport http sypnia https://mcp.data.sypnia.com`, or the same address in `.cursor/mcp.json`.
- **The skills as a Claude Code plugin** for every project on your machine: `/plugin marketplace add sespinosav/sypnia-skills`, then `/plugin install sypnia@sypnia` (the repository is private until launch).

> **Warning: Never paste a key into a chat**
>
> A secret key or a password pasted into a conversation can end up in logs and histories. `init` and the MCP sign-in exist so you never have to. If an agent asks you to paste a key, have it run `init` instead.

## What to ask for next

- «Create a `bookings` table with row-level security so each customer sees only their bookings.»
- «Add a server job that closes the month with the backend's machine client.»
- «Tell me which tables have no policy.»

The agent works through the same API you would, under the scopes you approved. Every change it makes is in the project's audit log.
