Skip to content

The mf CLI

Preview mf is the official managed.dev command-line client. It’s generated from the same OpenAPI 3.1 spec as the public API and the SDKs, so every command maps to an endpoint and the CLI never drifts from the platform. It’s free on every plan — the CLI is just a client; what it can do is governed by your API key’s scopes and your role.

mf login opens your browser, authenticates against the dashboard, and mints a short-lived, TTL’d API key for the CLI to use — 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 via the environment instead:

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

mf deploy triggers a deployment for an environment and follows the resulting async job to completion, streaming progress as it goes.

Deploy a branch and wait for it
mf deploy --site acme-store --env feature-checkout --wait

The command returns non-zero if the build or roll fails, so it drops cleanly into a pipeline step. Day-to-day, you’ll still deploy most changes with git push managedmf deploy is for scripting and re-deploys.

Create a preview environment
mf env create --site acme-store --branch feature/checkout
Tear one down when the branch is merged
mf env rm --site acme-store --env feature-checkout

Both are async jobs; add --wait to block 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
mf logs --site acme-store --env production --tail
Filter to a severity
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.

One-off exec
mf exec --site acme-store --env feature-checkout -- wp plugin list --status=active
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 events to a local server
mf listen --forward-to http://localhost:4000/webhooks
Only forward the events you care about
mf listen --events site.deployed,deployment.failed \
--forward-to http://localhost:4000/webhooks

Signatures are verified locally and the original Forge-Signature header is preserved, so your handler’s verification path is exercised exactly as it will be in production.

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

Save and replay a bookmark
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
Run a batch of bookmarks against an environment
mf batch run post-deploy.batch --site acme-store --env production