> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ezforge.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ezforge deploy

> Deploy an MCP server to the platform

## Usage

```bash theme={null}
ezforge deploy [flags]
```

Deploys the server defined in `ezforge.toml`. Runs the full pipeline: build → scan → push → provision → health check → traffic swap.

## Flags

| Flag                | Description                                    |
| ------------------- | ---------------------------------------------- |
| `--image <uri>`     | Deploy a pre-built OCI image URI (skips build) |
| `--server <name>`   | Target server name (overrides `ezforge.toml`)  |
| `--project <id>`    | Target project (overrides `ezforge.toml`)      |
| `--region <region>` | Deploy to a specific region                    |
| `--no-rollback`     | Disable auto-rollback on health check failure  |
| `--wait`            | Wait for deploy to complete (default: true)    |

## Examples

**Deploy from source (Dockerfile in current directory):**

```bash theme={null}
ezforge deploy
```

**Deploy a pre-built image:**

```bash theme={null}
ezforge deploy --image registry.fly.io/my-project/my-server:v1.2.0
```

**Deploy to a specific server in a specific project:**

```bash theme={null}
ezforge deploy --project proj_abc123 --server my-server
```

## Deploy pipeline

When you run `ezforge deploy`, the following steps occur in order:

1. **Build** — Builds the container image from `Dockerfile` (skipped if `--image` is used)
2. **Scan** — Runs Trivy vulnerability scan; `HIGH` CVEs flag the deployment with a warning, `CRITICAL` CVEs block the deployment
3. **Push** — Pushes the image to the ezForge private registry
4. **Provision** — Creates or updates the Fly.io Machines VM
5. **Health check** — Polls `GET {health.path}` until it returns `200` or the timeout is reached
6. **Traffic swap** — Routes live traffic to the new machine
7. **Cleanup** — Stops the old machine; keeps for 1 hour before deletion (for emergency recovery)

If any step fails:

* Auto-rollback restores the previous healthy deployment (unless `--no-rollback` is set)
* Old machine is preserved in `stopped` state for 1 hour

## Output

```
✓ Building image...
✓ Scanning image (0 critical, 0 high, 2 medium)
✓ Pushing to registry...
✓ Provisioning machine in ord...
✓ Health check passed (3.2s)
✓ Deployed!

  Server:  my-server
  URL:     https://my-server.mcp.ezforge.ai
  Version: v1.2.0
  Region:  ord
```
