---
title: "Deploy Strapi over MCP with while.sh"
url: https://while.sh/en/guides/deploy-strapi/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-02
---

# Deploy Strapi and its PostgreSQL database from your AI agent, over MCP

Your Strapi runs locally. Connected to while over MCP, your AI agent deploys it in France without a Dockerfile, with its PostgreSQL database backed up every day and your media kept safe in a bucket.

## Prerequisites

- A Strapi project, with its package.json.
- An AI agent that works in a terminal: Claude Code, Codex, Cursor or Gemini CLI.

## Step 1: Give your agent these instructions

Open your agent in your app's folder, and paste these instructions into it:

```text titre="Instructions"
Connect to while with my account (while.sh/agents), then deploy my app.
```

Your agent adds while's MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn't open, type /mcp, choose while, then Authenticate. On that page, choose "A new app", then click Authorize.

## Step 2: Open your app

Your agent gives you your app's address, for example `https://mon-cms.while.cloud`, over HTTPS.

## What your agent does

It writes while.yaml at the root of your project:

```yaml titre="while.yaml"
apiVersion: while/v1
project: mon-cms
services:
  - name: web
    port: 1337
    health:
      path: /_health
    resources:
      memory: 1Gi
    env:
      DATABASE_CLIENT: postgres
databases:
  - name: main
buckets:
  - name: medias
```

Strapi is detected as a Node.js app: it is built with `npm run build`, then started with `npm start`. It reads its database from `DATABASE_URL`, with `DATABASE_CLIENT=postgres` and the `pg` package, which your agent adds (source 1). Your media files go into the bucket, through Strapi's S3 provider (source 2). Your agent generates Strapi's keys, `APP_KEYS`, `ADMIN_JWT_SECRET` and the others, and stores them in while's vault (source 3).

## Move to your own domain

> You, to your agent: Put the app on cms.acme.com.

Your agent declares the domain, you add the DNS records it gives you, and the HTTPS certificate follows.

## See a new version before you deploy it

> You, to your agent: Show me the new version before you deploy it.

Your agent opens a preview, at its own address, with its own data. You look at it, and then your agent puts it into production.

## Read your content from your agent

> You, to your agent: How many articles were published this month?

Your agent reads Strapi's database in SQL over MCP, with your permissions, and it can't write to it.

## Fix a vulnerability in your dependencies

> You, to your agent: Fix the vulnerabilities in our dependencies.

Your app's dependencies are checked against known vulnerabilities at every deployment, then every day. Your agent is warned of a serious vulnerability, and it updates the package involved.

## Go back to the previous version

> You, to your agent: Go back to the previous version.

In the 30 minutes after a deployment, the previous version comes back in a second. After that, it takes a few seconds. Once the previous version is back, your agent reads what broke in while's logs, fixes it and deploys again.

## Next steps

- [Store your app's files](/en/guides/store-files-s3/)
- [Deploy a Node.js API and its PostgreSQL database](/en/guides/deploy-node-api-postgresql/)
- [Deploy a static site](/en/guides/deploy-static-site/)

## Sources

1. [Strapi, database configuration](https://docs.strapi.io/cms/configurations/database), 2026-11-02
2. [Strapi, the Amazon S3 provider for media](https://docs.strapi.io/cms/configurations/media-library-providers/amazon-s3), 2026-11-02
3. [Strapi, environment variables](https://docs.strapi.io/cms/configurations/environment), 2026-11-02

## Questions

### Do I need to write a Dockerfile?

No. Strapi is a Node.js app: it is detected, built with npm run build, then started with npm start.

### Where do my images and files go?

Into an S3-compatible bucket in while, separate from the app. On the disk, they would start from scratch at every restart.

### Is my content backed up?

Yes, it lives in the PostgreSQL database, which is backed up every day and can go back to a precise moment.

### Where is my Strapi hosted?

In France, by Nextmap, a French company.
