mobster run runs one task per call, for shell scripts and CI. The HTTP API that mobster serve starts is for programs that run longer: they answer approvals and stream events. Both save each task in a private journal before it acts.
Run a task from a script
--execute runs the task on your Claude or OpenAI key. On a terminal it prints one line per step. Piped, written to a file, or with --json, it prints each event as one JSON line, and the last line is always the result.
Mobster asks in the terminal before it sends, buys, posts or deletes, before it opens an app you haven’t allowed, and before it types a one-time code. The app card takes y (Allow, for this task), a (Always allow) or n (Not now). With no terminal to ask in, such as a script or CI, the answer is no. Apps you allowed in Mobster for Mac count. For a script, list apps in MOBSTER_APPS_ALLOWED, or set MOBSTER_APP_ACCESS=all (Configuration).
Each task is saved in the journal before it acts, so mobster history lists it, and a run killed mid-task shows as interrupted the next time mobster run or the terminal UI starts (History and resume). One mobster run or terminal UI has the journal open at a time. Another mobster run prints a result with error_type LeaseHeld and exits 3 without reaching the phone. To run tasks on several phones at once, give each run its own journal with --state-db PATH.
Read the JSON events
Every line is one JSON object with anevent field. The ones most scripts need:
Keep event output private: an
observation lists each field’s value, so text Mobster typed into a field appears there.
A run that may not use an app ends with status blocked, and reason says why. An error before or around the run prints a result too: {"event": "result", "status": "error", "ok": false, "error_type": "...", "error": "...", "exit_code": N}. ctrl+c or SIGTERM ends the run at its next safe point with status stopped, and mobster run exits 130 (143 for SIGTERM).
Check how a task ended
data quotes text Mobster saw on the screen. When there is none, data is null and data_status is insufficient_evidence.
Get an alert when a scheduled task fails
SetMOBSTER_ALERT_WEBHOOK_URL to an https webhook, in Settings in Mobster for Mac or in the env file. Mobster posts there when a scheduled task fails, stops before it finishes, or waits a minute or more for your approval. Slack, Discord and ntfy addresses get their own format. Any other address gets JSON:
status connection_signed_out, the connector’s name in workflow and a null runId. It posts only for a sign-in or token that worked until the service refused it, once per sign-in (Connectors).
The post never holds the task’s answer, a screenshot or anything it typed. mobster alerts test sends a test post.
Use the phone outside a task
mobster phone clipboard set TEXT puts text on the phone’s clipboard for a task to paste, mobster phone clipboard get prints the phone’s clipboard, mobster phone install PATH installs a signed build, mobster phone password --app BUNDLE --field NAME types a password you enter at a hidden prompt into a focused secure field (Type a password privately), and mobster phone record --output FILE saves a USB iPhone’s screen to a new .mov. Each except record takes the device’s lock while it works and prints JSON with --json (CLI reference).
Call the HTTP API
mobster serve starts an HTTP server on 127.0.0.1:8765, the same server Mobster for Mac runs. Each launch makes a random API token and writes it to a private file, named in the first line the server prints. Send it as Authorization: Bearer <token> on every request.
Start and follow tasks
Read and change settings
These routes belong to the pages that explain them: sharing a result and saving it as a file (Results), Home’s summary (See your workflows on Home), adding the Mobster MCP server to an agent (Add it from Mobster for Mac), the composer’s phones (The composer’s phone), managing a phone (Manage a device), teaching a task (Teach Mobster a task), a team’s Mac (A team’s Mac) and passkey approvals (Answer with your passkey).
Hold a conversation
These routes are behind Conversations: Mobster for Mac uses them. JSON uses camelCase and milliseconds since the epoch.
A message is
{text, attachmentIds?, appId?, engine?, outputFormat?, outputSchema?, device?, mode?, via?}:
text: 1–4,000 characters to start a task, at most 2,000 to steer, at most 500 to answer a question.mode:auto(Steer a task while it runs) ornew_task.device: the phone; the conversation’s phone when left out.- It also takes
phones,pinnedApps,permissionMode,account,sendTo,queueandlongform, asPOST /api/runsdoes.
Idempotency-Key returns the first answer with "replayed": true. The same key with another body is 409 idempotency_conflict. When Mobster can’t tell whether the first request started a task, the retry is 409 request_outcome_unknown and nothing is sent again: check the conversation before you start another. An error with "started": false means nothing was recorded or sent, so a new request is safe. Without that field, a 5xx may have started a task.
Every item has
id, seq, at and kind:
A thread is
{id, title, createdAt, updatedAt, device, deviceName, archived, pinned, status, lastRunId, rules}. status is idle, running or waiting (for you). GET /api/events?topics=threads,thread:<id> streams thread_created, thread_updated and thread_deleted with {thread}, and for one conversation thread_item, thread_item_updated and run_event.
Check that the phone is ready
GET /api/engine answers with one state. Mobster for Mac, mobster serve and mobster mcp’s status read the same one, and mobster doctor says it in the same words.
fix says what to do. Its kind is auto (Mobster does it: start_helper or rebuild_helper), ask (Mobster does it after you say yes: free_port or restart_service), guided (mobster login or mobster setup), yours (you, on the iPhone or with the cable), run (a command for you to run) or wait (it clears by itself). mobster doctor --fix runs the auto and ask fixes (Device setup).
When several stand, state is the one that blocks most, and issues lists all of them, each with its source and since. A simulator in the device list that is shut down is off, not an issue, unless the server drives it as its own address (--wda-url): GET /api/devices lists it as shut down. If an action was on its way when the phone went away, action_unknown is true: Mobster looks at the screen before it goes on and doesn’t send that action again. GET /api/events?topics=engine sends an engine_health event each time the state changes. To tell a frozen server from a slow one, ask GET /api/engine every 2 seconds and read liveness.
Answer plans and drafts
A task may show a plan before it starts, or put several drafts up for review together. Both are approvals: the task waits, Stop ends it, and nobody answering in 10 minutes ends the wait.
A decision on a draft is final. Drafts nobody decided are skipped, and Stop skips them all. Sending needs Mobster for Mac; skipping doesn’t. Draft text is never in the task’s events or its saved history.
Keep the API on this Mac
The server listens on127.0.0.1 and takes requests only from local origins. It has one user, you, and no rate limits. Don’t expose it on a network. At most 8 event streams stay open at once; another gets 429 stream_limit. Every GET answer carries an ETag: send it back in If-None-Match and the answer is 304 while nothing changed.
When Mobster for Mac runs the server, these work only from the app, and anything else that has the token gets 403 app_only: approving an action, changing askBeforeActing or Settings › Safety, answering an outside agent’s approval, starting a task that asks less than Settings, putting a file on the phone and resetting the Wi-Fi link. Declining, stopping and reading stay open to the token. Starting a task there also needs this Mac signed in to your account, or the answer is 403 plan_required (What needs a sign-in). A server you start with mobster serve takes the token alone.
A task’s optional X-Mobster-Origin header (app, tui, cli, mcp, remote or console) labels where it came from and grants no access. A remote task, from Mobster Remote, always asks before acting. A task with projectEnv resolves ${NAME} from that project’s secrets, and only Mobster for Mac’s own session may send it (403 app_only otherwise).