Skip to content

The mf CLI

Preview mf is the command-line client for the managed.dev API. It’s generated from the same OpenAPI 3.1 spec as the SDKs and the Terraform provider, so every command maps directly to a /v1 endpoint and the tool never drifts from the platform. The CLI is free on every plan — it’s just a client; what it can do is bounded by your key’s scopes and your team role.

Every command resolves to one or more /v1 calls and inherits that endpoint’s required scope. Mutating commands accept --wait to follow the resulting async job to completion and exit non-zero on failure.

Command Does Endpoint(s) Scope
mf login Browser auth; mints a short-lived personal key POST /v1/auth/login
mf sites list List your sites GET /v1/sites sites:read
mf deploy Deploy an environment, follow the job POST …/deployments deployments:write
mf env create Create a preview/staging environment POST …/environments environments:write
mf env rm Tear an environment down DELETE …/environments/{id} environments:write
mf logs --tail Live log stream over SSE GET …/insights/logs/stream observability:read
mf exec Run a command on an environment POST …/exec wp.cli:exec
mf exec save / run Save and replay a named bookmark …/exec/bookmarks wp.cli:exec
mf batch run Run a batch of bookmarks/commands …/exec:batch wp.cli:exec
mf listen --forward-to Forward webhook events to a local URL GET /v1/events jobs:read
mf backup / restore Snapshot and restore an environment …/backups, …/snapshots/{id}/restore backups:write
mf jobs watch Watch a job to completion GET /v1/jobs/{id}/stream jobs:read

Run mf <command> --help for the full flag list, or mf --help for the top-level command tree.

mf login opens your browser, authenticates against the dashboard, and mints a short-lived, TTL’d personal key for the CLI — you never paste a long-lived secret into your shell.

Authenticate the CLI
mf login

For CI, skip the browser flow and pass a service token through the environment:

Non-interactive auth
export FORGE_TOKEN="mfs_live_…"
mf sites list

mf deploy triggers a deployment and follows the job to completion, streaming progress. It exits non-zero if the build or roll fails, so it drops cleanly into a pipeline step.

mf deploy
~/acme-store ❯ mf deploy –site acme-store –env feature-checkout –wait
→ job_01J9F2KQ  deployment  queued
build       ████████████████  done
roll        ████████████████  done
✓ deployed env_01J8C4RX in 41shttps://acme-store-feature-checkout-9a3f.preview.managed.dev

Day-to-day you’ll still deploy with git push managed; mf deploy is for scripting and re-deploys.

Create a preview environment
mf env create --site acme-store --branch feature/checkout --wait
Remove it when the branch merges
mf env rm --site acme-store --env feature-checkout --wait

Both are async jobs; --wait blocks until the environment is live or fully removed. See environment lifecycle for how creation, sleeping, and teardown work.

mf logs --tail streams an environment’s logs over server-sent events — it stays open and prints lines as they arrive, like tail -f.

Follow logs live, filtered to errors
mf logs --site acme-store --env production --tail --since 15m --level error

mf exec runs a command inside an environment — the same surface as a WP-CLI shell, but driven by the API and gated by the wp.cli:exec scope. The call returns a job; add --wait to stream output to completion.

A dry-run search-replace before promoting
mf exec --site acme-store --env staging -- \
wp search-replace 'staging.example.com' 'example.com' --dry-run

mf listen subscribes to your team’s events and forwards them to a local URL, so you can develop a webhook handler against real site.deployed, build.succeeded, and malware.detected events without exposing a public endpoint.

Forward selected events to a local server
mf listen --events site.deployed,deployment.failed \
--forward-to http://localhost:4000/webhooks

The original Forge-Signature header is preserved, so your handler’s signature verification path runs exactly as it will in production.

Frequently-run mf exec invocations can be saved as named bookmarks and replayed by name; a batch runs an ordered list of bookmarks (or raw commands) against a target environment — handy for a repeatable post-deploy checklist.

Save, replay, and batch
mf exec save flush-and-warm --site acme-store -- \
sh -c 'wp cache flush && wp rewrite flush'
mf exec run flush-and-warm --env staging
mf batch run post-deploy.batch --site acme-store --env production