Skip to main content
Glama

mandala-computer-mcp

An MCP server for Mandala Computer — cloud desktops for AI agents.

Point Claude Code, Claude Desktop, or anything else that speaks MCP at a real Linux desktop it can see and drive. Screenshots come back as images, so the model looks at the screen and clicks what it sees.

Status: alpha. The tool surface is settling; expect breaking changes before 1.0. Tracks the platform's /api/v1, which is itself still moving.

Install

MCP requires Node 20.3 or newer. The TypeScript CLI login setup requires Node 22 or newer (mandala-computer on npm). Sign in once, then add the MCP server:

npm install -g mandala-computer
mandala login
claude mcp add mandala -- npx -y mandala-computer-mcp

On Node 20, MCP can use an existing saved profile or an environment key. The TypeScript CLI guides you through browser approval and saves an API key in ~/.mandala/credentials.json. MCP only reads that file; it never issues or approves a device, writes credentials, or starts login automatically. The Python distribution also provides a mandala command; use the TypeScript CLI for login.

To select a separate profile and workspace:

mandala login --profile Work --workspace Research
claude mcp add mandala -- npx -y mandala-computer-mcp --profile Work

--profile takes precedence over MANDALA_PROFILE, then the saved default. Names are case-sensitive. An explicit key or nonempty MANDALA_API_KEY takes precedence over every profile and avoids accessing the credential store. Empty explicit keys fail; an empty or whitespace-only environment key is absent. You can still use a key from Settings → Credentials → API keys with MANDALA_API_KEY.

Saved credentials require POSIX protection: a real directory owned by you with mode 0700, and an owned regular file with mode 0600 and one link. Symlinks, hardlinks, unsafe permissions, malformed files and unsupported protection are refused before any API request. Windows file loading is unsupported; explicit or environment keys remain available. Only your home directory's store is read.

A saved profile also binds its API base URL. --base-url or MANDALA_BASE_URL must match that stored base after canonicalization, including the entire path prefix and port. An explicitly empty base flag is invalid with saved credentials. Each stdio session resolves once: restart to pick up another saved key. Revoking the key in Settings → Credentials → API keys makes later calls fail; MCP does not switch profiles, reread the file, or retry a refused action. Run login explicitly when new credentials are needed.

A saved profile can also carry a default workspace, set with mandala workspaces use <workspace> (and removed with --clear); the CLI keeps it in ~/.mandala/defaults.json, beside credentials.json, which it never changes. Started from that profile, the secret tools (list_secrets, get_secret, create_secret, set_secret, replace_secret, delete_secret), create_computer and list_computers use it when a call leaves out workspace_id, as mandala computers create and computers list do; an explicit workspace_id always wins. Their descriptions say so and name the workspace, list_secrets, list_computers and create_computer say when the default chose the workspace, and startup prints it on stderr. There is no "every workspace" value: to list elsewhere, pass another workspace_id (or 'unassigned'), or start the server from a profile with no default. MCP only reads that file, once at startup, with the same checks as credentials.json. It is not applied when the profile's key is confined to a workspace (that key's own scope applies), when the default was saved for another account than the profile is logged in to now, or with an explicit or environment key. A file that cannot be read (not valid JSON, another version, or readable by others) is noted on stderr: list_secrets, get_secret and list_computers then use account-wide, but create_secret, set_secret, replace_secret, delete_secret and create_computer refuse a call without workspace_id, sending nothing, rather than act account-wide; pass workspace_id, or fix or delete the file and restart the server. The hosted HTTP server never reads it, and its tools are unchanged.

Claude Code — as a plugin, which installs the server and a skill together:

# Run mandala login first, or export MANDALA_API_KEY in this shell.
/plugin marketplace add mandalacomputer/mcp
/plugin install mandala-computer@mandala

The skill — plugin/skills/mandala-computer/SKILL.md — is the part the tools cannot say for themselves: when a cloud desktop is the right answer at all, that it consumes running capacity until suspended or stopped, that run_agent is usually the right level and a screenshot per click is not, and which refusals are worth a second try. It is a description of when and how, not a second client; once the server is installed it stays out of the way. MANDALA_MODEL_KEY, if exported alongside, is passed through and turns on run_agent when the configured filters permit it. Without it, run_agent runs on the account's AI credits when they can pay (see Agents on AI credits).

To use an environment key instead of a saved profile:

claude mcp add mandala -e MANDALA_API_KEY=com_… -- npx -y mandala-computer-mcp

Claude Desktop — in claude_desktop_config.json:

{
  "mcpServers": {
    "mandala": {
      "command": "npx",
      "args": ["-y", "mandala-computer-mcp"]
    }
  }
}

Cursor, Windsurf and the rest take the same three fields — command, args, env — in whichever file they keep their MCP servers in.

Your MCP client starts this as a subprocess. It uses the saved profile’s API base, or https://app.mandala.computer/api/v1 by default with an environment key. Programmatic local hosts can call runStdio({ profile: 'Work' }); the exported StdioConfig allows a local key or profile. createServer still requires an explicit API key, and HttpConfig has no local credential options.

Related MCP server: da-mcp

Use

Ask for what you want. A first session usually goes:

Create a computer from the base template, open example.com, and show me what's on the screen.

Under that, the model is doing roughly this:

create_computer(template="base")     → builds it and selects it for the session
wait_for_computer(until="guest")     → the desktop inside is answering, not just the VM
open_url(url="https://example.com")  → puts the page on the screen
screenshot()                         → an image the model can point at
click(x=640, y=400)                  → clicks what it saw
screenshot()                         → looks again

create_computer(size="large") is the fast path: the named shapes from list_sizes are the ones the platform keeps pre-booted, so one of those is usually answered in about a second where a custom cpu/ram_mb/disk_gb shape boots cold. A size sets the template and the numbers together, so send it alone or the explicit fields alone.

use_computer binds a machine to the session, so every later call can leave computer_id out. Pass computer_id explicitly on any call to override it without changing the binding, which is how you drive two machines at once.

Set MANDALA_COMPUTER_ID to bind one at startup and skip use_computer entirely.

The tools

This is the unfiltered inventory. The filters below can withhold tools from both listing and calling; workflows in this README apply only when the needed tools are available. The offline fixture checks exercised operation coverage; verification against the live publication is a separate required CI gate. Parameter and response-mode support remains a separate contract.

Choosing a machine — list_templates, list_sizes, list_computers, get_computer, use_computer, wait_for_computer, get_desktop_url

Lifecycle — create_computer, start_computer, stop_computer, suspend_computer, restart_computer, update_computer, clone_computer, delete_computer, move_computer_to_workspace, move_computer, list_moves, get_operation, list_operations, wait_for_operation — see Lifecycle operations

move_computer_to_workspace changes workspace membership and who can access a computer. It requires an account-wide member or owner credential and explicit computer_id and workspace_id arguments (null means unassigned). The selected computer and default workspace are not used. The computer must be stopped, with no saved session, snapshots or snapshot history copies, secret bindings, or proxy credentials. Refusals leave those resources intact; the tool never removes them to force a move. This is separate from move_computer, which relocates a computer to different hardware.

Driving the desktop — screenshot, click, type_text, paste_text, press_key, scroll, drag, move_mouse, mouse_button, cursor_position, wait

Every one of these that acts — all but screenshot and cursor_position — takes context: true and then answers the desktop as it stands just after the action: the windows list_windows would list and the one with focus, without a second call. They are read once, straight after the action, so a window still opening may not be listed yet; when they cannot be read the action still happened, and the answer says why. When the focused window is Chromium the answer also carries page: the page's URL and title and one line per interactive element visible in it — what it is, what it says (and its accessible name when that is something else), and the point to click. Firefox, the default browser, has no page; then page_not_read gives the platform's reason beside the windows.

Inside the guest — exec, exec_poll, exec_kill, get_execution, read_execution_output, open_url, list_windows, window_action, read_clipboard, write_clipboard, read_file, write_file, write_file_chunk, get_file_upload, cancel_file_upload, list_directory

write_file writes straight to the path by default: a file already there is truncated as the upload starts, so a failed or cut-off write can leave only part of the new contents, with the old ones gone. With overwrite: false it creates the file only if nothing is there, and a path that is taken is refused without that attempt writing anything (Linux computers only). Those contents are written beside the path and published only once complete, so incomplete contents never appear at it, but a failure while publishing or answering can leave the complete file there. After any error read the path before retrying or overwriting. When a partial file must never appear at the path, use overwrite: false or write_file_chunk. read_file and write_file take no_wake: true to refuse (409) rather than resume a computer that is not running. For embedders, the Api raises that refusal as FileExistsError, and a create-only 409 whose reason could not be read as CreateOnlyConflictError, which says nothing about the path; isTransient is false for both.

Retained versions — retain_execution_output, list_results, get_result, read_result_output, delete_result, publish_artifact, list_artifacts, get_artifact, read_artifact, delete_artifact

Passive metadata — list_activities, get_activity, get_activity_results, read_signals

Being told rather than asking — wait_for_event, poll_events, wait_for_file_change

Snapshots — list_snapshots, snapshot_holdings, create_snapshot, restore_snapshot, clone_snapshot, snapshot_schedule, get_retention, delete_snapshot

Your own templates — get_template_schema, check_template, publish_template, get_template, retire_template

Building one — build_template, list_builds, get_build, watch_build, cancel_build

Account quota — get_account

Who you are — whoami, list_api_keys, list_workspaces, get_workspace, list_workspace_members, create_workspace, rename_workspace, delete_workspace. Minting and revoking API keys are deliberately not tools — see Who you are, and API keys.

Deliberately not tools — five API operations, each because it would put a credential in a model's context: minting and revoking API keys (above), and the three browser-connection routes (create, renew and revoke). A browser connection is a raw capability to drive the guest's browser; the TypeScript and Python SDKs' browser drivers create, renew and revoke it and keep it to themselves. Every other API operation has a tool. One body form is left out as well: the input route's batch, and with it the batch wait_for check, which exists only inside one. The input tools take one action per call, so a model sees each answer before it chooses the next.

A key that expires has no desktop or event stream. The platform withholds a computer's desktop credentials from such a key, so get_desktop_url, wait_for_event, poll_events and wait_for_file_change answer that a key without an expiry is needed, once the key's own record confirms it expires.

Every tool refuses an argument it does not declare. A misspelt or unknown key is an input error naming the key, and nothing is sent — so a misspelt flag can never be dropped and the call go ahead without it.

Spending — get_usage, get_credits

Being told somewhere else — list_webhooks, create_webhook, get_webhook, update_webhook, rotate_webhook_secret, test_webhook, list_webhook_deliveries, delete_webhook

SSH access — list_ssh_keys, ssh_key_challenge, add_ssh_key, remove_ssh_key, get_computer_ssh, set_computer_ssh. Keys belong to the person the API key was issued to, not to the account. A key added with add_ssh_key (an API key or connected app) is accepted only by computers with SSH on in the account that credential acts on, and is removed when the credential is revoked; a key added from the dashboard is accepted on every account where that person is an owner or member. list_ssh_keys marks each key with where it works from the account the API key acts on: every account, this account only, or another account only (refused here; which account is not said). A key is registered once, so a key bound to another account cannot be added again here. remove_ssh_key removes only a key marked this account only: one added from the dashboard (every account) or bound to another account answers as if there were no such key, and the person removes it from the dashboard. A workspace-scoped key can read keys but not add or remove them. A key added without proof is unproven: it connects to a computer named by its id, and a computer named by its name is refused. To make it proven, ssh_key_challenge issues a challenge whose sign_command the person runs with their private key file, and add_ssh_key takes the challenge and the signature it prints. list_ssh_keys shows each key's possession.

Showing an app on the internet — list_public_urls, create_public_url, update_public_url, delete_public_url. A port inside a computer served at https://<label>.<base_domain> (the domain is in the list_public_urls answer, e.g. mandala.dev), on 443 with no port in the address. Omitted access defaults to public on paid plans and private on trials. Public means anyone with the link can open it; trials requesting public receive 402 PUBLIC_ACCESS_REQUIRES_PLAN. Private URLs accept an account API key as Authorization: Bearer (workspace-scoped keys must match the computer's workspace), or browser sign-in through the dashboard's Open button. The key never reaches the app. The app must listen on 0.0.0.0, not 127.0.0.1. Labels that read as the platform's or another company's address are refused. A deleted URL's label stays with the account: no other account can ever take it, and the account may use it again unless the platform has blocked it. A computer over its plan's limit serves only its oldest URLs, and the listing marks the rest.

A browser opening a new account's URL may first see a one-time notice page. It goes to any request that looks like a browser opening a page — a navigation by its fetch metadata, or, without fetch metadata, Accept: text/html from a Mozilla/ user agent — so a program sending browser headers sees it too. A client that sets headers skips it with mandala-skip-warning: 1; in the computer's own browser, where open_url cannot send headers, click Continue.

Calling an API without handing the computer the key — list_credential_gateway_bindings, create_credential_gateway_binding, delete_credential_gateway_binding. A binding names a secret from the account's store, an exact https:// origin, a path prefix and the HTTP methods allowed. Programs inside the computer send requests to the binding's base_url followed by the provider path, with the placeholder as the API key — Authorization: Bearer <placeholder> or x-api-key: <placeholder> (both values are in the answer) — and the platform sends them on with the secret in their place: the secret never reaches the computer. The secret goes upstream as Authorization: Bearer <secret> by default, or as x-api-key: <secret> with auth_header: "x-api-key". An Anthropic key binding uses x-api-key (origin https://api.anthropic.com, path prefix /v1), and Claude Code inside the computer then runs with ANTHROPIC_BASE_URL=<base_url> and ANTHROPIC_API_KEY=mandala-placeholder. Answers stream, server-sent events included; a request is limited to 7 MiB, an answer to 64 MiB and a call to 10 minutes. Up to 8 per computer; a binding cannot be changed, only deleted and made again. Owners create and delete them; members can list them. Origins, paths and methods that can only be refused are refused before any request.

Secrets — list_secrets, get_secret, create_secret, set_secret, replace_secret, delete_secret for the account's secret store, and get_computer_secrets, set_computer_secrets and create_computer's secrets for which of them a computer receives. A value goes in through create_secret, set_secret (create the name, or replace its value if the scope holds it — names match ignoring ASCII case) or replace_secret, and never comes back out. No route answers one, and a store tool's result holds only the decoded documented fields (success) or the status, the reason word and a sentence of its own (refusal). It never includes the platform's response text, and the Api keeps none for these routes. The bindings carry only secret ids, revisions and names. A computer receives a secret as an environment variable (env) or as a file under /run/mandala-secrets/user/files (file). A set replaces the whole binding list ([] removes every binding) and reaches the guest at the computer's next start or restart; send the version a read answered to have it refused with 409 if the list changed since. A replaced value also reaches a running computer: a file binding's file is rewritten in place, and on an image that supports it an env binding reaches new shells, and every exec, plain or with desktop: true, runs with the bound variables as they are at that moment (programs already running keep the old value until a restart). replace_secret and delete_secret need the current revision_id, and a stale one is a 409. delete_secret also needs confirm: true: a computer still bound to a deleted secret cannot start again until that binding is removed. Saved memory holding a deleted secret is lost whatever the computer is bound to by then: a suspended computer's saved session, or a memory snapshot, saved while it was bound cannot be resumed or restored, and rebinding first does not help. To rotate without losing one, resume the computer before the delete, bind it to the new secret, then restart it. A bound computer runs, and its guest answers, a few seconds before its secrets land, so wait_for_computer(until="guest") on one also waits until they have; get_computer shows the gap as "its secrets are still on their way in".

A proxy for the browsers — browser_proxy: {server, bypass} on create_computer and update_computer sends a Linux computer's browsers (Chromium, Chrome, Firefox) through a proxy; nothing else on the computer uses it. On update_computer it goes alone, replaces the setting whole, and null removes it. Which proxies are accepted is the platform's rule, and its refusal comes back as it is. A running computer has a change within seconds: wait_for_computer(until="guest") waits until its browsers have it, and get_computer shows the gap as "its browser proxy is still being applied".

A proxy for all outbound traffic — egress_proxy: {server, credentials_secret_id} on create_computer and update_computer sends ALL of a computer's outbound TCP (exec, terminals, package managers and browsers alike) through a proxy, taken on its host so nothing inside the computer can opt out. The server is http://, https:// or socks5:// with an explicit port; there is no bypass list. credentials_secret_id names a secret holding user:password that is not bound to the computer and never reaches it: the computer's host signs in to the proxy with it. It fails closed (proxy down or refusing, or credentials not on the host yet: the connection fails, nothing goes direct), drops UDP to the internet and ICMP, and does not proxy DNS lookups. On update_computer it goes alone — beside any other field it is refused before a request is sent — replaces the setting whole, and null removes it. get_computer names the proxy and, while the host waits for its credentials, says "its egress proxy is waiting for credentials; connections are closed until they arrive".

A computer its host holds paused — a running computer can be paused by its host to recover disk space while its status stays running. get_computer and the listings then say "PAUSED BY ITS HOST", with the reason and since when: screenshots, input and commands stall or fail meanwhile, and it resumes by itself. Do not stop or restart it: a stop discards the paused session, and a start is refused with 503 while the host is still low on disk.

An end time — ends_at (an RFC 3339 time) or ends_in_hours (hours from now, fractions allowed) on create_computer and update_computer makes the computer stop by itself at that time, as stop_computer would; its disk is kept. It fires once and is then cleared. On create the time must be at least 10 minutes and at most 366 days away; on update_computer it only has to be in the future, it goes alone — beside any other field it is refused before a request is sent — and null clears it. Send one spelling, not both. get_computer shows it as ends_at, and its summary says "stops by itself at …". A host that cannot keep an end time answers 409 with reason unsupported. An answer that does not confirm the end time asked for (no ends_at, a malformed or different one, or one still there after clearing it) is an error naming the computer; the computer is left as it is. A same-key retry answered with the first request's stored answer can only have an ends_in_hours end time checked to be no later than asked for, so it succeeds with a line saying the end time is UNCONFIRMED; read it back with get_computer. So does an answer with no Date header, which leaves only this machine's clock to check an ends_in_hours end time against. A clear is confirmed by the absence of ends_at in the answer.

Delegating — run_agent, start_agent_run, run_agent_chat, registered when a model key is present: MANDALA_MODEL_KEY on stdio, or the caller's own X-Model-Key header over HTTP. Without a key, run_agent and start_agent_run are registered when the account's AI credits can pay for a run (see Agents on AI credits). All of them must also survive the configured filters.

Background runs and kept conversations — get_agent_run, list_agent_runs, cancel_agent_run, list_agent_threads, get_agent_thread, delete_agent_thread, registered whether or not anything can pay for a run, since a run or a thread can come from any client — see Background runs and threads

Agent schedules — create_agent_schedule, update_agent_schedule, list_agent_schedules, get_agent_schedule, pause_agent_schedule, resume_agent_schedule, delete_agent_schedule, always registered: every scheduled run spends the account's AI credits whatever this session pays its own runs with, and the platform says so if the account has none — see Runs on a schedule

Runs on a schedule

create_agent_schedule runs the same task on a computer on a timetable: at each time a five-field cron expression names ("0 9 * * MON-FRI"), in its timezone, a background run starts with the schedule's prompt, exactly as start_agent_run would. Scheduled runs spend the account's AI credits — nothing is there to send a model key when one fires — and act as the API key this server uses. A fire is skipped while the previous run is still going or the computer is not running, and one the platform could not send within five minutes of its time is missed, never sent late; five failed fires in a row pause the schedule. get_agent_schedule shows when it next fires and its latest fires, each with the run_id it started for get_agent_run; pause_agent_schedule and resume_agent_schedule stop and restart it; update_agent_schedule changes it; delete_agent_schedule (with confirm: true) removes it. Runs it already started are untouched by any of these.

Tool filters

Set MANDALA_READ_ONLY=1 to register only tools whose existing annotations.readOnlyHint is exactly true. It accepts 1, true, yes, on for on and 0, false, no, off, empty or unset for off, ignoring surrounding whitespace and letter case. Any other value fails at startup. Safety is not inferred from a tool's name or HTTP method: read_file and cursor_position can wake a computer and consume running capacity, so they are withheld. So are mixed read/write tools such as wait_for_computer and snapshot_schedule. screenshot, read_clipboard and list_windows retain their read-only hints.

Set MANDALA_TAGS=input,guest to select a union of named tool groups. Names are lowercase only, comma-separated, trimmed and deduplicated. Empty or unset means no tag filter; empty comma-separated entries are ignored. An unknown nonempty tag fails before stdio connects or HTTP starts listening, with an error listing all valid tags.

Tag

Tools

account

get_account, whoami, list_api_keys, list_workspaces, get_workspace, list_workspace_members, create_workspace, rename_workspace, delete_workspace

computers

list_computers, get_computer, use_computer, wait_for_computer, get_desktop_url, list_sizes

lifecycle

create_computer, start_computer, stop_computer, suspend_computer, restart_computer, update_computer, clone_computer, delete_computer, move_computer_to_workspace, move_computer, list_moves, get_operation, list_operations, wait_for_operation

input

screenshot, click, type_text, paste_text, press_key, scroll, drag, move_mouse, mouse_button, cursor_position, wait

guest

exec, exec_poll, exec_kill, open_url, list_windows, window_action, read_clipboard, write_clipboard

files

list_directory, read_file, write_file, write_file_chunk, get_file_upload, cancel_file_upload, wait_for_file_change

executions

get_execution, read_execution_output

results

get_activity_results, retain_execution_output, list_results, get_result, read_result_output, delete_result

artifacts

publish_artifact, list_artifacts, get_artifact, read_artifact, delete_artifact

snapshots

All snapshot tools listed above, including get_retention

templates

list_templates, all your-own-template tools and all build tools listed above

events

wait_for_event, poll_events, wait_for_file_change

usage

get_usage, get_credits

webhooks

All webhook tools listed above

ssh

All SSH tools listed above

public_urls

list_public_urls, create_public_url, update_public_url, delete_public_url

credential_gateway

list_credential_gateway_bindings, create_credential_gateway_binding, delete_credential_gateway_binding

secrets

list_secrets, get_secret, create_secret, set_secret, replace_secret, delete_secret, get_computer_secrets, set_computer_secrets

agent

run_agent, run_agent_chat, start_agent_run, get_agent_run, list_agent_runs, cancel_agent_run, create_agent_schedule, update_agent_schedule, list_agent_schedules, get_agent_schedule, pause_agent_schedule, resume_agent_schedule, delete_agent_schedule, list_agent_threads, get_agent_thread, delete_agent_thread

activities

list_activities, get_activity, get_activity_results

signals

read_signals

The selected tags form a union, then intersect with read-only and the existing lifecycle and model-key restrictions. MANDALA_NO_LIFECYCLE=1 still withholds its five tools even when their tags are selected; selecting agent cannot enable run_agent_chat without a per-session model key, nor run_agent or start_agent_run without one or credits that can pay. The tools that start a run, cancel_agent_run, delete_agent_thread and the schedule tools that change a schedule are withheld by read-only, but remain available with lifecycle disabled alone; an agent selection with read-only keeps the reads of runs, schedules and threads. MANDALA_TAGS=files MANDALA_READ_ONLY=1 exposes only list_directory. activities,results includes get_activity_results once; signals is separate from the active events socket. Filters never grant API privileges: the API checks current member/owner and workspace authorization on every request.

use_computer is not read-only. When it is withheld, pass computer_id explicitly, or bind a computer with MANDALA_COMPUTER_ID at stdio startup. HTTP callers must supply their own computer selection. These variables apply to both transports and the plugin forwards them. Embedders can pass readOnly: true and tags: ['input', 'guest'] in ServerConfig; the server does not read the environment itself.

Lifecycle operations

Every accepted create, clone, start, stop, suspend, restart, snapshot restore, resize, host move and delete records a lifecycle operation, and the tool that made the call says its operation_id — in its sentence, as (operation op_…), and in the JSON. move_computer carries it onto the outcome it reports. It is absent where the platform could not record one; the call happened either way.

get_operation reads one, and list_operations pages through them newest first (computer_id, limit, cursor, idempotency_key; computer_id is not defaulted to the selected computer, and idempotency_key finds the operation a call sent with that key recorded, even when the call's answer was lost). wait_for_operation polls one until it is final: it answers on succeeded, and a failed one is an error carrying the platform's error.code (start_failed, build_failed, computer_gone, move_failed, resize_not_applied, lost, and more may be added) and its sentence.

succeeded means the platform finished its step, not that the desktop has booted: wait_for_computer is still the wait for a desktop that answers. Most operations are already succeeded when their tool answers; a clone is running until its disk is copied, and a move until it lands. All three are reads, and all three stay registered when the lifecycle tools are withheld, since start, stop, suspend and restart record operations too.

The eleven lifecycle tools (create_computer, clone_computer, start_computer, stop_computer, suspend_computer, restart_computer, update_computer, move_computer, delete_computer, restore_snapshot, clone_snapshot) take an optional idempotency_key. Leave it out and a fresh one is sent for you; a failure whose outcome is unknown names the key it went with. What to do next depends on who answered:

  • The answer was lost (the connection dropped after the request went out, or a proxy in front of the platform gave up), or the platform answers idempotency_in_progress: call the same tool again with the same idempotency_key. The platform answers with the first call's result, or says it is still running; the step is not done twice.

  • The platform answered a 5xx that names no operation_id: nothing may have been done. A refusal given before the call was sent anywhere — another launch already in progress, no host to place it on, the template catalogue incomplete — names none, and the platform releases its key. Call the same tool again with the same idempotency_key: the platform carries it out if the key was released, or answers idempotency_outcome_unknown if not, and only then does the case below apply.

  • The platform answered a 5xx that names an operation_id, or idempotency_outcome_unknown: the key is spent, and resending with it only answers idempotency_outcome_unknown. The platform then keeps the call's operation pending for up to an hour, whatever happened, while its host may be carrying it out. What to read depends on the tool:

    • start_computer, stop_computer, suspend_computer, delete_computer, move_computer and update_computer: read get_computer (and get_operation with the operation_id the error named: succeeded means the step happened, running means wait on it, and pending alone is no reason to wait). If the step did not take effect, send the call again with a new key, or none.

    • restart_computer, which get_computer cannot show: a computer reads running before and after a reset. Read the operation instead (get_operation with the operation_id the error named, or list_operations with the key): succeeded means the restart happened, running means wait on it. Anything else leaves the restart possibly done, so ask the user before sending it again with a new key, or none; a second restart resets the guest again.

    • create_computer, clone_computer, clone_snapshot and restore_snapshot, where a read of the computer made straight away can show no effect for a build or restore that then lands, and a second one is a second computer or a second overwrite: read the operation first — get_operation with the operation_id the error named, or list_operations with the key — and while it is pending or running, wait (wait_for_operation) and do not resend with any key. Only once it is final as failed (error.code lost, for one) or no longer found, AND get_computer (list_computers after a create or a clone) shows the step did not happen, send the call again with a new key, or none. If no operation is found at all, read the computer again after a few minutes before resending.

  • idempotency_key_reused: a different call already used that key, and nothing was done. Send this one with a new key, or none.

Keys last 24 hours.

Who you are, and API keys

whoami takes no arguments and reads GET /api/v1/whoami: the person this server's API key was issued to, the account and role it acts with (the role as it is now), the workspace it is confined to, and the key itself — including manage_keys, whether it may manage API keys. It needs no permission and any role, and a suspended account can call it; the answer says so when the account is suspended. Behind the hosted server's OAuth sign-in, the key is the Connected app's (prefix oauth).

list_api_keys lists the key holder's API keys on the account, newest first — never a raw key. Each carries minted_by_key_id: the key that minted it over the API, or null for one minted from the dashboard. Revoking a key does not revoke the keys it minted. It needs this server's key to be allowed to manage keys, which only a person can turn on in the dashboard (Settings → Credentials → API keys → the key's menu → Allow managing keys); without it the tool answers the platform's 403, whose sentence says exactly that. A Connected app's key never has the permission.

Minting and revoking keys are not offered here, on purpose. A mint answers the new key in full, once, and a model's context — the conversation, the client's logs, whatever the transcript is shared with — is the worst place for a long-lived credential and one nobody can take it back from. A revoke is irreversible, and on a model's reading of a list it can cut off the person's CI, another agent, or this very session. People do both from the dashboard or with the mandala api-keys CLI.

list_workspaces, get_workspace and list_workspace_members read the account's workspaces, which partition its computers. A key confined to a workspace lists only that one, and is refused (403) the member list, which is the whole account's: workspaces do not divide people. All three are reads.

create_workspace, rename_workspace and delete_workspace change them, and need an owner's key that is not confined to a workspace: any key confined to one is refused (403), so none of them can touch the workspace this server's own key stands in. delete_workspace needs confirm: true and REVOKES every API key confined to the workspace, whoever holds it — a person's CI or another agent may be using one — and answers how many. Only an empty workspace can be deleted: one that still holds computers or active secrets is refused (409), saying how many, and nothing is deleted or revoked. Move its computers out with move_computer_to_workspace (or delete them) and delete its secrets with delete_secret, then send it again. None of the three is offered to a read-only session (MANDALA_READ_ONLY).

An account-wide key can work in one workspace without a key confined to it: create_computer(workspace_id: ...) creates the computer there, and names its secrets and an egress proxy's credentials_secret_id from that workspace's scope (its own secrets and the account-wide ones), and list_computers(workspace_id: ...) lists that workspace's computers, or with 'unassigned' the ones in none. A workspace the key cannot reach is not found, and so is 'unassigned' from a confined key. Left out, these two tools apply the saved profile's default workspace, as the secret tools do (see above); with no default, the computer goes in the key's own workspace or in none, and the listing is every computer the key can see.

Current account quota

get_account takes no arguments and reads GET /api/v1/account once with the caller's account credential. Viewer or stronger access is required. It reports account-wide aggregates, including for a workspace-scoped key, without resource identities. It needs no selected computer or model key, opens no event stream, and remains available with read-only and no-lifecycle filters. Select the account tag to expose it on its own.

The report includes the effective plan, pool ceilings, per-computer maxima, capabilities, current consumption and remaining quota. capabilities.windows says whether this account may create Windows computers, which an administrator grants per account and no plan includes; capabilities.macos says whether this account may create macOS computers (os: "macos"), which are available on request rather than with a plan, and reads false against a platform that does not send it. Configured CPU and disk include kept computers regardless of power state; running or reserved RAM includes current reservations. Kept template builds share the disk pool: usage.kept_build_gb is their nominal GB, remaining.configured_disk_gb leaves them out, and the answer states the room a create or disk resize has (remaining.configured_disk_gb minus usage.kept_build_gb). A null kept_build_gb means build history is unread, so that room is unknown and a create or disk growth can be refused with 503 until it is read; the field is absent from a platform that predates it. CPU, MB, GB and snapshot bytes retain the API's units. get_usage separately reports historical metered consumption over time.

Quota is advisory: observed_at is an observation time, not a reservation or consistency token. Later create, resize, start or snapshot requests can still be refused, and existing 402 messages remain unchanged. Snapshot headroom is against indexed stored bytes; it does not include in-flight capture reservations and does not establish that a new capture will fit.

complete.computers and complete.snapshots are independent. An incomplete group has null for all its consumption and remaining figures, meaning unknown, while the other group can retain numeric values. Complete zero usage and zero remaining quota remain numeric zeros. Verified plan ceilings remain available in a partial report, including a no-plan account that still has retained usage. Malformed reports and HTTP failures remain errors, never an empty account. The tool prints unknown and advisory guidance before the projected public fields.

Things worth knowing

Every computer is a Linux desktop today. Windows guests are not offered on any plan; where this README mentions Windows it is describing behaviour the client already supports for when they are.

Running computers consume running capacity until suspended or stopped. Runtime and individual exec calls do not add a charge to the monthly subscription; AI-credit usage is charged separately. create_computer says so in its own description, and so does everything that starts a machine by a side door — restore_snapshot boots a stopped computer, and write_clipboard, read_file and cursor_position each resume a suspended one, because each has to reach the guest agent to do its job. All of them are subject to running-capacity limits, and on a plan at its limit can come back 402 rather than a result. The two reads are the surprising half of that list, and are why neither is annotated readOnlyHint: a host that auto-approves read-only tools would otherwise wake a machine and consume running capacity with nobody asked. screenshot, read_clipboard and list_windows genuinely do not start anything and keep the hint. When a stretch of work is over, suspend_computer (a pause: start_computer brings the same session back in about a second) or stop_computer (a shutdown: the disk is kept, the session is not). Idle suspend catches the ones a model forgets, but only after 30 minutes untouched. get_usage reports the resources used over time, not an invoice amount.

Some defaults here differ from the SDKs', on purpose. screenshot's fresh defaults to true (the SDKs default to false), because after a click a cached frame can predate the action and a model reading it clicks again. Its width outside 64-3840 is refused rather than clamped as the API would. wait_for_computer polls every 2 seconds (an SDK launch polls every 3), and refuses a suspended computer and names start_computer, where the SDKs' waitForGuest resumes it.

A screenshot need not be the whole screen. screenshot takes region (a crop, in full-size capture pixels before any scaling), scale (0 to 1), format (png or jpeg) and quality (JPEG, 1-100). A cropped or scaled picture is in its own pixel space, so the tool says alongside it how to turn a position in it back into screen coordinates.

Live screenshots also return a capture name and the capture's original size, before cropping or scaling. Use that size instead of the computer record's resolution, which can differ. To crop a frame you already measured, send its capture with region; omit fresh or set it to false. Without capture, screenshots remain fresh by default. fresh: true cannot be combined with capture. If the capture is no longer held (stale_capture), take a new screenshot without capture or region, then remeasure the region and use the new capture name. Saved frames of suspended computers cannot be pinned this way.

Ten clicks need not be ten screenshots. Driving the desktop one tool at a time — screenshot, click, screenshot — puts an image in the calling model's context for every step. run_agent hands a task in plain language to the platform's own loop instead, which screenshots, decides and clicks inside the platform and answers with a sentence and the list of what it did. It is registered when a model key is present (see Configuration), and bills that key for the run, or else when the account's AI credits can pay (see Agents on AI credits). max_steps bounds the WORK rather than the bill: a step is one action on the desktop, one model reply can ask for several and spends a step on each, a paused turn costs tokens and no step, and not every step takes a screenshot. It defaults to 20 and is capped at 100 here.

A screenshot is how you find out what the screen looks like. A click that landed and a click that did nothing produce the same tool result, so a model that acts without looking is the single most common way one of these sessions goes wrong. The tools say so in their own descriptions and the server's instructions say it once more.

But a screenshot is no longer how you find out whether anything happened. The platform's computers report what they do — a window opening, closing or taking focus, the clipboard changing hands, a background command exiting, the desktop coming up, the machine going idle, every power transition — and wait_for_event blocks until one of those arrives instead of screenshotting in a loop to discover that nothing has.

The part worth understanding is where the socket lives. A model takes turns; it is not sitting in a loop reading a stream, and between two of its turns there is nobody here to read one. So this server holds the connection, one per computer, opened the first time a tool asks about it and kept across turns. What arrives while the model is doing something else is buffered, and the next wait_for_event or poll_events is handed it in order. The model holds a cursor and never learns that a socket exists.

Three consequences, and they are the whole of the design:

  • A wait that times out has missed nothing. The stream stayed open while the tool call was not running. That is why the timeout is capped at 55 seconds rather than the fifteen minutes wait_for_computer allows — a short wait costs nothing, because calling again picks up exactly where it left off. A timeout is a normal answer here, not an error.

  • An event that already happened still ends a wait. computer.ready fires once per desktop session, so a machine that has been up for an hour will never send it again; attach to one and you are handed a computer.ready marked synthesized rather than waiting forever for an event that cannot arrive.

  • A hole in the history is answered, not forwarded. When the platform cannot replay from where this server had got to, the events that survived come back with a count of what did not and with the state the missing ones would have reported — the window listing and the computer's own record. The gap frame itself never reaches the model, because a model handed one would invent a recovery procedure.

A file being written is an event, once you ask for one. file.changed is the one thing on this stream nobody is sent unasked: a directory has to be nominated on the connection, and without one the platform sends no file events at all. wait_for_file_change is that nomination and the wait in one call — give it an absolute directory in the guest and it blocks until something under it is created, modified or deleted. Use it for a build writing its output, a download landing, a script producing a file; the alternative is running ls in a loop, which is the file-shaped version of the screenshot loop.

Three things about it are worth knowing before you use it, because each is a way to read an answer wrongly:

  • A nomination is not a watch. The guest has to be asked, and on a computer nobody has opened a terminal on the watcher is installed into the guest first — seconds, not milliseconds. inotify reports changes and not state, so nothing that happens before a tree is armed is ever reported. This tool never returns "nothing changed" from inside that window: until the tree is genuinely being watched it says so, in as many words, and tells you to call again.

  • lost is not an error. A tree that changes faster than the stream reports it comes back as one marker rather than thousands of events — which is what makes a watch under a build usable at all. The watch is still on and the tree is still being watched; what you have lost is your picture of it, so list the directory and carry on. The one exception is unwatchable, which means the tree is not being watched: the path is not there yet, is not a directory, cannot be read, or is a symlink, and symlinks are refused rather than followed.

  • Nominate the narrowest tree you care about. A home directory under a build is thousands of changes a second, and what you get for it is a flood marker rather than the changes. Your session holds four trees at once per computer — a fifth evicts the one you asked about longest ago, and you are told which one went — while the computer itself watches at most 32 across every client connected to it. A nomination past that limit is refused where a websocket client is told nothing at all, so this server works it out by elimination: it drops the tree, the rest of the stream comes back, and it says which of the two it was. Adding a watch can never cost you the window and process events you already had.

A computer holds at most 8 event streams at once, and an account 128 on one server. A stream past either is refused with a 409 and no reason, and waiting does not lift it until another stream closes. A websocket client is told nothing about that refusal, and the computer still reads running, so this server reports it after five failed connections in a row: the stream stops and poll_events says to close another stream on that computer. Each SDK waitFor/events call holds one, and so does each MCP session that has asked about the computer's events.

Not everything else is an event, though. A click landing and a page painting are not, and no amount of waiting will produce one — screenshot, list_windows and exec_poll are still the answers there. wait_for_event refuses at once, naming what the computer can emit, when asked for something this guest will never produce.

The guest half is not one capability. A Windows guest has no event stream at all. A Linux one whose hardware carries no terminal channel produces nothing the guest reports about itself. But file.changed runs against libc's own inotify calls and needs only that channel, while window.*, the clipboard and readiness also need the X bindings their desktop watcher is written against — so an older Linux image reports every file change and no window event whatever, and a host old enough to predate file watches reports the reverse. The refusals name which shape it is, because the three want different things done about them: a stop and a start gets a channel, nothing gets an image its bindings, and a host that predates the feature is not something a caller can act on at all.

running does not mean ready. A computer reports running when the hypervisor has started the VM; the desktop inside comes up seconds later. wait_for_computer(until="guest") waits for the software to answer, which is what exec, files and a painted screen actually need. On a Linux computer it also waits for the desktop session to be logged in, so an exec with desktop: true sent next is not refused. That is more than the SDKs' waitForGuest / wait_for_guest, which return once the guest agent answers; the value keeps the name "guest" because renaming it would break callers.

A resize can be refused with an offer rather than a no. Growing a computer past what the host it is on can run comes back as a refusal that says another host in the region could run it. That one does not clear by waiting — retrying the same resize gets the same answer for as long as the computer is on that host. move_computer is how you take the offer up: it moves the machine to different hardware, copying its disk to get there, and applies the size on arrival. Tell whoever you are working for what it costs before you call it, and read list_moves if the wait runs out. A move that ends moved rather than done is the one to read carefully — the computer is on another host, at its old size, and an ordinary update_computer finishes the job.

A webhook is the same events, delivered to somebody who is not here. wait_for_event is for the model, which takes turns and can afford to ask. A CI job or a queue worker cannot, and create_webhook is how it gets woken instead: an HTTPS endpoint the platform POSTs each event to, byte for byte the object the socket frames, signed with the three Standard Webhooks headers. The secret that signs them is in the create answer once and never readable again, which is why the first line of that answer says so; rotate_webhook_secret is the only way to another. This server only sets webhooks up and reads how they are doing — it does not receive them and has no verify, because a server with no endpoint has nothing to verify. list_webhook_deliveries is where a delivery that ran out of retries, or was dropped because the queue was full, shows up; nothing is dropped without a record. It reads the newest hundred by default: state filters (exhausted, dropped and so on), limit takes 1 to 100, and before pages back from a delivery id. A delivery exhausts about fourteen hours after it was queued, so on a busy subscription ask for state: "exhausted" rather than reading the newest page. A test sent while the subscription holds 10,000 unfinished deliveries is recorded as dropped and never sent, and test_webhook says so.

A capture outlives the request that starts it. POST /computers/:id/snapshots answers 202 with a placeholder row and copies the disk afterwards, which takes minutes and scales with how much has been written — longer than any HTTP request survives. So create_snapshot polls: it holds the id the platform allocated before the copy, watches list_snapshots for that row to stop reading capturing, and answers with the finished snapshot. It waits for not capturing rather than for pending, because replication can carry a small snapshot straight on to durable between two polls; and it matches on the id rather than on the newest row for the computer, because a scheduled capture finishing in the same window makes that wrong on exactly the long captures where it matters. wait: false hands back the id instead, for a caller that would rather poll on its own schedule.

The three answers it can end on are kept apart deliberately. A capture that lands is the snapshot. A capture that FAILS mid-copy leaves no snapshot and no row — the capturing row simply disappears, and that absence is the only signal there is, which is why an incomplete listing is never allowed to decide it. A wait that runs out says the capture is still running and names the id to follow, because that one asks for a look rather than for another attempt.

A deletion outlives its request too, and reads the other way round. DELETE /snapshots/:id answers 202 and then detaches the dependent snapshots and removes the stored objects. There is no state that means deleted, so delete_snapshot polls for the row to go — the mirror of a capture, which polls for a row to stay and change. A row that stays is one that STALLED, and it sits in deleting, a state a bare listing hides: the poll asks with include=unfinished for exactly that reason, since without it a half-deleted snapshot is indistinguishable from a deleted one. The platform retries a stalled deletion itself every fifteen minutes, so the give-up sentence says to watch rather than to repeat.

Because absence is the success signal here, "Deleted" is said only off a listing read whole. A row missing because a hypervisor did not answer is not a row that is gone, and that mistake is unrecoverable in a way the others are not: nobody goes looking for a snapshot they have been told was destroyed. A 409 saying the snapshot is already being deleted is progress, not a fault — the answer is to watch that deletion finish, never to go and delete something else.

A schedule says when, not how long. snapshot_schedule sets the window a computer's automatic snapshot is taken in; get_retention is what says how many of them survive, and it takes no computer because the window belongs to the account. Only automatic snapshots are ever aged out, so taking one with create_snapshot is how a model keeps something past it.

A usage total that is short does not look short. get_usage answers what the account has used — read it before and after a batch to monitor resources. It reports usage, not a monetary cost. Every figure in it is a sum across the hypervisors the account's computers are on, so a host that could not be reached does not leave a gap: it leaves a total that is quietly too small. The answer says so in its FIRST line when that has happened, ahead of the numbers, because a caveat under a figure is a caveat that has already been acted on. Two kinds, and only one of them clears by retrying.

One window at a time, at most 62 days of it, reaching back 399 — every hypervisor replays its ledger a day at a time to answer, so an older period is read by naming both from and to rather than by widening one of them. to on its own is measured from the current billing period and is refused.

exec runs as root with no display. A GUI application started without desktop: true cannot draw. open_url is the reliable way to put a web page on the screen — and it returns before the browser paints, sometimes by ten seconds.

A variable belongs in env, not in front of the command. exec takes an env object, and FOO=bar cmd is a different thing: it is shell syntax, so a value with a space or a quote in it is yours to quote and is silently cut in half when you get it wrong. It also puts the value in the guest's ps for anyone logged into the machine, and a background command's command line comes back inside every exec_poll answer.

Anything slow wants background: true. A build or an install run in the foreground comes back as a timeout, with the work still going inside the guest and its output unreadable. With a handle you get the exit code and the output, and exec_kill stops it.

A command running across a host restart keeps its status, not its output. When the service on the computer's host restarts, a background command that was already running still answers exec_poll with whether it is running and, once it ends, its exit_code — but both streams stay empty and output_unavailable (today "daemon_restarted") says the output cannot be read; the tool says so above the JSON. For a few seconds after the restart a poll can be refused as worth sending again; a refusal that does not say so is not worth sending again at once — the guest agent has not confirmed the command for five minutes — and a later poll answers again once it does or the command exits. exec_kill on such a command is refused while it still runs, so stop it from inside the computer with exec. Its command is the copy the platform kept, at most the first 1 KiB, and command_truncated: true (said above the JSON too) means it was cut. get_execution answers for its execution_id with the same output_unavailable, refused with a 409 contention (worth sending again) for those first seconds and with a 409 carrying no reason once the guest agent has not confirmed it for five minutes (not worth retrying at once; a later read answers again when the agent does or the command exits); read_execution_output refuses it with a 409 output_unavailable carrying the same marker, which no retry changes (without the marker, the same code is a log not opened, possibly not created yet, and a later read can succeed). Do not run the command again to recover its output: that repeats whatever it did.

Stable background reads. When an accepted exec returns execution_id, use get_execution for its last observed running, exited or lost state. Only exited carries an ended_at and signed exit_code; running does not prove the computer is awake, and lost establishes neither success nor failure. Older replies can omit the ID. A malformed supplied ID leaves the accepted command and its valid PID usable, but supplies no stable identity: do not replay the command to obtain one. PID polls/kills never reconstruct this association.

read_execution_output takes that ID and both stdout_offset and stderr_offset byte positions. Start each reader at zero, then pass its own returned positions. For example:

{"execution_id":"exec_0123456789abcdef0123456789abcdef","stdout_offset":0,"stderr_offset":0,"limit":4096}

Each stream is bounded to 4,096 bytes by default, at most 16,384. Complete lossless UTF-8 appears as stdout/stderr with its BOM preserved. NUL, binary and split UTF-8 chunks remain exact canonical stdout_b64/stderr_b64; nothing is trimmed or replaced. stdout_more and stderr_more are independent, and false means EOF at that moment, not that the command has finished.

The separate diagnostic/diagnostic_b64 repeats on every read. At most 4,096 of its up-to-65,536 available bytes are displayed: inspect diagnostic_available_bytes, diagnostic_displayed_bytes, and diagnostic_display_truncated. The independent diagnostic_truncated flag is the platform's capture limitation. Diagnostics never advance either cursor. Neither new tool consumes output from another reader or the shared exec_poll cursor, and both carry read-only, non-destructive, idempotent annotations.

These are single requests with cancellation, no automatic resume, retry, watcher, capture or command replay. Metadata reads no guest files. Output reads perform guest I/O without refreshing activity and are unsuitable for passive Activities/history. Files are mutable guest data, not retained artifacts; handles can vanish on restart, replacement or cleanup, and observed exits expire after ten minutes. An unavailable read is an error, not empty output. Every new-tool result is bounded to 256 KiB of serialized data.

Explicit immutable retained versions. retain_execution_output accepts an execution_id and captures one version of its volatile output with one POST. It performs guest I/O, without resuming or replaying the command. Its optional max_bytes_per_stream defaults to 1 MiB (maximum 4 MiB); retention_seconds defaults to 86400 (maximum 604800). Diagnostics are separate, up to 64 KiB. Each capture creates a version; there is no automatic capture or retry.

get_result reads finite metadata by result_id. read_result_output requires result_id, stream (stdout, stderr or diagnostic) and offset, with limit defaulting to 4096 and capped at 16384 bytes. It reads one independent page, with exact offset, next_offset, eof and returned bytes count. Content is lossless text (BOM preserved) or canonical base64 for binary, controls and split UTF-8. EOF means the end of this retained prefix, not task completion. A page alone does not verify the full manifest hash. delete_result deletes that version once; a repeated 404 remains unavailable.

Existing synchronous exec accepts retain_output: true or a strict object with those same two options. False or absence leaves default behavior alone. It cannot be combined with background: true. A canonical returned result_id confirms optional retention; no execution ID is fabricated. Missing, malformed or unsupported optional metadata leaves the command outcome unchanged and does not authorize replay. Retained-prefix truncation and upstream response truncation are distinct. Synchronous results have no diagnostic stream; an explicit diagnostic read can return 409.

Nominated file versions. publish_artifact requires an absolute path, expected_size and expected_sha256 supplied by the caller. For example:

{"path":"/tmp/empty.txt","expected_size":0,"expected_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}

Paths preserve legal Unicode, spaces and Linux backslashes; Windows drive and UNC paths are also accepted, subject to the platform's current OS proof. Publication performs one nominated guest-file capture, without a client-side stat, list, read, hash or exec preflight. max_bytes defaults to 8 MiB and is at most 64 MiB; expected size must fit. Retention has the bounds above. Optional execution_id records verified caller selection, not proof the execution created the file. Every publication creates an independent immutable version.

get_artifact reads metadata. read_artifact first reads that metadata and, only if the complete size fits max_bytes (default 4096, maximum 16384), reads the entire retained object and verifies its exact length and SHA-256. Over-cap objects return metadata with a refusal before any content request; use an SDK whole download with an adequate cap. There are no partial artifacts, Range requests, local destinations, filenames, image/HTML previews or guest fallbacks. Verified content uses the same lossless text/base64 presentation. delete_artifact deletes only that stored version, not the guest file; repeat 404s remain truthful failures.

list_artifacts and list_results list what a computer holds, newest first, with how full the computer's and the account's retained quotas are. Each call shows at most 300 rows; offset (default 0) skips that many of the newest, and when older rows exist the reply says the offset to read on with. A non-zero offset at or past the end is refused rather than answered as an empty listing. The two kinds share those quotas, and usage also counts captures in progress and deleted objects not yet cleaned up. A full quota refuses a capture with 409 result_quota_exhausted and nothing captured; it clears only as objects expire or are deleted, so list and delete rather than retry. The listings are also how to find a version whose capture answer was lost.

All ten retained tools resolve the computer selection once. Reads are passive but require current authorization and scope availability; retained bytes can be unavailable when the host cannot verify access, after expiry or deletion, or when storage is unavailable. They never wake a guest or substitute live output. New operations have one 90-second budget across headers, bodies, and both artifact requests. An MCP client can impose an earlier deadline. Cancellation, redirects and malformed responses never trigger a retry; a lost publication response means commitment is unconfirmed, not undone. Each entire serialized retained tool result is bounded to 256 KiB. Reads are marked read-only; capture/publication create new versions; deletes are destructive with an idempotent deletion effect. Activities result detail remains outside this MCP runtime.

Past about two minutes it does not even come back as a timeout. A proxy in front of the platform abandons a request that has produced no response for roughly that long and answers 524, which arrives as GatewayTimeoutError — whatever timeout_s said, because the hop that gives up never saw it. Measured against app.mandala.computer: sleep 130 failed at 125.2s with timeout_s: 300 and at 125.3s with timeout_s: 3600. Raising timeout_s buys nothing; background: true is the only thing that works. The abandoned command keeps running, so the call after one of these often reports the guest agent as busy — that is the first failure continuing, not a second one.

That roughly two-minute ceiling belongs to the hosted proxy. The server accepts integer foreground timeout_s values from 1 through 600 seconds (default 30), and the tool exposes that range for a MANDALA_BASE_URL reached without the proxy. The HTTP client allows 630 seconds for response headers so the server can report a 600-second timeout. Use background: true and poll the handle for longer work.

list_windows sees what a screenshot cannot. It is how you tell an application that failed to start from one that has not painted yet. Match on class (the application), not title (whatever page it is showing).

The clipboard is two tools, not a shell recipe. read_clipboard and write_clipboard reach the desktop's CLIPBOARD selection — what Ctrl-C writes and Ctrl-V pastes — on Linux computers whose desktop image includes its desktop's clipboard tool: xclip on X11, or wl-clipboard (wl-paste/wl-copy) on a Wayland image such as Omarchy. An image without that tool gets a permanent 400 from both tools that names it; changing the computer's runtime state or retrying cannot fix that image dependency. Pair write_clipboard with press_key and keys: ["ctrl","v"] — two key names, not the string "ctrl+v" — to get the text into whatever has focus. Do not reach for xclip through exec instead: exec runs a login shell, so the guest user's profile prints onto the same output your command does and corrupts a read you are trying to parse, and a write that way needs a resident holder, a redirect, base64 and a polling loop. The write here is confirmed by the platform reading the selection back before it answers. 64 KiB in, 128 KiB out, and the read is refused rather than truncated past its cap. write_clipboard resumes a suspended computer; read_clipboard does not.

Computers suspend themselves. After 30 minutes untouched, by default. Input, exec and file transfers count as use and resume it automatically; screenshots deliberately do not, so a loop that only watches can see its own machine go down under it.

A stop asks first, then forces. stop_computer asks the guest to shut down and gives it up to 45 seconds; a guest still up after that — a hung X session, a modal "unsaved changes" dialog, a service that ignores its own shutdown — is forced off by the platform, so an ordinary stop ends stopped and can take about 83 seconds to answer. Configure the MCP client to allow at least 95 seconds for a stop; caller cancellation is still honored. force: true skips the asking and the wait and pulls the power at once — the equivalent of holding the button in — and whatever the guest had not written to disk goes with it. It saves 45 seconds, not a failed stop, so leave it out unless the computer must be off immediately.

Purging snapshots is bound to the set you were shown. Deleting a computer keeps its snapshots by default. To destroy them too, read snapshot_holdings first — a count, a byte total and a fingerprint — and pass that fingerprint to delete_computer as expect. The purge is then refused if the set has changed since you looked, so a capture that finished in between cannot be swept up by a decision that was never about it. delete_computer will not purge without one, and the platform makes expect optional only for callers that had no way to read the holdings.

A short list is refused, not silently served. list_computers, list_snapshots and list_builds fan out across hypervisors, and if one cannot be reached the platform answers 503 rather than a list that is quietly missing things. allow_partial: true accepts the incomplete answer instead — and when it does, the result opens with an INCOMPLETE: line saying so, because a short list reads exactly like the missing things were deleted.

list_builds is the one where that line is always all you get. The platform keeps no record of which hypervisor ran which build, so a short build listing simply has fewer rows, an unknown number missing and nothing marking the gap.

The other two append a row marked unreachable for each thing they could not reach, with one difference by key. A WORKSPACE-SCOPED key gets no marked snapshot rows, because naming the missing ids would mean reading them out of a host cache that has no workspace column, and handing a confined credential ids from the workspaces it is confined away from. Its computer listing still marks the rows the platform's own record holds as unreachable or being deleted, since that record has the workspace column the cache lacks. (Such a key cannot call list_builds at all: builds need an account-wide key.) Whatever the key, the INCOMPLETE: line is the one signal every short listing carries, which is why it is written first and in prose.

A computer has a lifecycle of its own, separate from what its guest is doing. state is the platform's record of whether the machine exists — live, deleting, deleted, lost, or unreachable when a listing could not confirm the row against its host — while status is the host's answer about the guest. A row served from the record has the first and not the second, so list_computers prints both when both are there: a computer can be running and being deleted at once.

An unfiltered listing is live, unreachable and deleting. The two terminal states are withheld from it, so list_computers(state: 'deleted') is the only way a computer that has gone is ever shown — and an empty answer to a filtered listing is a fact about the filter rather than about the account, which is what it says rather than inviting you to create one.

Snapshots mid-deletion still count against storage but are hidden. A deletion that began and did not finish still holds objects and still counts against storage, and the default listing leaves it out — every ordinary caller is asking "what can I restore". list_snapshots(include_unfinished: true) is the flag for when the question is about storage instead.

Read the reason, not the status. Whether a refusal clears on its own is the platform's reason word, and each tool's answer says what it means: contention (something was in flight) and starting (the guest agent is still inside its boot window) clear, so the same call works in a moment; unavailable, running, unsupported, unsupported_on_macos (a feature macOS computers do not offer), exists and revoked do not. A 409 does not mean "wait": exec, input and the clipboard on a stopped computer answer 409 unavailable, and start_computer is what fixes that, while running needs the computer stopped first. A 409 with no reason is unclassified, and is treated as one that does not clear — a label that is taken, a computer at its public URL limit, the webhook cap, an SSH key already registered — unless its code is one the platform documents as passing (idempotency_in_progress, or WORKSPACE_MOVING while the move settles). The platform's own error messages come through unedited, because they are written to be acted on.

HTTP failures preserve their actual response status. An unsupported method on a known path is MethodNotAllowedError (405), with the received Allow value when available. A missing computer, snapshot, route or guest file remains NotFoundError (404); other guest failures keep their own status and message. Neither response causes an automatic retry or method switch.

isTransient(err) answers "is this worth sending again unchanged". A 503 is transient only for a GET or HEAD. Any change answered 503 may or may not have happened, because the platform answers a failure after the request was sent the same way. So, with one exception, isTransient is false for it whatever reason it carries, the tool's answer says to read the current state first, and error.method records the method. The exception is reason: "draining" at the top level of a 503, beside a flat error sentence and no record of a run (steps, usage, a cost or a thread): a call that starts an agent run, refused before anything started while the platform updates. Nothing ran and nothing was billed, so isTransient is true for it, and the same request can be sent again after error.retryAfterMs. The rule is read from the answer alone, not from the route: the platform sends draining only on the calls that start an agent run, and both isTransient and the tools' answers rely on that. That is a rule about the 503, not a word that clears: reasonKind returns undefined for draining, as for any word it does not classify, and a 409 carrying it is not transient. A reason this version does not know, such as a new word, is treated as no classification. reasonKind returns undefined for it, and the status decides — which, for a 409, is no: a 409 is transient only when its reason clears or its code is idempotency_in_progress or WORKSPACE_MOVING (with no reason saying otherwise). APIError.code carries the platform's code.

The secret store has typed calls on api.secrets: list, create, get, replace and delete. Each answer is decoded strictly to the documented fields, and none of them carries a value:

const { secrets } = await api.secrets.list();
const s = await api.secrets.create({ name: 'OPENAI_API_KEY', value: key });
await api.secrets.replace(s.id, { value: next, revisionId: s.revision_id });

Embedders can inspect optional diagnostics on every APIError:

import { Api, APIError, MethodNotAllowedError } from 'mandala-computer-mcp';

const api = new Api(process.env.MANDALA_API_KEY!);
try {
  await api.json('GET', 'account');
} catch (error) {
  if (error instanceof APIError) {
    console.error({ status: error.status, requestId: error.requestId,
      reason: error.reason, allow: error.allow,
      wwwAuthenticate: error.wwwAuthenticate });
    if (error instanceof MethodNotAllowedError) {
      // Inspect error.allow before correcting the request method.
    }
  }
}

requestId uses a nonblank X-Request-ID header first, then the top-level request_id body field. It is an opaque diagnostic, never an idempotency key. The raw body remains available on error.body, including any differing body ID and nested chat accounting. allow and wwwAuthenticate come only from received headers. HEAD failures can carry these fields with no body. Older servers, intermediaries and connection failures may supply none of them. Existing constructor arguments retain their meanings; an optional trailing APIErrorMetadata object adds these three fields, and method.

MCP error results include supplied code, reason, request_id, allow, www_authenticate and retry_after_ms as labelled JSON metadata. code is the platform's machine-readable code (LABEL_TAKEN, WORKSPACE_MOVING, …), the word to switch on rather than the sentence. Diagnostic strings are limited to 128, 128, 256, 512 and 512 characters respectively; an oversized field is omitted with a notice, so a shortened Allow is never presented as complete. Tool-specific warnings about partial work, retained publication, execution reads and explicit template continuation still apply. Serialized JSON object or array prefixes are not displayed as error prose. Valid scalar error messages retain their wording; embedders still have the original APIError.message and APIError.body for diagnostics. Native agent error frames retain their supplied numeric status even without a reason or request ID, independently of the successful HTTP stream carrying them.

For a 401, missing means a platform credential was not supplied; invalid means the supplied platform credential was not accepted; revoked means its authority no longer holds. Unknown reasons stay visible. An unclassified 401 alone does not identify whether the account key or model key was refused, including a nested chat failure. A 403 remains a permission or authority refusal. Inspect recorded work before another run; no key fallback, login or automatic replay is performed. Nested error reasons and in-band stream errors do not grant permission to replay a partly completed run.

For desktop events, use the exact returned events_url, including its desktop capability, in a WebSocket client. A REST Bearer key alone is not sufficient; the HTTP events response provides JSON guidance rather than another login flow.

Desktop links are credentials. get_desktop_url returns the watch-only URL by default — the platform drops input on that socket, so it is safe to hand to somebody. control: true returns the full-control one, which is root-equivalent on that machine. Neither appears in any other tool's output, deliberately: a tool result lands in a model's context and from there in whatever captured it. It is also why get_desktop_url carries no readOnlyHint even though its route neither writes nor spends: hosts treat that hint as licence to call without asking, so keeping it would let a model pass out control of a desktop with nobody prompted.

Templates and builds are the account's, and need an account-wide key. A key confined to a workspace is refused (403) by publish_template, retire_template, get_template on the account's own namespace, and every build tool — build_template, list_builds, get_build and watch_build. Such a key can still list_templates, read system templates and launch a computer from a published template by its ref. A build's spec.secrets resolve among the account-wide secrets, never a workspace's.

Retiring a template cannot be undone, and takes more than it looks. retire_template without a version retires every version of the name — that is what retiring a template means, and it is deliberately not get_template's "the newest". A retired ref is then refused for ever, identical bytes included, so the version you retire can never be published again. What it does not touch is any computer: a computer is built from the image the ref resolved to and holds no reference to the document, so anything already running, stopped or suspended keeps working. The tool says all of this in its own description, carries destructiveHint, and requires confirm: true — the same gate delete_computer, restore_snapshot and delete_snapshot take. It is strictly less recoverable than any of them: a deleted snapshot's name can be used again, a retired ref never can.

An empty version is refused here rather than sent. That spelling — which a model is more likely than a program to produce for an optional argument — read as "no version was named" on the platform and retired an entire template. The platform answers 400 for it now; this server will not send one at all.

A build is minutes, and watch_build is how you follow one. build_template returns immediately with a job; watching it streams the platform's own progress, emitting both a progress notification and a log line for each step, so a long build is visibly alive rather than indistinguishable from a hang.

One build runs per account at a time. While one is running, another build_template is a 429 naming it. Wait for it, or stop it with cancel_build: the answer still reads running until the build has ended, usually within seconds, so follow with get_build or watch_build. A 503 from build_template is an outcome nobody knows, and may have started a build that counts as running for up to an hour: call list_builds before building again. A 409 with reason unsupported about a secret is final until the secret is replaced.

Set resetTimeoutOnProgress if you intend to watch a real build. The MCP default request timeout is 60 seconds and only a progress notification can reset it — but the SDK resets it only for a caller that passed that option, so a client which merely accepts progress is still cancelled a minute into a fifteen-minute build. get_build is the answer for a client that cannot hold a request open: it reads once and returns.

The same applies to every tool here that waits. wait_for_computer, move_computer, create_snapshot and delete_snapshot all poll, and all report progress on every poll — a changed line at once, an unchanged one on a ten-second heartbeat, so the request stays open without flooding the client. A live capture took 107 seconds and was cancelled at 60 before this existed, which turned every carefully-worded answer about what had actually happened into a transport error. Each of them has a way out for a client that cannot opt in: wait: false on the two snapshot tools, list_moves after a move, a shorter timeout_s and a second call on the wait. A build that failed is a normal answer from watch_build, not an error — it names the step that stopped it, which is the thing to fix. An error event is the stream failing and says nothing about the build, and the tool says so rather than letting a model rewrite a document that is fine.

A completed template build can launch with create_computer when eligible capacity and its image are available. Publishing a template and completing its build are separate steps; publication alone does not guarantee launch capacity.

When the API supports image preparation continuation, a create_computer refusal with code template_image_preparing preserves template_transfer and preparation (including state and error) in the JSON appended to the tool's error text. retry_after_ms, when present, is the parsed Retry-After delay in milliseconds, also available to embedders as APIError.retryAfterMs. Both integer seconds and HTTP dates are accepted; missing or invalid delays are omitted. Delays are capped at 2,147,483,647 milliseconds to fit a timer.

For preparing, copying, or ready with a usable token and delay, wait for that delay, then repeat the original identical create arguments, including template, adding the token exactly as returned. The token must be a nonblank string, requires the original template, and cannot be combined with size. A failed preparation reports its error for inspection before deciding what to do next. Missing or unknown states and missing or invalid delays do not supply automatic retry advice. The server never replays a create automatically, and isTransient returns false for this refusal code because unchanged replay is not the continuation protocol.

The token selects the image build; it is not a create idempotency key. Stop after success. After a lost or ambiguous response, inspect list_computers before deciding what to do; never automatically replay the create.

Running it as a service

The same server speaks streamable HTTP, for clients that cannot spawn a subprocess — claude.ai, mobile, a shared team endpoint:

MANDALA_ALLOWED_HOSTS=mcp.example.com npx mandala-computer-mcp --http --port 3000
claude mcp add --transport http mandala https://mcp.example.com/mcp \
  --header "Authorization: Bearer com_…"

The MCP endpoint is /mcp; /healthz answers a JSON { ok, name, version } for whatever is checking that the process is up.

It holds no credential of its own. Each caller's key arrives as their own bearer token and is used only for their session; there is no store, and nothing outlives a session but a digest of the key — kept so that a later request can be shown to come from the same holder, which means a leaked session id on its own is not enough to drive somebody else's desktop. HTTP startup and requests never read the operator's credential store, MANDALA_API_KEY or MANDALA_PROFILE. --profile is local-only and ignored with --http.

That is also why anyone can run their own: point the same container at the same API and it works, with no secret to provision.

Bound to loopback — the default — it answers only to 127.0.0.1, localhost and [::1], so a page the user happens to be visiting cannot reach it by resolving its own name there. Served under a name, or bound to 0.0.0.0, that default cannot be guessed and MANDALA_ALLOWED_HOSTS is what turns the check back on.

Which matters most in the arrangement that looks like neither: bound to 127.0.0.1:3000 behind a proxy — nginx, Caddy, cloudflared, ngrok. The proxy forwards the original Host: mcp.example.com, the loopback default does not list it, and every request is refused with a 403. Set MANDALA_ALLOWED_HOSTS to the name it is served under. Startup says which list is in force, so a 403 on a deployment that worked before has a line above it naming the fix.

Hosted, with OAuth

The endpoint at https://app.mandala.computer/mcp is this server run with --http behind the platform's own proxy, with the platform as its OAuth 2.1 authorization server. Nobody pastes a key:

claude mcp add --transport http mandala https://app.mandala.computer/mcp

Two variables make an HTTP server behave that way, and without them nothing changes — self-hosters keep bringing API keys:

MANDALA_MCP_RESOURCE_METADATA_URL=https://app.mandala.computer/.well-known/oauth-protected-resource/mcp \
MANDALA_MCP_SERVICE_SECRET=… \
MANDALA_ALLOWED_HOSTS=app.mandala.computer \
  npx mandala-computer-mcp --http --host 127.0.0.1 --port 3000

In this mode X-Forwarded-For is believed from a loopback peer only, so the proxy in front must be on the same machine and must set it to the real client address.

  • Every /mcp request needs a bearer, initialize and tools/list included. One without is answered 401 with exactly WWW-Authenticate: Bearer resource_metadata="<that URL>", scope="mcp:tools", which is how a client finds where to authorize. /healthz stays open.

  • The bearer is passed through unchanged — an mcpat_… access token, or an API key, which the platform still accepts. The access token is good for this endpoint only. It is not an API key: sent to the API directly, the platform refuses it with 401 (reason: "invalid"). A person revokes it under Settings → Credentials → Connected apps.

  • A bearer is checked with the platform before it gets anything. An initialize makes no session until the platform accepts its token — a 2xx from GET whoami, which every valid credential gets, a suspended account's included — so invented tokens cannot fill the session pool. A 401 is the challenge above; any other answer is 503 and nothing is remembered. Refused initializes are budgeted per source address, 20 a minute. Past that, a token already accepted still passes and a new one is still checked, but only one every 5 s per address; the rest get 429 with Retry-After. The budget comes back when its minute is up. A POST carrying a request is checked again before it is dispatched, with an acceptance cached for 60 s under the token's digest, so an expired or revoked token is a clean 401 before any stream opens.

  • One bearer holds at most 16 sessions, and a suspended account one in all (below), so no single token can fill the pool. At that limit, an initialize closes the bearer's least recently used idle session to make room, once its own session exists (a refused initialize closes nothing), and a client whose old session is gone initializes again; if none is idle, the answer is 429 with Retry-After. One race differs: if the idle session it planned to close is put to work before the new session is made, the new one is dropped instead and the initialize is answered 404 (Session not found, no Retry-After), which an SDK client reports as a failed connect. Other bearers' sessions are never touched, except a suspended account's (below). A 429 names what the bearer holds, so one still over its limit is told to wait for its busy sessions rather than to close one. runHttp takes the 16 as maxSessionsPerBearer, and the CLI reads it from MANDALA_MCP_MAX_SESSIONS_PER_TOKEN (a whole number from 1 to 256, the whole pool; anything else is refused at startup; a token is also held to its account's ceiling, below). A self-hosted --http server applies it too, but checks no bearer with the platform, so there any string is its own bucket: the per-bearer cap spreads one key's clients, and what bounds an untrusted caller is the process-wide cap (256), and the default loopback bind until you expose the port.

  • One account holds at most 64 sessions, a quarter of the pool, across all its tokens. Sessions are counted by the account id the platform's whoami names for each token, so an account with many keys or grants counts once; a token whose whoami names no account counts as an account of its own. Initializes in flight are counted too, so a burst across one account's keys cannot pass the ceiling together. At the ceiling, an initialize makes room by closing idle sessions of two kinds only: the account's sessions whose token the platform has already refused on a request made there, first, and then the requesting token's own least recently used, as at its own cap and even while it is under that cap. When that is not enough the answer is 429 with Retry-After, saying it is the account's limit and naming only that number. A live session of another token is never closed for the ceiling, nor any session of another account, and the race above applies here too (404). A refused session counts until it is closed, so revoking keys never lets an account past its ceiling; a session whose token was revoked but never sent a request again is not known to be refused, and counts until it idles out. So does the session a token leaves behind when the client refreshes it (see below): it is neither the new token's own nor refused, so an account that holds more than half its ceiling when its clients refresh can be answered 429 for up to the session idle timeout (30 minutes), longer than its Retry-After suggests, unless those clients close their old sessions. A revoked token's session idles out within about the acceptance window (60 s) plus that timeout even while its holder keeps sending notifications, holding the stream, or sending HEAD /mcp or a DELETE /mcp the server refuses: traffic that carries no request is never checked with the platform, so it keeps a session alive only while the token's acceptance is still cached. A full pool (256) is answered 503 with Retry-After, whoever holds it, and nothing is closed to make room in it. The last 64 of the 256 go only to accounts holding less than their share, where a share is the other 192 divided by the accounts holding sessions, the asking one included (initializes in flight count as held): an account at its share once only those 64 are free is answered 503 with Retry-After too, saying so, and nothing is closed for it. A lone account therefore stops at 192 even with its ceiling raised, and each newcomer still gets in. runHttp takes the ceiling as maxSessionsPerAccount, and the CLI reads it from MANDALA_MCP_MAX_SESSIONS_PER_ACCOUNT (a whole number from 1 to 256; anything else is refused at startup). A self-hosted server verifies no account, so there each token is an account of its own, held to the ceiling as well as to its own cap; to let one token hold more than 64 sessions, raise both.

  • One workspace holds at most 16 sessions, a quarter of its account's ceiling, across all its tokens. A workspace-scoped key is counted by the workspace the platform's whoami names for it as well as by its account; a key of the account as a whole (workspace: null) is held by no workspace limit. Workspace-scoped keys share their operator's account ceiling above the sub-ceiling: the operator's own sessions and all its end customers' together stay under 64, so a workspace with room is still answered the account's 429 when the account is full. The same workspace id under two accounts is two workspaces. Room is made, and in-flight initializes are counted, as for the account ceiling; past it the answer is 429 with Retry-After, saying it is the workspace's limit and naming only that number. runHttp takes it as maxSessionsPerWorkspace (default a quarter of the account ceiling, whatever that is set to; above it, it is the account ceiling), and the CLI reads it from MANDALA_MCP_MAX_SESSIONS_PER_WORKSPACE (a whole number from 1 to 256; anything else is refused at startup). Hosted only: a self-hosted server verifies no workspace.

  • A suspended account holds one session in all, across all its tokens (enough to ask whoami, the one call the platform still answers for it). Whether an account is suspended is the platform's latest answer about it from any of its tokens: each check is numbered as it starts, and a slower check that started earlier never overrides a newer one, in either direction. So a newer check that finds the account active lifts the hold at once for every token, and one that finds it suspended holds every token, including one whose own acceptance is still cached. Held, an initialize from any of the account's tokens (a refreshed token, say) closes the account's idle sessions to take the one slot: first those whose token the platform has refused, then the least recently used. A session serving a request is never closed; while the one the account holds is busy, an initialize is answered 429 with Retry-After, saying the account is suspended. An account suspended after it opened sessions keeps only one: its next initialize, or the next request, notification or event stream on any of its sessions, closes its other idle sessions, keeping the one being served, and a busy one goes at a later one of these once it is idle. Notifications and streams, which ask the platform nothing, do this only while their token's acceptance is cached (60 s). A self-hosted server asks the platform nothing, so nothing is suspended there.

  • A token the platform refuses during a call comes back as that same 401, not as a tool error, so the client refreshes or authorizes again — the answer is held until its first byte for this. The one case that cannot work: a token that dies mid-call AFTER the stream has committed (the SDK's 15 s keep-alive, a progress notification or a partial result). That call ends as a tool error, the session remembers the refusal, and the next request on that token gets the 401 without reaching the platform.

  • A refreshed token starts a new session. A session is bound to the digest of the bearer that opened it, and a different bearer on it is answered 404 Unknown session, the MCP spec's signal to initialize again. An access token says nothing this server can check about which grant it came from, so rebinding would let any valid credential that learned a session id take over its bound computer, buffered events and retained results. The old session is not closed by the refresh: it still counts against the token's account ceiling (above) until the client closes it with DELETE /mcp under the old token (only the token's digest is compared, so an expired one still works) or it idles out after 30 minutes. On a suspended account the new token's initialize closes it instead, while it is idle (above).

  • X-Mandala-MCP-Service carries MANDALA_MCP_SERVICE_SECRET on every platform request, only ever to MANDALA_BASE_URL, so a token cannot be replayed at the API directly by the app it was issued to. A client's own header of that name is never forwarded.

Configuration

Variable

Meaning

MANDALA_API_KEY

Optional local API key, taking precedence over saved credentials. Ignored by HTTP; each caller sends their own bearer token.

MANDALA_PROFILE

Local saved profile; --profile overrides it. Otherwise the file default is selected. Ignored by HTTP.

MANDALA_BASE_URL

With a saved profile, must match its stored base. Otherwise defaults to https://app.mandala.computer/api/v1.

MANDALA_COMPUTER_ID

Bind a computer at startup, so use_computer is not needed. stdio only — under --http it is ignored rather than bound into every caller's session, since it names a machine on the operator's account.

MANDALA_MODEL_KEY

An Anthropic or OpenAI key. Enables run_agent, start_agent_run and run_agent_chat when filters permit them, which runs the platform's own loop on that key. Without it, run_agent and start_agent_run run on the account's AI credits when they can pay. stdio only — under --http each caller sends their own as X-Model-Key, and this variable is ignored.

MANDALA_NO_LIFECYCLE

1, true, yes or on withholds create_computer, clone_computer, clone_snapshot, delete_computer and delete_snapshot — every tool that makes a computer or destroys one. 0, false, no, off or unset leaves them registered. Any other value is refused at startup rather than read as off: a typo here would otherwise leave those tools in place on a server whose operator believes they are gone. The --no-lifecycle flag reads the same vocabulary and refuses the same way, except that it has no spelling for unset: --no-lifecycle= is refused rather than ignored, so a launcher template whose variable did not expand stops instead of quietly leaving the tools registered.

PORT, HOST

For --http. Default 3000, 127.0.0.1.

MANDALA_READ_ONLY

Keep only tools annotated readOnlyHint: true; strict boolean parsing as described under Tool filters.

MANDALA_TAGS

Comma-separated lowercase tool tags; see Tool filters for the inventory and intersection rules.

MANDALA_ALLOWED_HOSTS, MANDALA_ALLOWED_ORIGINS

Comma-separated. Which Host and Origin values this server answers to. On a loopback bind the host list defaults to the address it was given, so DNS-rebinding protection is on without configuration; set this when serving under a name.

MANDALA_MCP_RESOURCE_METADATA_URL

--http only. The OAuth protected-resource metadata URL this server is published under. Set, it answers OAuth clients as described under Hosted, with OAuth; unset, callers bring an API key.

MANDALA_MCP_SERVICE_SECRET

--http only. Sent as X-Mandala-MCP-Service on every platform request, to MANDALA_BASE_URL only. Never logged.

MANDALA_MCP_MAX_SESSIONS_PER_TOKEN

--http only. How many live sessions one bearer token may hold. Default 16; a whole number from 1 to 256 (the server's whole session pool), and anything else is refused at startup. A suspended account is held to one session in all, across its tokens, whatever this says. A token is also held to its account's limit, below.

MANDALA_MCP_MAX_SESSIONS_PER_ACCOUNT

--http only. How many live sessions one account may hold across all its tokens. Default 64, a quarter of the pool; a whole number from 1 to 256, and anything else is refused at startup. Hosted (the metadata URL set), the account is the one the platform's whoami names for the token; self-hosted, or when whoami names none, each token is an account of its own. Past it an initialize is refused 429, after closing only the token's own idle sessions or the account's refused ones. A suspended account is held to one session whatever this says. Whatever this says, the last quarter of the pool goes only to accounts holding less than their share of it.

MANDALA_MCP_MAX_SESSIONS_PER_WORKSPACE

--http, hosted only. How many live sessions one workspace may hold across all its tokens. Default a quarter of the per-account limit (16 of 64); a whole number from 1 to 256, and anything else is refused at startup; above the per-account limit it is that limit. Counted by the workspace the platform's whoami names for a workspace-scoped token; such tokens also share their account's limit, above, with the account's own tokens and its other workspaces.

Every one of these but the model key, the two tool filters, the two hosted settings (MANDALA_MCP_RESOURCE_METADATA_URL and MANDALA_MCP_SERVICE_SECRET) and the three session limits has a flag as well, and a flag overrides the environment: --http, --port, --host, --base-url, --computer, --allowed-hosts, --allowed-origins, --no-lifecycle, local --profile, plus --help and --version. --key exists for a caller launching several servers under different keys, and warns when used, because an argument vector is readable by ps, lands in shell history and is recorded verbatim by any exec audit — none of which is true of MANDALA_API_KEY.

run_agent deserves a note. It hands a task to the platform's own agent loop, which drives the computer inside the platform and answers with a sentence. Worth it when a stretch of pixel work would otherwise cost the calling model a screenshot per step — ten clicks stop being ten images. It bills your selected provider key, and the platform never stores that key.

Both run_agent and run_agent_chat accept provider: "openai" to use gpt-6.1-sol by default, or infer OpenAI from a recognized GPT model name. Set MANDALA_MODEL_KEY (stdio) or X-Model-Key (HTTP) to the matching provider key. Custom model names require an explicit provider; omitting model and provider preserves the Anthropic default. OpenAI is BYOK only and stores Responses continuations at OpenAI; tasks, screenshots and tool results go to that provider. A native OpenAI action batch must fit the remaining step and API budget before it begins. Partial failures stop the run without replaying input.

Agents on AI credits

Without a model key, run_agent can run on the account's Mandala AI credits. The server reads GET /credits on the session's own API key and registers run_agent only when the account is not frozen and has at least $0.02 available, the least a run's first model call can reserve (it reserves $0.25, or all that is left when less). On stdio that read happens once, at startup. Over HTTP it happens per session, at initialize, with that caller's bearer token; a caller who sends X-Model-Key is not asked, and no operator key or setting is ever used. Any failure of the read — a refusal (a workspace-scoped key cannot read the account-wide ledger), an error, a timeout or a record that does not parse — leaves run_agent out. A session started unfunded does not gain the tool when credits arrive later; reconnect, or restart a stdio server.

On credits run_agent takes max_cost_usd (0.25 to 20; the platform defaults to 2), the most a run may start spending. The last model call can go past it, and a run that reaches it ends with stop: "max_cost". It does not take system or provider: a run on credits uses the platform's own prompt and Anthropic, with claude-sonnet-5-5 by default and claude-opus-5-5 on request. The result reports cost_usd, the run's charge so far, and credits_remaining_usd, the balance the last step reported. A run whose credits run out partway ends with stop: "credits_exhausted", and a run that cannot reserve its first call is refused 402 with a top_up_url; the tool reports that as the account's credits running out, with the billing page, rather than as a plan limit or the model provider's billing error. The platform reports its AI service failing a run on credits as Mandala AI is unavailable over the provider's status. On such a run that sentence, at any status, and any other 402, are worded as the service failing, not as the caller's credential, the computer, the request or a model key. run_agent_chat is never registered without a model key: the platform runs that route only on the caller's own key.

get_credits reads the ledger: available, balance, held, debt, whether the account is frozen, this period's plan grant, the unexpired lots and one page of the journal, newest first (before and limit page through it). Amounts are integer USD micros. It needs an account-wide key. It also says how the account pays for computers (billing_mode) and, on pay as you go, what they cost an hour now and how long the balance lasts at that rate.

Refusals about paying carry a code, shown with the answer. PLAN_REQUIRED is no plan, or a trial that has ended. TRIAL_LIMIT is something a trial does not include, and TRIAL_CREATES_USED a trial out of launches. TRIAL_CREATE_PENDING is the trial's computer still being made: wait for it rather than create again. TRIAL_FULL and TRIAL_UNAVAILABLE are 503s that used nothing up. On pay as you go, INSUFFICIENT_BALANCE is a balance too low to start something; the answer gives projected_micros, what counts toward the start, and required_micros, what it needs. A positive runway does not promise a start. STORAGE_OVER_PLAN (402) is an account that moved to a plan with less storage and still stores more than it includes once the notice period has ended: nothing is created, started or resumed until computers or snapshots are deleted or a larger plan chosen. MACOS_LICENCE_REQUIRED (403) is a macOS computer on an account that has not accepted Apple's licence; an owner accepts it on the Billing page. Neither clears by sending it again.

Passive directories, activity history and signals

list_directory takes an exact absolute guest path. Unicode, spaces and punctuation survive query encoding. It requires an already running computer, does not resume it or extend its idle timer, and still contacts the guest with ordinary rate/capacity admission. The result preserves path, entries with name, type and optional size_bytes, truncated and skipped. An unavailable entry has no inferred type or zero size. Symlinks are not followed, and a final symlink directory is refused. No file content is read. A partial listing is an unordered subset: at most 512 examined entries/128 KiB, with no continuation token. Narrow the path when names are omitted; do not automatically rescan.

list_activities returns one newest-first history page with a fixed watermark. Pass an opaque cursor for continuation, or changes:true with a cursor for late final updates to older rows. False/absent changes is omitted on the wire; there is no limit argument. Preserve next_cursor, changes_cursor, gap and health fields. A gap requires refreshing history. The tools keep no cursor cache and never drain pages automatically. get_activity takes an activity_id shaped as act_ plus 32 lowercase hex digits, a request identity rather than an idempotency key. Recorded state, scope, revision, timestamps, execution identity and status remain distinct: accepted background work is not finished execution, and a dispatched error may have had effects. History is selected, retained, best-effort metadata, not all guest work or an agent identity.

get_activity_results returns at most eight newest metadata links, preserving revision, availability, association, byte/truncation metadata and observations. more:true has no continuation cursor and does not mean all versions were returned. An unavailable item is not an empty available item. Caller-selected artifact association does not prove creation or command success. This tool never follows a link to content, files, captures, downloads or execution polling.

read_signals reads one passive daemon page, independently of the active event socket. Omit since or send an empty string for a head-only baseline with no replay. Optional limit is 1–100; omitting it uses the API default 50. Preserve the returned cursor even when events is empty: filtered-out rows may advance it. Retention is ephemeral; expired/restarted/migrated cursors can return an explicit reset gap. Baselines and gaps do not prove there was no earlier work or that a task succeeded. Unsupported (501) and unavailable (503) responses remain errors, never empty history or new checkpoints. There is no watcher, guest action, retry loop or automatic checkpoint cache in this tool.

Background runs and threads

run_agent holds one tool call open for the whole run, which is minutes. A client that cannot keep a call open that long, or has other work to do meanwhile, starts the same run with start_agent_run instead: it takes the same arguments as run_agent on the same payer (less store), answers as soon as the run holds the computer with a run_id, and the run goes on without the call. get_agent_run reads it back — its status, every step so far, its cost on AI credits and, once it has ended, its closing text — and is meant to be polled every few seconds; cancel_agent_run stops it where it is, and list_agent_runs pages through the account's runs newest first (computer_id, status, limit, before). One run drives a computer at a time: a start on a computer another run is driving is refused 409 with reason: "contention", and list_agent_runs with status: "running" finds the run to wait for or cancel. If a start's answer is lost, or it fails with a 5xx, list_agent_runs with computer_id and no status is the read to make before starting another: a short run may already have ended, and is then the newest on the list. The exception is a 503 with reason: "draining", below, which started nothing.

Only status: "completed" with stop: "end_turn" means the task was finished, and the tools say so in as many words. Any other stop on a completed run (max_steps, max_cost, rate_limited, …), failed, cancelled and interrupted are runs that did not finish, and the steps they took stand. interrupted is a run the platform was executing when it restarted, or whose ending was not recorded: it is not resumed, and it may have done more than it recorded, so look at the desktop before starting another.

Every run that acts on the desktop or finishes with an answer is kept in a thread, and its thread_id comes back — in the text and the JSON of run_agent and run_agent_chat (as agent.thread_id), on a failed run that was kept, and on a background run once it has one. Send it as thread_id with the next task, on the same computer, to continue the conversation: the model is given the thread's earlier turns, told they are done, and acts only on the new task. A thread of another computer, and a full one (100 turns), are refused 409. store: false on run_agent or run_agent_chat keeps nothing and cannot be combined with thread_id; a background run is always kept, since it is read back. list_agent_threads and get_agent_thread read the kept conversations; an assistant turn that ended running, aborted or interrupted may have done more than it reported. A thread holds up to 100 turns of up to 32,000 characters, so get_agent_thread answers with the newest turns that fit in about 48,000 characters, says which earlier turns it left out, and reads further back with before_turn. delete_agent_thread (with confirm: true) removes one for good: it stops no run and changes nothing on a desktop, and is meant for a thread the conversation made or the user named — every thread on the account is visible to the key. The native route's messages (a history the caller keeps itself) is not sent by these tools: a model's own context goes in the prompt, and a kept thread carries the runs' own turns.

JSON chat with your own model key

run_agent_chat drives the selected computer using the same BYOK Anthropic or OpenAI loop as run_agent. It accepts a nonempty array of textual OpenAI-shaped messages, including string content or arrays of {type:"text",text:"..."} parts. The last user message supplies the task; system messages supply standing instructions; the user and assistant messages before it are given to the model as the conversation so far, told they are done. With thread_id the thread's own turns are the conversation instead, and earlier messages are not read.

All agent runs have a fixed 60-minute wall-clock limit. Reaching it ends the run with stop: "time_limit", preserving the work already done. A background status of completed means the loop ended; only stop: "end_turn" means the task finished. Background runs accept 1–500 steps (default 20); foreground sync, streaming and chat runs accept 1–100 (default 20).

Optional model selects a computer-capable Anthropic or OpenAI model. max_steps is 1–100, default 20. This is computer control, not hosted general-purpose inference or a chat UI; it adds no key storage or model billing service.

This tool deliberately sends stream:false and uses the JSON response so the result preserves the underlying agent.stop, step count and token usage: the streamed form of this route carries no usage and no agent block. The price is time. On the hosted API a request that does not stream is cut at the edge after about 120 seconds (a bodiless 524), which stops the run where it was and loses its result, usage and steps; the default 20 steps can take longer than that. Use run_agent, which streams, for anything that may. The tool answers a 524 by saying so rather than as a generic gateway failure. Only explicit end_turn consistent with the completion's finish reason can report success. Limits, refusal, missing or conflicting terminal fields remain errors with valid partial results. Nested failures preserve the agent computer, recorded steps and native usage, including separate cache-read and cache-write token counts, alongside OpenAI-shaped aggregate usage. Malformed native detail is explicitly marked incomplete. A failed call may include completed, billed work: inspect it before deciding what remains, and do not automatically replay. Neither agent tool starts the computer or switches endpoints after a failure.

The caller supplies the model key through MANDALA_MODEL_KEY on stdio or their own X-Model-Key header on HTTP. The account Authorization remains separate; HTTP never falls back to the operator's model key. Waiting heartbeats count notifications, not completed actions. A progressToken plus resetTimeoutOnProgress keeps the MCP client waiting, but not the hosted edge above; max_steps is neither a time cap nor a spend cap.

On both agent tools a failure status is read for what it is on these routes rather than for what it means elsewhere. The platform's own re-check of the caller is a 401 or 403 carrying reason: "revoked", and only that gets account advice. A 402, 504 or 529 is the model provider's own status for the configured model key (its billing, timeout or overloaded error), so the advice is to check the model-provider account, not the Mandala plan; a 403 without revoked may be the provider's permission error for that key. The one 402 that is Mandala's own carries a top_up_url: a run on AI credits the account cannot cover, worded as such. The exception is a refusal run_agent_chat is given before any run started — a flat {error: string} body, from the role gate, a bad body, a suspension or the meter: nothing ran, and it keeps the usual role and plan advice every other tool gets.

While the platform updates, it stops starting agent runs for a few minutes. run_agent, start_agent_run and run_agent_chat are then refused with a 503 carrying reason: "draining" and a Retry-After. The refusal comes before anything starts, and runs already going are not affected. So these tools do not give the usual 5xx answer here (that the change may have happened, a run may have started, or work may already be billed). They say that nothing started and nothing was billed, and give the number of seconds to wait before sending the same call again. This server does not resend it itself: it retries no call that starts a run. Any other 5xx on these tools keeps the uncertain answer, and so does a draining body that also records work (steps, usage, a cost, a thread, or a run's own failure envelope): that answer shows the word but does not say nothing started, and the tool descriptions grant the resend only on that sentence.

Development

npm ci
npx vitest run    # deterministic offline tests, including the synthetic contract
npm test          # offline tests plus the separate private mirror check
npm run build
npm run lint

CI runs the offline suite on Node 20, 22, 24 and 26. A separate Node 22 published-openapi job runs on pull requests and main pushes:

npx vitest run --config vitest.openapi.config.ts

It anonymously fetches the fixed publication at https://app.mandala.computer/api/docs/openapi.json once, with a 20-second overall deadline and an 8 MiB body ceiling, then exercises the real MCP tools and requires request evidence for every published /api/v1 operation. Every exercise variant must succeed and dispatch a request, including later variants of a tool that already dispatched successfully. Non-v1 operations are explicitly excluded and reported. Protocol forms are reported but not required, since no tool sends them: OPTIONS (the CORS preflight) and a HEAD published beside a GET at the same URL (that GET without its body). A HEAD with no such GET is required like any other operation. The check uses OpenAPI server inheritance and literal-path precedence, not the local route allowlist. Each path is appended to its effective server base; repeated prefixes are not removed. Fully prefixed paths work with an absent or root server. It fails on a blocked fetch, redirect, invalid document or missing operation; there is no fixture fallback, credential requirement or skip branch.

The committed OpenAPI fixture is synthetic, assembled from the public MCP route inventory, and is never presented as a downloaded publication. Offline green proves deterministic implementation coverage only. Each published-openapi run logs the publication's digest and how many operations it matched with how many requests from how many tools; a result applies to that commit and that publication, and every head must pass the gate independently. Those counts are observations, never fixed thresholds or exemptions. A blocked or red public gate must not be merged. Parameters and response modes remain separate contracts, with documented parameter exceptions and JSON-only chat support.

Where the platform's rules live

This server gets no privileged access. Everything it does goes through the same curated /api/v1 surface the Python SDK uses, owner-scoped to the key's account and audited against it. Anything it needs that /api/v1 does not expose is a change to the platform's route table, not a wider pass-through here.

Maintainers: the surface check

The platform allowlists every route /api/v1 will answer and 404s the rest. test/allowlist.ts mirrors that table, and the tests assert two things: that every successful exercised call lands on an allowlisted route, and that no non-excluded mirrored operation remains unexercised. UNIMPLEMENTED in test/allowlist.ts documents the five intentional exclusions: API-key creation and deletion, and browser-connection creation, renewal and deletion. Tool names and exercise entries must match in both directions, and every tool must make an observed HTTP request during its callback. The independent public gate also detects a new published operation when the mirror has not yet been updated.

npm run check:surface goes further and diffs the mirror against the platform's published surface manifest — a file the platform generates from its own tables and commits like a lockfile — whenever the platform repository happens to be checked out next door, or wherever MANDALA_PLATFORM_REPO points. Without it the script says it is skipping and exits 0, which is what it does for anyone outside the platform team; a manifest it cannot read is a failure, never a comparison of nothing. The diff is enforced from the platform's own CI, which checks this repository out beside itself and runs the same script.

check:surface — the mirror matches the platform (N routes, N parameters, from …).

See also

  • typescript-sdk — the TypeScript SDK and the mandala CLI, for writing code against the same API rather than driving it from a model.

  • python-sdk — the Python SDK and the mandala-py CLI, for the same thing from Python.

The same operation under each client's name

The clients follow their own language's naming, so one operation can go by several names. Where a client has no way to do it, the cell says so with —.

Operation

TypeScript SDK

Python SDK

MCP tool

mandala CLI

mandala-py CLI

A command in the background

execBackground(), then execPoll(pid) and execKill(pid)

start_exec(), then background_command(pid).poll() and .kill()

exec with background: true, then exec_poll and exec_kill

computers exec --background, then computers exec-poll and computers exec-kill

—

Delete a computer with its snapshots

delete({ deleteSnapshots: true, expect })

delete(delete_snapshots=True, expect=…); purge_snapshots is the deprecated name

delete_computer with delete_snapshots and expect

computers delete --delete-snapshots --expect

—

Snapshot holdings (count, bytes, fingerprint)

holdings(), or its alias snapshotHoldings()

snapshot_holdings()

snapshot_holdings

snapshots holdings

—

The usage window

usage.read({ from, to })

usage.read(since=…, until=…), or from_= and to=

get_usage with from and to

usage --from … --to …

—

Change a computer (PATCH)

update({ … })

rename(), resize(), set_idle_suspend(), set_browser_proxy(), set_egress_proxy()

update_computer

computers rename, resize, idle-suspend, browser-proxy set/clear, egress-proxy set/clear

browser-proxy set/clear, egress-proxy set/clear

Wait until the computer is ready

waitForGuest(), waitForDesktop()

wait_for_guest(), wait_for_desktop()

wait_for_computer with until: "guest", which on Linux also waits for the desktop session

computers wait --until guest or --until desktop

—

A screenshot, fresh or cached

screenshot(width, { fresh, capture }): cached unless fresh: true

screenshot(fresh=…, capture=…): cached unless fresh=True

screenshot: fresh by default unless capture is given; fresh: false for the cache

computers screenshot --fresh

—

The windows after an input action

{ context: true } on an input method, e.g. click(x, y, [], { context: true })

context=True on an input method, e.g. click(x, y, context=True)

context: true on an input tool

—

—

Security

Please report anything security-sensitive privately — see SECURITY.md rather than opening an issue.

Resumable file uploads

write_file_chunk, get_file_upload, and cancel_file_upload expose Linux resumable uploads up to 2 GiB. Each tool write carries at most 256 KiB of decoded base64 to bound model-context transfers; prefer the SDK or CLI for large local datasets. Retain a fresh random 32-character lowercase hexadecimal upload_id, destination path, total size, and unchanged source. Send chunks at the confirmed offset. After any error, read status before retrying. The final chunk publishes atomically; overwrite: false refuses an occupied destination.

Cancel removes only staging and the completion receipt, never the published destination. Staging consumes guest disk until cancelled and has no automatic expiry. These tools may resume a computer and consume running capacity unless no_wake is set; they are included in the files tool group and excluded from read-only mode. They require Linux with Python 3 and an updated host. Existing write_file behavior is unchanged.

Licence

MIT.

Available Tools

136 tools
add_ssh_keyAdd an SSH public keyAInspect

Register an OpenSSH public key to the person this API key belongs to. It is accepted only by computers with SSH on in the account this credential acts on, and is removed when the credential is revoked. Accepted: Ed25519, ECDSA (P-256, P-384, P-521), their security-key forms, and RSA of at least 3072 bits. Refused: DSA, shorter RSA, certificates, a line with SSH options in front of the key, and anything but one key on one line. A key can belong to one person only, and each person may hold eight. Never send a PRIVATE key. PROOF: without challenge and signature the key is UNPROVEN and connects to a computer named by its id only (a computer named by its name is refused). To make it proven, call ssh_key_challenge, have the person run its sign_command with their private key file, and send the challenge and the signature it prints here; a key already registered without proof, to anyone, is then replaced and registered to this person.

Inputs: public_key (required), name, replaces, challenge, +1 more.

build_templateCompile a template document into an imageAInspect

Compile a document that declares spec.build steps into a golden image. Returns IMMEDIATELY with a job — a build takes minutes, an agent image roughly fifteen — and watch_build is how you follow it. THE NAMESPACE AND THE FAMILY BOTH HAVE TO BE YOURS: spec.family is what the image is called on a hypervisor, in a directory shared with every computer on that machine, so a build may only write into golden-<your account id> or that and a - and a name of your choosing. A document with build steps must LAYER ONTO ONE OF OURS: spec.from has to name a system/... template (and spec.build or spec.env need a parent at all); anything else is a 400. spec.secrets names secrets by ID (csec-…) and the environment variable each appears as, never by value, and at most 32 of them — check_template does not check that cap. They resolve among the account-wide secrets. Its refusals: a 400 saying the document names a secret that does not exist is deliberately the same for a deleted secret, a missing one, a workspace's and another account's, and is not worth retrying, nor is a 400 for a malformed reference or more than 32; a 409 with reason unsupported (a secret's value cannot be read, is not text, or the secret was deleted or left scope) is final until the secret is replaced or the document names another. A 503 is an outcome nobody knows: the build may have started and counts as this account's running build for up to an hour, so call list_builds before building again, never resend blindly. ONE BUILD RUNS PER ACCOUNT AT A TIME: while one of this account's builds is running, another is a 429 that names it, with Retry-After; wait for it to finish (watch_build), or stop it with cancel_build, then build again. A 409 with reason contention is not a problem with your document — every host that can build is busy with another account's build (one build runs per hypervisor) or short of disk — and is worth retrying; a build can run for up to 45 minutes. After a successful build, pass the published ref to create_computer as template. create_computer may still return image preparation instructions or a capacity refusal; follow that result rather than assuming the successful build made every destination ready. ACCOUNT-WIDE KEYS ONLY: builds are the account's, so a key confined to a workspace is refused (403) here and by list_builds, get_build, watch_build and cancel_build; such a key launches a published template by its ref instead.

Inputs: document (required), no_reuse.

cancel_agent_runCancel a background agent runA
DestructiveIdempotent
Inspect

Stop a background agent run where it is: no further action is taken. A model call on your own key is abandoned; one on AI credits already in flight is left to finish and is charged, and nothing of its reply is acted on, so its cost can change after this answers: read it again with get_agent_run for the final cost. What it already did to the desktop stands, and so does what it cost: take a screenshot before deciding what is left. Cancelling a run that has already ended changes nothing and answers it as it is. A run this key cannot see is not found.

Inputs: run_id (required).

cancel_buildCancel a running buildA
DestructiveIdempotent
Inspect

Stop one of this account's builds that is still running, such as a wrong or runaway one holding the account's one build slot. The answer still reads running: the build is stopped on its hypervisor and its record says what became of it once it has ended, usually within seconds, so follow with get_build or watch_build. A cancelled build ends failed, its error says it was cancelled, and nothing is published. Until it has ended it still counts as the account's running build, so build_template is refused until then. It counts against the daily build allowance like any failed build, unless it was stopped before its hypervisor began copying its base image. A build that has already finished is a 409: there is nothing to stop, so read it with get_build. Needs an account-wide key: a key confined to a workspace is refused (403).

Inputs: build_id (required).

cancel_file_uploadRemove upload stagingA
DestructiveIdempotent
Inspect

Remove an interrupted upload or completed upload receipt. Never deletes the published destination. Idempotent if staging is absent. May resume the computer unless no_wake is set.

Inputs: path (required), upload_id (required), no_wake, computer_id.

check_templateCheck a template documentA
Read-only
Inspect

Check a document against the SCHEMA, without publishing it. Nothing is stored and no ref is claimed, so this is safe on a draft and safe to call repeatedly, and every problem comes back at once. Always check before publishing: a ref is immutable, so a document published with a mistake in it cannot be corrected under that version. WHAT IT CANNOT SEE: this reads the document alone and knows nothing about your account, so valid: true does not mean publish_template will succeed. Whether the namespace is yours, whether the family is yours, whether your plan may publish at all, and whether the ref is already taken or retired are all decided at publish time and can still refuse a document that checks out here — among them a spec.hardware.disk_gb below the disk floor of its family or parent template (400), and a document that declares a build into a family that is not your account's (403). It DOES report that spec.build and spec.env need a parent in spec.from, and that a document with build steps may only layer onto a system/... template (anything else is a 400). It does NOT check spec.secrets beyond its shape: the cap of 32 references, and whether each id is a secret in your scope, are decided when build_template is called.

Inputs: document (required).

clickClickAInspect

Click the mouse. Left button once by default. Take a screenshot afterwards to see what happened — the desktop does not report back on its own.

Inputs: x, y, count, button, +3 more.

clone_computerClone a computerAInspect

Copy a computer's current disk to a new computer — the fork half of snapshot-and-fork. The source is untouched and must be stopped or suspended: a running source is refused with 409. The answer arrives as soon as the copy exists, reading status "building" while its disk is copied — wait for that to finish before starting it. The copy keeps the source's size and resolution (its disk carries a desktop laid out at that size), lands stopped, and has no secrets bound.

Inputs: name, computer_id, idempotency_key.

clone_snapshotFork a snapshot into a new computerAInspect

Build a new computer from a snapshot, leaving the original untouched. This is the fork half of snapshot-and-fork, and the only thing that works on an orphaned snapshot. A MEMORY snapshot is resumed: the copy comes up running the captured session, and is given its own MAC, address, hostname, machine ID, SSH host keys and desktop password before its network comes up, so it runs beside its source; if that fails it is left stopped, and starting it cold-boots its disk. Pass memory: false to build it from the disk alone instead. A clone built from a DISK — a disk snapshot, memory: false, or a memory snapshot the platform did not resume — comes back building and ends its build STOPPED: start it with start_computer once the build finishes (wait_for_operation on its operation). A memory snapshot of a computer that held SECRETS is resumed only with inherit_secrets: true, and then the copy HOLDS THE SAME CREDENTIALS as the computer it came from; without it the clone is built from the disk and this tool says so.

Inputs: snapshot_id (required), name, memory, select, +2 more.

create_agent_scheduleSchedule background agent runsA
Destructive
Inspect

Run the same agent task on a computer on a timetable: at each time a cron expression names, a background agent run starts with this prompt. Every fire starts a background agent run, on the account's AI credits, and acts as the API key this server uses. A fire is skipped while the previous run is still going or the computer is not running (it does not start the computer); one the platform could not send within five minutes of its time is recorded as missed and never sent late; five failed fires in a row pause it. get_agent_schedule shows its latest fires and the run each started. Only make one the user asked for: it spends credits on every fire until it is paused or deleted.

Inputs: cron (required), prompt (required), name, model, +7 more.

create_computerCreate a computerAInspect

Build a new cloud desktop and select it for this session. Creating a computer consumes storage; running it consumes running capacity on this account. Continue an image preparation refusal only as its result instructs, retaining all original create arguments, including template, and adding the returned preparation token as an argument. This token is not a create idempotency key. Stop after success; never automatically replay after a lost or ambiguous response without the idempotency_key that response names — with it, the same call answers the first one's result instead of building a second computer.

Inputs: cpu, name, size, start, +12 more.

create_credential_gateway_bindingLet a computer use a secret through the credential gatewayAInspect

Let programs inside the computer call an HTTPS API with a secret from the account’s store (create_secret) WITHOUT the secret ever reaching the computer. The platform adds the secret as Authorization: Bearer <secret> (or, with auth_header x-api-key, as x-api-key: <secret>) to requests the computer sends to the answered base_url followed by the provider path, with the placeholder as the API key — Authorization: Bearer <placeholder> or x-api-key: <placeholder> (the placeholder is in the answer) — and only for the given exact https:// origin (port 443, no path), path prefix (matched at segment boundaries) and methods. For example, origin https://api.github.com, path_prefix /repos/acme/app and methods ["GET"] lets the computer GET <base_url>/repos/acme/app/issues. For an Anthropic key: origin https://api.anthropic.com, path_prefix /v1, methods ["POST"] and auth_header x-api-key; Claude Code inside the computer then runs with ANTHROPIC_BASE_URL=<base_url> and ANTHROPIC_API_KEY=mandala-placeholder. Answers stream (server-sent events work). The platform uses the secret’s latest value on every call. That value must be printable ASCII with no spaces or line breaks, and a trailing newline counts: any other value is refused when the binding is created, and one set later makes every call through it answer 503 until replace_secret fixes the value. Owners only; needs a paid or trial account with secrets enabled and a secret in the computer’s workspace or account. Up to 8 per computer (409 past that). A binding cannot be changed: delete it and create another. Clones do not inherit bindings; moving the computer to another workspace or owner removes them. Not idempotent: a retry after a lost answer makes a second binding — list_credential_gateway_bindings first. Use a narrowly scoped provider key: code inside the computer can make any request the binding allows.

Inputs: origin (required), methods (required), secret_id (required), path_prefix (required), +2 more.

create_public_urlServe a port on a public URLAInspect

Serve a port inside the computer at https://<label>.<base_domain> (e.g. https://brave-otter-3f2a.mandala.dev), on 443 with no port in the address. Omitted access defaults to public on paid plans and private on trials. Public URLs are open to anyone with the link; trials cannot request public access. Pass access: "private" to require an account API key (workspace-scoped keys must match the computer) or browser sign-in through the dashboard Open button. The app must listen on 0.0.0.0:, not 127.0.0.1. Without a label one is picked. A label is 3 to 40 letters, digits and hyphens, and the platform refuses names that read as its own or another company’s (www, login, brand names and their look-alikes) with a 400 that says why. Other refusals: 402 PLAN_REQUIRED when the plan includes no public URLs, or PUBLIC_ACCESS_REQUIRES_PLAN when a trial requests public access (use private access or choose a paid plan); 403 PUBLIC_URLS_BLOCKED when the platform has turned public URLs off for this computer or account (not a role, and not something to retry — tell the user); 404 PUBLIC_URLS_DISABLED when public URLs are not enabled here at all (not a missing computer); 409 LABEL_TAKEN when the label is taken — a label is never given to a second account, so one another account has ever held, or one the platform has blocked, reads as taken — and 409 PUBLIC_URL_LIMIT when the computer has as many as its plan allows (trial 1 private URL, Solo 2, Studio 5, Swarm 10); neither 409 clears by waiting. 429 after too many in a day, with Retry-After. Responses are marked noindex, cookies the app sets stay on its own host name, and a Mandala API key sent to a public URL never reaches the app. Not idempotent: a retry after a lost answer makes a second URL — list_public_urls first.

Inputs: port (required), label, access, computer_id.

create_secretStore a new secretAInspect

Store a value under a name on this account, encrypted, for binding to computers with set_computer_secrets (or the secrets field of a create). The value is sent once and NEVER shown again: this answer, every other tool and every route give back only the name, id and revision. Do not put the value anywhere else — not in a command line, a file or a message — when a binding can deliver it. Owners only. A name is unique within its scope (up to 60 characters, no control characters); a taken name is refused with 409. The account holds at most 100 secrets at once and may create at most 1000 over its lifetime — list_secrets reports both. Without workspace_id the secret is account-wide and any computer on the account may be bound to it. NOT safe to repeat blind: if the answer is lost, list_secrets before creating again, since the secret may exist.

Inputs: name (required), value (required), workspace_id.

create_snapshotSnapshot a computerAInspect

Capture a computer so it can be restored or forked later. A disk snapshot is the filesystem; a memory snapshot also saves the running session, so a fork of it comes up with the same processes and windows already open. Name it after the step it is about — that name is what picks it out of the list later. THE CAPTURE OUTLIVES THE REQUEST that starts it: the platform accepts it and copies the disk afterwards, which takes minutes and scales with how much has been written. This waits for the copy to land by default and answers with the finished snapshot; pass wait: false to get the id straight back and poll list_snapshots yourself. Everything that can refuse a capture — no such computer, one already running, a memory snapshot of a computer that is not running, an allowance that will not stretch — is refused by this call, so anything else is a capture that started. A wait reports progress while it runs, so a client that sends a progressToken and sets resetTimeoutOnProgress can hold the request open; a client that cannot should pass wait: false and poll list_snapshots, rather than watch its own default timeout cancel a call while the capture goes on running.

Inputs: name, wait, memory, timeout_s, +1 more.

create_webhookSubscribe an endpoint to this account’s eventsAInspect

Subscribe an HTTPS endpoint to this account’s events. THE ANSWER CARRIES THE SIGNING SECRET ONCE — it is not readable again, so store it or hand it over before doing anything else. Each event is POSTed as the same JSON object wait_for_event hands you, byte for byte, signed with Standard Webhooks v1 headers (webhook-id, webhook-timestamp, webhook-signature); the receiver should verify the raw body, acknowledge with a 2xx before doing the work, and refuse a timestamp more than 300 seconds off. A failing delivery gets eight attempts (seven retries) over about fourteen hours; an endpoint that keeps failing for a day is disabled. The url must be https, at most 2048 characters, must not carry a username or password, and must resolve to a public address — a private or loopback address is refused. Paid plans allow ten subscriptions; an account with no plan allows none. Two bodies are not events: a gap delivery, sent whatever events filters on, says events were lost and the receiver should reconcile with a listing, and a test delivery has type webhook.test. While the account is suspended nothing is queued or sent, and events in that time are skipped for good, with no gap standing in for them. When a plan without webhooks ends a subscription it still receives computer.stopped for 24 hours. Events with source: "guest" (such as window.*, clipboard.changed and file.changed) reach webhooks at a limited rate per computer, and one whose data is over 16 KiB of JSON is not sent at all; both still reach wait_for_event. Window titles arrive cut to 1 KiB and window classes to 256 bytes, and a window.focused for the window that already has focus is not sent.

Inputs: url (required), events, enabled, computers, +1 more.

create_workspaceCreate a workspaceAInspect

Make a workspace on this account: a partition of its computers, which API keys can be confined to. Answers its id, name and created_at. A name the account already uses, a blank or over-long one, or an account already holding 500 workspaces is refused with 400. Needs an owner's key that is not confined to a workspace: a member, a viewer, or any key confined to a workspace is refused with 403 — relay that rather than retrying. NOT safe to repeat blind: if the answer is lost, list_workspaces before creating again, since it may exist.

Inputs: name (required).

cursor_positionWhere is the pointerA
Idempotent
Inspect

Where the pointer was last put. known is false on a computer nothing has moved it on yet — the guest cannot be asked, so there is no coordinate to report and a confident 0,0 would be a wrong answer dressed as a right one. This reads a coordinate but reaches the computer to do it: a suspended one is resumed to answer, and that resume consumes running capacity. read_clipboard, by contrast, refuses a suspended computer rather than starting it.

Inputs: computer_id.

delete_agent_scheduleDelete an agent scheduleA
DestructiveIdempotent
Inspect

Delete a schedule: it starts no more runs. Runs it already started are untouched (cancel_agent_run stops one). Delete only a schedule this conversation made or one the user asked to remove. Needs confirm: true.

Inputs: confirm (required), schedule_id (required).

delete_agent_threadDelete a kept agent conversationA
DestructiveIdempotent
Inspect

Permanently delete a kept conversation: its turns are gone and its id can no longer be continued. Nothing else changes — no run is stopped (cancel_agent_run stops a background run), and what its runs did to the desktop stands. Delete only a thread this conversation started or one the user asked to remove: every thread on the account is visible to this key, including other people's. It is for removing a prompt that held private text, or making room: the account keeps 1000 threads, replacing the least recently used, and a key that can delete none of them gets runs that are not kept. Needs confirm: true.

Inputs: confirm (required), thread_id (required).

delete_artifactDelete an immutable artifact versionB
DestructiveIdempotent
Inspect

Delete exactly this retained artifact, without metadata preflight or guest file deletion. Same deletion effect on repeat; repeated 404 remains unavailable. No retry.

Inputs: artifact_id (required), computer_id.

delete_computerDelete a computerA
DestructiveIdempotent
Inspect

Destroy a computer and its disk. Irreversible. Its snapshots are kept by default and become orphans, which can still be cloned but not restored. To destroy those too, read snapshot_holdings first and pass its fingerprint as expect.

Inputs: confirm (required), computer_id (required), expect, idempotency_key, +1 more.

delete_credential_gateway_bindingRevoke a credential gateway bindingA
DestructiveIdempotent
Inspect

Revoke one of a computer’s credential gateway bindings. Requests not yet sent to the provider can no longer use the secret; one already sent may finish. The secret itself stays in the account’s store. Owners only.

Inputs: confirm (required), binding_id (required), computer_id.

delete_public_urlRemove a public URLA
DestructiveIdempotent
Inspect

The URL stops answering at once. Its label stays with this account: no other account can ever take it, and this account may use it again (create_public_url with that label) unless the platform has blocked it. The app inside the computer keeps running. A URL made again is a new id.

Inputs: url_id (required), confirm (required), computer_id.

delete_resultDelete a retained output versionA
DestructiveIdempotent
Inspect

Delete exactly this immutable result version. No metadata preflight or guest mutation. Same deletion effect on repeat, but a repeated 404 remains unavailable; no automatic retry.

Inputs: result_id (required), computer_id.

delete_secretDelete a secretA
DestructiveIdempotent
Inspect

Permanently delete a stored secret. This cannot be undone, and it is NOT refused while computers are bound to it: such a computer keeps the value it already holds, but can never be given its secrets again — its next start is refused (409), a restart or a reboot inside it stops it, and a suspended one cannot resume. Remove the binding with set_computer_secrets first (or on the stopped computer afterwards) so it can start. SAVED MEMORY THAT HOLDS IT IS LOST, whatever the computer is bound to by then: a suspended computer's saved session and every memory snapshot keep the secrets bound when they were saved, and once any of those is deleted a resume or a memory restore is refused for good. Rebinding or unbinding first does not change that; such a suspended computer can only be stopped (discarding its saved session) and started fresh. To rotate without losing one, resume it before the delete, bind it to the new secret, then restart it. Deleting does not recall a value already delivered. Needs the current revision_id (a stale one is refused and nothing is deleted) and confirm: true. Owners only. Deleting frees a place under the account's limit on secrets held at once, but not under its lifetime limit on secrets created.

Inputs: confirm (required), secret_id (required), revision_id (required), workspace_id.

delete_snapshotDelete a snapshotA
DestructiveIdempotent
Inspect

Remove a snapshot permanently. Later snapshots in the same chain are unaffected. THE DELETION OUTLIVES THE REQUEST that starts it: the platform accepts it and then detaches the dependent snapshots and removes the stored objects, which takes time that scales with the chain and with how much is stored. This waits for it by default and reports what actually happened; pass wait: false to hand back as soon as it is accepted. A 409 saying the snapshot is ALREADY BEING DELETED is progress rather than a fault — the platform is doing what you asked, and the answer is to watch that one finish, never to go and delete something else. A wait reports progress while it runs, so a client that sends a progressToken and sets resetTimeoutOnProgress can hold the request open; a client that cannot should pass wait: false and poll list_snapshots.

Inputs: confirm (required), snapshot_id (required), wait, timeout_s.

delete_webhookDelete a webhook subscriptionA
DestructiveIdempotent
Inspect

Remove a subscription and every delivery record it holds, pending ones included. Nothing more is sent to the endpoint. Irreversible: a new subscription to the same url gets a new id and a new secret. To stop deliveries without losing the record, update_webhook with enabled: false instead.

Inputs: confirm (required), webhook_id (required).

delete_workspaceDelete a workspaceA
DestructiveIdempotent
Inspect

Permanently delete a workspace. It REVOKES every API key confined to it, whoever holds it, in the same step: anything using one of those keys — a person's CI, another agent — is refused from its next request, and this cannot be undone. The answer says how many were revoked. Webhook subscriptions confined to the workspace (those created with a key scoped to it) are deleted with it in the same step, with every delivery record they hold, pending ones included, as delete_webhook does; the answer does not count them, and account-wide subscriptions are not affected. Only an empty workspace can be deleted: one that still holds computers (counting one an unfinished workspace change is moving into it) or active secrets is refused with 409, saying how many, and nothing is deleted or revoked. To empty it, move its computers to another workspace with move_computer_to_workspace (or in the dashboard) or delete them, and delete its secrets with delete_secret, giving their workspace_id and current revision_id; then send this again. Say what is in it before moving or deleting anything to empty it. A 503 means the platform could not confirm it is empty: nothing was deleted, and it can be sent again shortly. Snapshots taken in it remain, and an account-wide key can still clone them. Needs confirm: true. Needs an owner's key that is not confined to a workspace: a member, a viewer, or any key confined to a workspace is refused with 403 — relay that rather than retrying.

Inputs: confirm (required), workspace_id (required).

dragDragAInspect

Press, move and release as one gesture — for selecting text, moving a file, or dragging a slider. Not the same as two clicks. modifiers holds keys down for the whole gesture, e.g. ["shift"] to extend a selection.

Inputs: to_x (required), to_y (required), from_x, from_y, +3 more.

execRun a command in the guestAInspect

Run a shell command inside the computer. Runs as root with no display by default — anything that opens a window needs desktop: true, anything slower than a few seconds needs background: true, and anything that needs an environment variable takes env rather than an assignment written into the command. Against the hosted platform, waiting here is capped at about two minutes by a proxy in front of it, not by timeout_s. One computer runs at most sixteen background commands at once: the seventeenth is refused rather than queued, and exec_kill on a pid you already hold is what makes room. What the command printed comes back as stdout and stderr when it is text, and as stdout_b64 and stderr_b64 — base64 of the exact bytes — when it is not, so a command that emits binary is never quietly turned into replacement characters.

Inputs: command (required), cwd, env, desktop, +4 more.

exec_killStop a background commandA
Destructive
Inspect

Kill a backgrounded command and everything it started. Answers with its final state, including whatever it printed that you had not read. Also how you make room when a computer is already running its maximum of sixteen background commands: the slot comes back with the command. A command that was already running when the service on the computer’s host restarted cannot be stopped here while it runs — that is refused, and sending it again does not help — so stop it from inside the computer with exec.

Inputs: pid (required), computer_id.

exec_pollRead a background commandAInspect

What a backgrounded command has printed since the last time you asked, and whether it has finished. A handle answers 404 from ten minutes after its command exits, or sooner once the computer holds more than 64 of them, the same 404 as a pid that never was. The output is a cursor, not a buffer: each poll gives you only the new bytes, so two readers on one pid split the output between them rather than each seeing all of it. Finishing is also what releases a computer's background slot, so this is how you tell which of your handles still hold one — the poll itself frees nothing. Output comes back as stdout and stderr when it is text and as stdout_b64 and stderr_b64 when it is not; a chunk cut through the middle of a character keeps both halves, with the text stopping at the last whole one and a note naming the bytes the next poll begins with. A command that was already running when the service on the computer's host restarted still answers whether it is running and its exit code, but never its output: both streams stay empty and output_unavailable says why. Its command is then the platform's kept copy, only the first 1 KiB at most, and command_truncated: true says it was cut. Shortly after such a restart a poll can be refused as worth sending again; a refusal that does not say so is not worth sending again at once: for such a command it means the guest agent has not confirmed its state for five minutes, and a later poll answers again once the agent does or the command exits.

Inputs: pid (required), computer_id.

get_accountRead current account quotaA
Read-onlyIdempotent
Inspect

Read account-wide plan ceilings, per-computer maxima, capabilities (capabilities.windows: this account may create Windows computers, granted per account by an administrator, and no plan includes it; capabilities.macos: this account may create macOS computers, available on request), current consumption and advisory remaining quota. Kept template builds share the disk pool: usage.kept_build_gb is their nominal GB, remaining.configured_disk_gb leaves them out, and the room a create or disk resize has is remaining.configured_disk_gb minus usage.kept_build_gb. A null kept_build_gb means build history is unread, so that room is unknown and a create or disk growth can be refused with 503 until it is read. Viewer or stronger; workspace-scoped keys receive aggregates without resource identities. No arguments, selected computer or model key. Incomplete computer/snapshot groups have null consumption and remaining values, meaning unknown. Snapshot headroom covers indexed stored bytes, excludes in-flight capture reservations and cannot promise that a capture will fit. This observation reserves nothing; later mutations still enforce quota.

Inputs: no named parameters.

get_activityRead one activity recordB
Read-onlyIdempotent
Inspect

Selected, retained, best-effort request history; not all guest work or an agent identity. Accepted background work is not completed execution; a dispatched error may have had effects. Activity IDs identify requests, never idempotency keys.

Inputs: activity_id (required), computer_id.

get_activity_resultsRead passive result links for an activityB
Read-onlyIdempotent
Inspect

Metadata only: at most eight newest links. more has no cursor and does not mean all versions were returned. No content reads, guest files, captures, execution polling or downloads. An unavailable link is not empty content. Caller-selected artifact association does not prove creation or command success.

Inputs: activity_id (required), computer_id.

get_agent_runRead a background agent runA
Read-onlyIdempotent
Inspect

A background agent run as it stands: its status, every step so far, its cost on AI credits, and once it has ended, how. Poll it every few seconds while its status is running; a step takes at least that long, so polling faster only spends rate budget. Only status completed with stop end_turn means the task was finished. completed with any other stop (time_limit, max_steps, max_cost, credits_exhausted, rate_limited, refusal, …) stopped without finishing; failed carries the error that ended it; cancelled was stopped by cancel_agent_run; interrupted means the platform restarted while it was going, or its ending was not recorded, and it was not resumed — it MAY HAVE DONE MORE THAN IT RECORDED. Whatever the ending, the steps a run took stand: take a screenshot before deciding what is left, and continue with its thread_id rather than running the whole task again. A run this key cannot see is not found.

Inputs: run_id (required).

get_agent_scheduleRead an agent scheduleA
Read-onlyIdempotent
Inspect

One agent schedule: its cron expression and time zone, prompt, whether it is paused and why, when it next fires, and its 20 latest fires with the run each started (get_agent_run reads a run). A schedule this key cannot see is not found.

Inputs: schedule_id (required).

get_agent_threadRead a kept agent conversationA
Read-onlyIdempotent
Inspect

One kept conversation, oldest turn first: each user turn is a prompt, and each assistant turn is how that run answered — its closing text, how it ended, its steps, and its cost on AI credits. Read it to see what earlier runs on a computer were asked and did before continuing it with thread_id. An answer holds the newest turns that fit in about 48,000 characters; when earlier turns did not fit it says so, and before_turn reads the ones before. Only an assistant turn that ended end_turn finished its task. One that is running (its run is still going), aborted (stopped part way) or interrupted (the platform restarted mid-run) MAY HAVE DONE MORE THAN IT REPORTED: look at the desktop before relying on it. A thread this key cannot see is not found.

Inputs: thread_id (required), before_turn.

get_artifactRead immutable artifact metadataC
Read-onlyIdempotent
Inspect

Passive finite metadata for one retained artifact. No guest file or execution lookup, resume, capture or fallback.

Inputs: artifact_id (required), computer_id.

get_buildGet a buildA
Read-only
Inspect

What became of one build, which template it was for, and which step it is on. Reads once and returns; watch_build is what follows a running one. It stays readable after the build has finished, so this is also how you find out which step failed on a build nobody was watching. Needs an account-wide key: a key confined to a workspace is refused (403).

Inputs: build_id (required).

get_computerGet a computerB
Read-only
Inspect

Everything the platform knows about one computer: status, size and its recorded screen resolution. Click coordinates are the capture size a screenshot returns, which can differ from the record's resolution.

Inputs: computer_id.

get_computer_secretsRead a computer's secret bindingsA
Read-only
Inspect

Which of the account's secrets a computer is bound to: for each, the secret id, the revision last delivered, and where the guest finds it — an environment variable name, or a file under /run/mandala-secrets/user/files. Values are NEVER shown — no value crosses this route. Also answers version, the number to send to set_computer_secrets so it changes only this list (0 for a computer never bound). Any role may read it. The list is what the computer receives at its next start or restart, which a running computer may not have yet. Every start and restart delivers each secret's latest value. Separately, when a secret's value is replaced on a running computer: a secret bound as a FILE has that file rewritten in place within seconds; one bound as an ENVIRONMENT VARIABLE, on an image that supports it, reaches new shells within seconds, and every exec — plain or with desktop: true — runs with the bound variables as they are at that moment, so the next exec sees the new value; programs already running — the desktop session among them — keep the value they started with until a restart (older images wait for the restart). A file newly bound or renamed waits for the restart either way.

Inputs: computer_id.

get_computer_sshRead whether SSH is on for a computerA
Read-only
Inspect

Whether SSH is switched on for a computer, whether that computer can run SSH at all (one made from an older template image cannot), how many keys can log in, whether its hypervisor has the current setting yet, and whether that hypervisor refused the setting (it is not sent again until a key or the setting changes). Any role may read it.

Inputs: computer_id.

get_creditsRead AI creditsA
Read-onlyIdempotent
Inspect

This account's Mandala credits, which pay for run_agent when no model key is configured and, on pay as you go, for its computers: how the account is billed (subscription, trial, pay as you go or none), and on pay as you go what its computers cost an hour now and how long the balance lasts at that rate (zero once it has run out, when running computers are suspended and nothing new starts; a positive runway does not promise a start, which needs at least $0.25 and a quarter of an hour of what is started); available (balance minus debt, credits held for runs in progress and pay-as-you-go compute priced but not yet charged; can be negative, and zero while frozen), balance, held, debt, frozen (no plan or a suspended account: credits are kept and still expire, but cannot be spent), this billing period's plan grant, the unexpired lots, and the journal, newest first. Amounts are integer USD micros (1,000,000 = $1). A key confined to a workspace is refused (403): the ledger is the whole account's.

Inputs: limit, before.

get_desktop_urlGet a link to watch the desktopA
Idempotent
Inspect

A URL that opens this computer's live desktop in a browser. Watch-only by default. These are credentials in a link: anyone holding one has that desktop until the computer restarts or is moved to another workspace, either of which issues new desktop credentials.

Inputs: control, computer_id.

get_executionRead a stable execution observationA
Read-onlyIdempotent
Inspect

Read one background execution by stable execution_id. Last-observed running, exited or lost; running is not proof the computer is awake, and lost establishes no success or failure. Metadata only: no guest I/O, activity refresh, resume, polling loop, PID fallback or command replay. Handles are volatile and can become unavailable after restart, replacement, expiry or cleanup. A command that was already running when the service on the computer’s host restarted keeps its execution_id and answers with output_unavailable (today "daemon_restarted"): its status and exit code are still reported, but its output cannot be read. For a few seconds after such a restart this read is refused with a 409 whose reason is contention, which is worth sending again; a 409 with no reason means the guest agent has not confirmed the command’s state for five minutes, which an immediate retry will not clear: check that the computer is healthy, and a later read answers again once the agent does or the command exits.

Inputs: execution_id (required), computer_id.

get_file_uploadRead resumable upload statusA
Idempotent
Inspect

Read the confirmed offset and completion receipt before retrying an interrupted chunk. Missing uploads return 404. May resume the computer unless no_wake is set.

Inputs: path (required), upload_id (required), no_wake, computer_id.

get_operationRead a lifecycle operationA
Read-onlyIdempotent
Inspect

One lifecycle operation: what an accepted create, clone, start, stop, suspend, restart, snapshot restore, resize, move or delete started, and where it got to. A call made with an idempotency_key is recorded pending before it is carried out, so it can be found even when its answer was lost; one the platform never heard end is failed with error.code lost. state is pending or running while live, and succeeded or failed once final; a failed one carries error.code (start_failed, build_failed, computer_gone, move_failed, resize_not_applied, lost, and more may be added) and a sentence. Most are already succeeded when the call that started them answered; a clone is running until its disk is copied, and a move until it lands. succeeded means the platform finished its step, not that the desktop has booted: wait_for_computer is still the wait for a desktop that answers. An id this key cannot see — another account's, or for a key confined to a workspace, one about a computer outside it — or one that has expired, is not found.

Inputs: operation_id (required).

get_resultRead retained result metadataA
Read-onlyIdempotent
Inspect

Read one immutable result manifest without guest output/files, resume, capture or command replay. Expiry, current scope or storage availability can make a version unavailable.

Inputs: result_id (required), computer_id.

get_retentionRead how long automatic snapshots are keptA
Read-only
Inspect

The plan's retention window — the other half of snapshot_schedule, which says when snapshots are taken and deliberately has no field for how long they survive. Read it before promising anyone that a backup will still be there, and before taking a snapshot you mean to keep. Takes no arguments: the window belongs to the ACCOUNT, not to a computer, though each computer keeps its own set under it. ONLY AUTOMATIC SNAPSHOTS ARE AGED OUT — one you took yourself with create_snapshot is never removed automatically, which is how you keep something past the window.

Inputs: no named parameters.

get_secretRead one secretA
Read-only
Inspect

One secret's name, scope, current revision_id and when it was last delivered — never its value. Read it for the current revision_id after replace_secret or delete_secret is refused because the revision moved. A secret in a workspace is found only with its workspace_id; otherwise it is not found.

Inputs: secret_id (required), workspace_id.

get_templateRead a template documentA
Read-only
Inspect

One template as the document it was written as — the lineage, the build steps and the digest, which list_templates drops. Works for your own namespace and for system, so you can read what you are layering onto before writing a document of your own. Without version this is the newest, which is also what a create naming the unpinned namespace/name resolves to. Your account's own namespace needs an account-wide key: a key confined to a workspace is refused (403) there, because the document is the account's and may carry its build steps and scripts; it can still read system templates.

Inputs: name (required), namespace (required), version.

get_template_schemaGet the template document schemaA
Read-only
Inspect

The JSON Schema for a mandala/v1 template document — the declarative form a template is written in. Read this before writing one: it describes the ref, the image family, what the template is layered onto, and the shape a computer gets when a create names no numbers.

Inputs: no named parameters.

get_usageRead what this account has usedA
Read-only
Inspect

What this account has used: running hours weighted by cores and memory, the storage it holds, and the per-computer breakdown behind the totals. Read it before and after a batch to monitor resource use. These measurements do not add a runtime charge to a monthly subscription, and AI-credit usage is separate; on pay as you go compute and disk are priced from them, get_credits is the record of what was charged, and the two need not match. Defaults to the current billing period (on pay as you go, the calendar month). READ THE FIRST LINE OF THE ANSWER: a hypervisor that could not be reached makes every total too LOW rather than absent, and that line is the only thing that says so.

Inputs: to, from.

get_webhookRead a webhook subscriptionA
Read-only
Inspect

One subscription with its health: whether it is enabled and why not if not, when the endpoint last accepted a delivery, when one last failed, and the status of the newest attempt. Never the secret. For the individual deliveries and what became of each, list_webhook_deliveries.

Inputs: webhook_id (required).

get_workspaceRead a workspaceA
Read-onlyIdempotent
Inspect

One workspace: id, name and created_at. An id this key cannot see is not found, the same as one that does not exist — another account's, any workspace but its own for a key confined to one, and a deleted workspace a computer's workspace_id can still name.

Inputs: workspace_id (required).

list_activitiesRead one activity history pageB
Read-onlyIdempotent
Inspect

Selected, retained, best-effort request history; not all guest work or an agent identity. Accepted background work is not completed execution; a dispatched error may have had effects. Activity IDs identify requests, never idempotency keys. History is newest first with a fixed watermark. Changes include late final updates to older rows. No automatic paging. A gap requires refreshing history.

Inputs: cursor, changes, computer_id.

list_agent_runsList background agent runsA
Read-onlyIdempotent
Inspect

Background agent runs on this account, newest first, a page at a time: each run's id, computer, status (running, completed, failed, cancelled or interrupted), how it stopped, its steps and cost. Only completed with stop end_turn is finished. computer_id keeps one computer's runs — it is not defaulted to the selected computer — and status keeps one status: status running finds a run still going, which is the one to wait for or cancel before starting another on that computer. Steps and closing text are not listed, and long prompts are shortened; get_agent_run reads one whole. Pass before with the last run's id for the next page. A key confined to a workspace sees that workspace's runs. The account keeps its 1000 newest ended runs and every run still going.

Inputs: limit, before, status, computer_id.

list_agent_schedulesList agent schedulesA
Read-onlyIdempotent
Inspect

Agent schedules on this account, newest first, a page at a time: each one's id, computer, cron expression and time zone, whether it is paused and why, and when it next fires. computer_id keeps one computer's. Pass before with the last schedule's id for the next page. get_agent_schedule reads one with its latest fires.

Inputs: limit, before, computer_id.

list_agent_threadsList kept agent conversationsA
Read-onlyIdempotent
Inspect

The conversations agent runs have kept on this account, most recently used first: each thread's id, the computer it belongs to, a title (the first line of its first prompt) and how many turns it holds. Runs from run_agent, run_agent_chat and start_agent_run are kept unless they sent store: false. To continue one, send its id as thread_id on the next run, on the same computer. computer_id keeps one computer's threads — it is not defaulted to the selected computer. Pass before with the last thread's id for the next page. A key confined to a workspace sees that workspace's threads; viewers are refused, since a prompt is where private text ends up.

Inputs: limit, before, computer_id.

list_api_keysList your API keysA
Read-onlyIdempotent
Inspect

The API keys of the person this server's key belongs to, on the account it acts on, newest first: id, name, prefix (display only), scope, when last used, manage_keys, expires_at (null for never), computer_ids (null for every computer its scope reaches), and minted_by_key_id: the key that minted this one (null for a key minted from the dashboard); revoking a key does not revoke the keys it minted. Never a raw key. Needs this server's key to be allowed to manage keys, which only a person can turn on in the dashboard (Settings → Credentials → API keys → the key's menu → Allow managing keys); without it the answer is a 403 that says so — relay it rather than retrying. A key confined to a workspace sees only keys confined to that workspace. Minting and revoking keys are deliberately not tools here, so a raw key never lands in this transcript and a model never revokes one on its own reading of this list: a person does both in the dashboard or with the mandala CLI (mandala api-keys create / revoke).

Inputs: no named parameters.

list_artifactsList retained artifacts and quota usageA
Read-onlyIdempotent
Inspect

The computer's published, unexpired artifacts, newest first, each with its artifact_id, size, workspace_id, execution_id, start and expiry, and how full the computer's and the account's retained quotas are (shared with retained output). How to find an artifact whose publication answer was lost, and what to delete when a publication is refused with result_quota_exhausted. No guest call, wake or capture. A workspace-scoped key sees only artifacts recorded in its workspace. At most 300 rows per call: offset skips that many of the newest, and a non-zero offset at or past the end is refused rather than answered as an empty listing.

Inputs: offset, computer_id.

list_buildsList buildsA
Read-only
Inspect

Every build this account has started that the fleet still holds a record of, newest first. A build lives on the hypervisor that ran it, so this asks all of them — and WITHOUT allow_partial, one that cannot be reached makes the platform refuse rather than answer short, so an empty or small list is the truth rather than an outage. Pass allow_partial and that stops being so: you get the short answer, opening with an INCOMPLETE line, and nothing else in the result says how much is missing. Needs an account-wide key: a key confined to a workspace is refused (403).

Inputs: allow_partial.

list_computersList computersA
Read-only
Inspect

Every computer on this account that exists or may exist. Desktop credentials are deliberately not included — use get_desktop_url for those. Read state before acting on a row: it is the platform's record of whether the machine exists, which is a different question from status, what its host says the guest is doing. A row reading deleting is on its way out and is not one to bind, start or wait for, and one reading unreachable is a row served from the record because the host did not answer — the computer is most likely fine, but nothing only its host knows is on it, status included. The two terminal states are not here at all: deleted and lost come back only when asked for with state.

Inputs: state, workspace_id, allow_partial.

list_credential_gateway_bindingsList a computer’s credential gateway bindingsA
Read-only
Inspect

The credential gateway bindings of one computer: for each, the secret it uses (its id, never its value), the HTTPS origin, path prefix and methods it allows, and the base_url and placeholder the computer calls it with. Owners and members may read them. A computer may have up to 8.

Inputs: computer_id.

list_directoryList a guest directory without waking itA
Read-onlyIdempotent
Inspect

Read one passive, unordered directory listing from an already running computer. No resume or idle extension; ordinary API rate/capacity admission still applies. At most 512 examined entries/128 KiB, with no continuation token. Narrow the path when partial. Symlinks are not followed; a final symlink directory is refused. No file content is read.

Inputs: path (required), computer_id.

list_movesList moves in progress and their outcomesA
Read-only
Inspect

Every move on this account that this key can see — a key confined to a workspace sees only the moves of computers in that workspace: the ones running and the ones that finished in the last day. Read this after move_computer if the wait ran out, and read it when a move is refused because another computer on the account is already being moved — only one runs at a time, and this says which one and how far along. live is the flag to poll on.

Inputs: no named parameters.

list_operationsList lifecycle operationsA
Read-onlyIdempotent
Inspect

The lifecycle operations started on this account, from the API or the dashboard, newest first, a page at a time: kind, computer_id, state, error and timestamps. A key confined to a workspace sees only the operations of computers in that workspace. computer_id keeps one computer's (for a clone, the new computer's) — omitted, it is every one this key can see, not the selected computer's. Pass next_cursor back as cursor for the next page; it is null on the last. Calls made from the dashboard are listed too, except a move.

Inputs: limit, cursor, computer_id, idempotency_key.

list_public_urlsList a computer’s public URLsA
Read-only
Inspect

The public URLs of one computer, oldest first: each is https://<label>.<base_domain> serving a port inside the computer, public (anyone with the link) or private (an account API key (workspace-scoped keys must match the computer), or dashboard browser sign-in). Also says whether they can answer here at all — enabled is false, with a reason, where public URLs are off or the account’s plan includes none, and the URLs are listed either way so you can delete them — and how many this computer may have. If the plan drops below the number a computer has, the oldest within the limit keep answering and the rest answer 404.

Inputs: computer_id.

list_resultsList retained output versions and quota usageA
Read-onlyIdempotent
Inspect

The computer's published, unexpired retained results, newest first, each with its result_id, kind, bytes charged, workspace_id, execution_id, start and expiry, and how full the computer's and the account's retained quotas are (shared with artifacts). How to find a result whose id was lost, and what to delete when a capture is refused with result_quota_exhausted. No guest call, wake or capture. A workspace-scoped key sees only results recorded in its workspace. At most 300 rows per call: offset skips that many of the newest, and a non-zero offset at or past the end is refused rather than answered as an empty listing.

Inputs: offset, computer_id.

list_secretsList the account's secretsA
Read-only
Inspect

The secrets stored on this account, in one scope: the account-wide ones by default, or one workspace's with workspace_id. For each: its name, its id (what set_computer_secrets binds), its current revision_id (what replace_secret and delete_secret need), its scope and when it was last delivered to a computer. Values are NEVER shown — no route returns one. Also says whether binding secrets to computers is switched on here, and the store's limits. Owners and members may read; a viewer is refused. An API key confined to a workspace lists that workspace's secrets, and naming another scope is refused.

Inputs: workspace_id.

list_sizesList sizesA
Read-only
Inspect

The named sizes a computer can be launched at — each a template plus a CPU/RAM/disk shape. These are the shapes the platform keeps pre-booted, so create_computer with a size is typically answered in about a second where a custom shape boots cold. allowed says whether this account’s plan admits a row; when false, cheapest_plan names the plan that would.

Inputs: no named parameters.

list_snapshotsList snapshotsA
Read-only
Inspect

Every snapshot on this account. orphaned means its computer is gone: such a snapshot can still be cloned into a new computer, but cannot be restored, because a restore puts the disk back on a source that no longer exists. restore_available: false means the only usable copy is on a host its computer has since left: restore_snapshot will not work on it, though it can still be cloned. Read state ON EVERY ROW before acting, rather than on the newest one — this is one answer per hypervisor concatenated in a fixed host order that has nothing to do with time, so a capture running on one host routinely appears after finished snapshots from another. A row reading capturing is not a snapshot yet: the copy is still being taken and restore, clone and delete all fail on it. It carries the id the finished snapshot will keep, so this is also the route to poll after create_snapshot: the row stops reading capturing in place rather than being replaced under another id, and a row that vanishes without ever leaving capturing is a capture that failed. pending is the point at which it can be acted on, and durable means it has reached backup storage as well.

Inputs: computer_id, allow_partial, include_unfinished.

list_ssh_keysList your SSH keysA
Read-only
Inspect

The SSH public keys registered to the person this API key belongs to — the same list whichever account the key acts on. A key added from the dashboard is accepted by every computer with SSH on, on every account where that person is an owner or member; one added through an API key or connected app (add_ssh_key) only on the account that credential acts on, until the credential is revoked. Shows id, type, SHA256 fingerprint, name, reach (every account, this account only, or another account only: refused on this account's computers; which account is not said) and possession: proven or legacy keys connect to a computer by id or by name, an unproven key (added without a signature) by computer id only.

Inputs: no named parameters.

list_templatesList templatesA
Read-only
Inspect

The base images a computer can be created from — name, OS, the default CPU and RAM each one implies, and its minimum disk (a smaller disk_gb is raised to it and counted against storage limits). For the templates the platform publishes, name is what a create takes as template; for one you published yourself, pass its ref (namespace/name@version) — a short name is not resolved to your own templates. A short name that is none of the published templates falls back to base, except while this list is INCOMPLETE (a host did not answer): then the create is refused with a retryable 503 that changed nothing, so send it again shortly with the same idempotency_key, or pass a ref to avoid the guess.

Inputs: no named parameters.

list_webhook_deliveriesList a webhook’s deliveriesA
Read-only
Inspect

Deliveries to one subscription, newest first by when they were queued — the newest hundred unless limit says fewer — each with its state (pending, in_flight, delivered, exhausted or dropped), its attempt count, and the HTTP status or one-line error of its newest attempt. This is where a delivery that ran out of attempts, or was dropped because the queue was full, shows up — nothing is dropped without a record. A delivery exhausts about fourteen hours after it was queued, so on a busy subscription it is far from the newest: pass state: "exhausted" (or "dropped"), or page back with before. A page with as many rows as limit may have older ones behind it; a shorter page is the last. Finished deliveries are kept until seven days after they were queued; pending ones until they finish. The one-line error is an open set — timeout, dns, refused, reset, unreachable, tls, redirect, address refused, status NNN and others — and a dropped delivery says why it was dropped. Each carries the event’s cursor, which is what to pass as since to the socket to read on from that point.

Inputs: webhook_id (required), limit, state, before.

list_webhooksList webhook subscriptionsA
Read-only
Inspect

Every webhook subscription on the account, with its health: whether it is enabled, when its endpoint last accepted a delivery and when one last failed. A webhook is an HTTPS endpoint the platform POSTs events to — the other transport for the same events wait_for_event reads, for a CI job or a queue worker that wants to be woken rather than to wait. Never carries a secret: that is shown once, by create_webhook or rotate_webhook_secret. A workspace-scoped key sees only the subscriptions confined to that workspace.

Inputs: no named parameters.

list_windowsList what is on the desktopA
Read-only
Inspect

The windows the window manager knows about — id, title, class, geometry, focus. A screenshot says what the desktop looks like; this says what any of it is, which is how you tell a browser that failed to open from one that has not painted yet. Match on class, not title: the class is the application, the title is whatever page it is showing. Linux only.

Inputs: computer_id, include_all.

list_workspace_membersList a workspace's membersA
Read-onlyIdempotent
Inspect

The people who reach a workspace, oldest member first: user_id, email, name (null when unset), role, accepted_at, suspended (a sign-in suspension: they cannot sign in anywhere) and seat_suspended (true while they wait for a seat on this account and cannot act on it; it returns to false when their seat is restored). Either flag, or both, can be true. Workspaces do not divide people — everybody on the account reaches every workspace at their account role — so this is the account's accepted members; invitations not yet accepted are left out. A key confined to a workspace is refused with 403, because the list is the whole account's: relay that rather than retrying, and use an account-wide key.

Inputs: workspace_id (required).

list_workspacesList workspacesA
Read-onlyIdempotent
Inspect

The account's workspaces, oldest first: id, name and created_at. A workspace partitions the account's computers: a key confined to one reaches that workspace's computers only, and a computer's workspace_id names the one it is in. A key confined to a workspace lists only that one. create_workspace, rename_workspace and delete_workspace change them. No arguments.

Inputs: no named parameters.

mouse_buttonHold or release the mouse buttonBInspect

The two halves of a click, for gestures drag cannot express — a lasso across several stops, or a press held while the keyboard is used.

Inputs: state (required), x, y, context, +1 more.

move_computerMove a computer to a host that can run a bigger sizeAInspect

Grow a computer past what its current host can run, by moving it to another host in the same region first. Only call this after update_computer has refused a resize and said a move is possible: it is the second half of that refusal and nothing else. THIS MOVES THE MACHINE TO DIFFERENT HARDWARE and copies its disk to get there — say so before you call it. The computer must be STOPPED (suspended is not stopped here: a saved desktop only loads on the host that wrote it, so resume and stop it, or discard the session). One move runs per account at a time. Everything is decided again when this runs, so it can still refuse. Waits for the outcome and reports it, reporting progress while it waits so a client that sends a progressToken and sets resetTimeoutOnProgress can hold the request open; list_moves reads the outcome if the wait runs out, and is the answer for a client that cannot.

Inputs: ram_mb (required), cpu, disk_gb, timeout_s, +2 more.

move_computer_to_workspaceMove a computer to a workspaceA
DestructiveIdempotent
Inspect

Change which workspace a computer belongs to, within the same account. This changes who can access it. Requires an account-wide member or owner credential; workspace-scoped credentials are refused, even for a no-op. Supply computer_id explicitly and workspace_id as a wsp- ID, or null to make it unassigned. Neither the selected computer nor the default workspace is used. The computer must be stopped, with no saved session, snapshots or snapshot history copies, secret bindings, or proxy credentials. The platform checks these conditions; a fleet that cannot prove safety can refuse. Do not stop the computer, discard its session, delete snapshots, or remove bindings automatically to overcome a refusal. This changes workspace membership, not hardware or size. Once moved, keys confined to the old workspace lose it, its events and webhooks follow it, and its desktop and share credentials are replaced, so a get_desktop_url link from before stops working. If the outcome cannot be confirmed, read get_computer before deciding whether to retry; repeating the same call reconciles a change whose outcome was uncertain.

Inputs: computer_id (required), workspace_id (required).

move_mouseMove the pointerAInspect

Move the pointer without clicking — for hovering over a menu or a tooltip.

Inputs: x (required), y (required), context, computer_id.

open_urlOpen a URL on the desktopAInspect

Put a web page on the screen in the guest's browser: the first of firefox-esr, firefox or chromium the image has (the Debian desktops open firefox-esr, Omarchy opens chromium). An image with none of them is an error, not a silent success. The command returns before the window draws — on a cold browser that gap has been as long as ten seconds — so screenshot until the screen changes rather than concluding from one frame that nothing launched.

Inputs: url (required), computer_id.

paste_textPaste textAInspect

Put text on the desktop clipboard and press the paste shortcut, as one step: the fast way to insert up to 8192 bytes of UTF-8, including accents, CJK and emoji, into whatever has focus. A Linux image needs its desktop's clipboard tool (xclip on X11, wl-clipboard on Wayland), and one without it is refused. On a Windows computer the clipboard write runs in the signed-in desktop session, and a session too busy or too freshly signed in to run it in time answers a 409 that names no reason; that one may clear, so retry it a bounded number of times rather than looping. The paste REPLACES the clipboard and leaves the text there — after pasting a secret, clear it with write_clipboard and text "". A success means the clipboard write and the shortcut were delivered, not that the application inserted the text (a paste-disabled field ignores it): check with a screenshot. An interrupted call may already have pasted, so look before sending it again, and do not fall back to type_text without looking.

Inputs: text (required), context, shortcut, computer_id.

pause_agent_schedulePause an agent scheduleA
Idempotent
Inspect

Pause a schedule: it starts no more runs until resumed. A run it already started goes on; cancel_agent_run stops one.

Inputs: schedule_id (required).

poll_eventsRead what has happenedAInspect

Everything the computer has reported that you have not been handed yet, without waiting. This server holds the event stream open between your turns, so this drains what accumulated while you were doing something else — including while you were running other tools on the same machine. Use it after a long exec, or whenever you want to know what changed without spending a screenshot. Returns immediately, and an empty list genuinely means nothing has happened.

Inputs: limit, since, computer_id.

press_keyPress a key or a chordBInspect

Press named keys — "Return", "Tab", "Escape", "Page_Down", or a chord like ["ctrl","c"]. X keysym names, so "Return" rather than "Enter".

Inputs: keys (required), context, computer_id, hold_seconds.

publish_artifactPublish a nominated immutable file versionAInspect

Explicitly capture a caller-nominated absolute Linux, Windows drive or UNC file path with expected_size and lowercase expected_sha256 already supplied. One guest file read, no preflight stat/list/hash/exec. Optional execution_id is verified caller-selected association, not proof of authorship. Default 8 MiB/max 64 MiB capture cap; default 86400s/max 604800s retention. New version per call; a lost response leaves publication unconfirmed, and list_artifacts shows what the computer holds. A full computer or account retained quota (shared with retained output) is refused with 409 result_quota_exhausted and nothing published: it clears only as objects expire or are deleted, so call list_artifacts and list_results and delete what is no longer needed rather than retry.

Inputs: path (required), expected_size (required), expected_sha256 (required), max_bytes, +3 more.

publish_templatePublish a template documentAInspect

Store a document under a ref of your own, so create_computer can launch it by name. THE NAMESPACE IS YOUR ACCOUNT: metadata.namespace has to be your account id, and anything else is refused rather than rewritten — system included. A REF IS IMMUTABLE: publishing the identical document again succeeds and changes nothing, but publishing a DIFFERENT document under the same ref is refused, and the fix is to bump metadata.version. What counts as different is the digest, so a changed label is a change. Check the document first — a mistake published under a version can never be corrected under that version. NEEDS AN ACCOUNT-WIDE KEY: templates are the account's, so a key confined to a workspace is refused (403) whatever it sends; such a key can still list_templates and launch a template by its ref.

Inputs: document (required).

read_artifactRead a complete verified small artifactA
Read-onlyIdempotent
Inspect

Read metadata, then only if the complete artifact fits max_bytes (default 4096/max 16384), read the whole immutable object and verify size/SHA-256. Over cap returns metadata only, with zero content GETs. One 90s operation budget; no Range, prefix, assembly, file destination, guest fallback or image/HTML rendering. Lossless UTF-8/BOM or exact base64.

Inputs: artifact_id (required), max_bytes, computer_id.

read_clipboardRead the desktop's clipboardA
Read-only
Inspect

What is on the computer's desktop clipboard right now — the CLIPBOARD selection, which is what Ctrl-C writes and Ctrl-V pastes. Use this rather than running xclip through exec: exec runs a login shell, so anything the guest user's profile prints lands on the same output ahead of your command's, which corrupts a read you are trying to parse. This does not share that stream. It requires a Linux desktop image with its desktop's clipboard tool installed — xclip on X11, wl-clipboard (wl-paste/wl-copy) on Wayland images such as Omarchy. An image without that tool gets a 400 that names it and never clears; changing runtime state or retrying cannot fix that image dependency. On a Windows computer it needs no extra tool: the request runs in the signed-in desktop session, and a session too busy or too freshly signed in to run it in time answers a 409 that names no reason; that one may clear, so retry it a bounded number of times rather than looping. It is a READ, not a subscription: this call notices nothing on its own, and repeating it is how a copy inside the guest is discovered. What does notice is wait_for_event on clipboard.changed, which fires when the selection changes hands and says which selection it was — the text is deliberately not on that stream, so this is still the call that fetches it. It also does not wake a suspended computer, so a stopped or suspended one is refused rather than started; start_computer first if you need it, unless a start is already under way — wait_for_computer tells you which. The 409s are not alike either, and the answer says which KIND it is rather than leaving you to match on the sentence: a computer that is not running does not clear by waiting UNLESS a start has already been admitted for it, in which case wait_for_computer is the call and start_computer would only start it twice — while a guest agent that is busy or still inside its boot window is worth asking again in a moment. A desktop session or X server that is not answering carries no such word, deliberately, because the platform cannot tell a guest still coming up from one nobody is logged into: bound your attempts there rather than looping on it. At most 128 KiB comes back, and more than that is refused rather than cut short.

Inputs: computer_id.

read_execution_outputRead an independent execution output chunkA
Read-onlyIdempotent
Inspect

Read volatile, mutable guest output once at explicit independent stdout_offset and stderr_offset byte positions. Performs guest I/O but does not refresh activity, resume, change shared PID cursors, retry, tail, capture or replay a command. Unsuitable for passive Activities/history. Each stream is limited to 4096 bytes by default, at most 16384. Text is lossless UTF-8 (BOM preserved); NUL, binary and split UTF-8 remain exact base64. False more flags mean current EOF, not completion. Diagnostics repeat independently; only the first 4096 diagnostic bytes are displayed, with distinct available/displayed counts and display/daemon truncation flags. A 409 with code output_unavailable that also carries output_unavailable (today "daemon_restarted", for a command that was already running when the service on the computer’s host restarted, and on get_execution too) is final: the output cannot be read, and sending the read again will not help; its status is still on get_execution. Without that marker it means a guest log could not be opened, which just after a command starts can be a log not created yet, so a later read at the same offsets can succeed. Either way, running the command again repeats what it did rather than recovering its output.

Inputs: execution_id (required), stderr_offset (required), stdout_offset (required), limit, +1 more.

read_fileGet a file out of the guestA
Idempotent
Inspect

Read a file from inside the computer. On a stopped computer this is a 400 that names no reason, which unlike other 400s clears: start_computer, then send it again. Text comes back as text and images come back as images; anything else comes back base64. A large file comes back a window at a time rather than filling the conversation: offset says where the window starts, and the note under a truncated read gives the exact offset to pass next. There is no size a file can be that makes it unreadable this way — a 2 GB log is pages, not a refusal — but a file you want whole is still better pushed out of the guest than carried through a conversation, and the note says how. This reaches the guest agent to do it, so a suspended computer is resumed to answer and that resume consumes running capacity — it can even come back 402 — unless no_wake is set, which refuses instead. read_clipboard, by contrast, refuses a suspended computer rather than starting it.

Inputs: path (required), offset, no_wake, computer_id.

read_result_outputRead an independent retained byte pageA
Read-onlyIdempotent
Inspect

Read one passive retained stdout, stderr or diagnostic page at an explicit offset. Default 4096/max 16384 bytes. EOF concerns this immutable prefix, not task completion. Lossless UTF-8/BOM or exact base64; no guest read, shared cursor, implicit capture, iteration or replay.

Inputs: offset (required), stream (required), result_id (required), limit, +1 more.

read_signalsRead one passive platform signal pageA
Read-onlyIdempotent
Inspect

Read finite daemon facts without waking the computer, guest contact, event socket, watcher, capture or polling loop. Omit since or send empty for a head-only baseline with no replay; neither a baseline nor gap proves no earlier activity or task success. Keep the returned cursor even on an empty page: filtered-out rows can advance it. Retention is ephemeral, and resets are explicit gaps.

Inputs: limit, since, computer_id.

remove_ssh_keyRemove an SSH public keyA
DestructiveIdempotent
Inspect

Remove one of your SSH keys. New connections with it are refused at once, and it is removed from the computers it was written into within moments, and any session opened with it is closed as each computer receives the new key list. Only a key bound to the account this API key acts on, one list_ssh_keys marks "this account only", can be removed here. Any other key, one added from the dashboard ("every account") or one bound to another account ("another account only"), answers as if there were no such key, and is removed from the dashboard.

Inputs: key_id (required), confirm (required).

rename_workspaceRename a workspaceA
Idempotent
Inspect

Rename a workspace. Its id does not change, so the API keys confined to it and the computers in it are untouched. The name follows create_workspace's rules; a name the account already uses is refused with 400, and an id this key cannot see is not found. Needs an owner's key that is not confined to a workspace: a member, a viewer, or any key confined to a workspace is refused with 403 — relay that rather than retrying.

Inputs: name (required), workspace_id (required).

replace_secretReplace a secret's valueA
Destructive
Inspect

Replace a stored secret's value, and move its revision_id. Send the revision_id list_secrets or get_secret answered: if it has moved since, this is refused with 409 and nothing changed — read it again, and replace again only if you still mean to. The new value is NEVER shown back. Owners only. Every start and restart delivers each secret's latest value. Separately, when a secret's value is replaced on a running computer: a secret bound as a FILE has that file rewritten in place within seconds; one bound as an ENVIRONMENT VARIABLE, on an image that supports it, reaches new shells within seconds, and every exec — plain or with desktop: true — runs with the bound variables as they are at that moment, so the next exec sees the new value; programs already running — the desktop session among them — keep the value they started with until a restart (older images wait for the restart). A file newly bound or renamed waits for the restart either way. That live send is asynchronous and best effort: this answer does not wait for it or say whether it landed, and a running computer may still hold the old value until its next start or restart, which always delivers the latest. get_computer's secrets_pending says whether one is still missing the change.

Inputs: value (required), secret_id (required), revision_id (required), workspace_id.

restart_computerRestart a computerAInspect

Reset the computer, like the reset button — not a fresh boot, so a change that needs a new machine shape (a resize) needs a stop and a start instead. A suspended computer is refused with 409: start it to resume, or stop it to discard the session. A stopped computer with no secrets bound is started instead; one with secrets bound is refused with 409 while stopped (start it, which delivers them) or while its secrets are being delivered, and otherwise gets its secrets again as it comes back up, a few seconds after it reads running: wait_for_computer with until="guest" waits for them where the platform reports that redelivery, and where it does not, a command run in those seconds can see them unset. A restart issues new desktop credentials and closes open desktop connections, so a get_desktop_url link from before it stops working.

Inputs: computer_id, idempotency_key.

restore_snapshotRestore a snapshotA
Destructive
Inspect

Put a snapshot back onto the computer it came from, discarding everything on that disk since. Check restore_available in list_snapshots first: where it is false, the snapshot's usable copy is on a host its computer has left, and a restore is refused while clone_snapshot still works. Refused on an orphaned snapshot — clone_snapshot is what works there. It leaves the computer RUNNING whatever state it was in: restoring a stopped one boots it, which is a start like any other and consumes running capacity. A disk snapshot comes back to a fresh boot, a memory one to the captured session, and either way a suspended session the computer was holding is discarded with the disk it was saved against.

Inputs: confirm (required), snapshot_id (required), idempotency_key.

resume_agent_scheduleResume an agent scheduleA
Destructive
Inspect

Resume a schedule, whatever paused it; its next fire is the first time after now, and it acts as this server's API key from then on. Its runs spend the account's AI credits, which must be available.

Inputs: schedule_id (required).

retain_execution_outputRetain an explicit execution output versionAInspect

Capture one immutable prefix version from volatile guest output by stable execution_id. Explicit guest I/O; never resumes, retries or replays a command. Each call creates a separate version. Capture may commit even if its response is lost. Default 1 MiB per stream/max 4 MiB and default 86400s/max 604800s retention; diagnostics separately capped 64 KiB. A full computer or account retained quota (shared with artifacts) is refused with 409 result_quota_exhausted and nothing captured: it clears only as objects expire or are deleted, so call list_results and list_artifacts and delete what is no longer needed rather than retry.

Inputs: execution_id (required), computer_id, retention_seconds, max_bytes_per_stream.

retire_templateRetire a template you publishedA
Destructive
Inspect

Stop a template resolving, and give its row back against your ceiling. WITHOUT version THIS RETIRES EVERY VERSION OF THE NAME — that is what retiring a template means here, and it is deliberately not get_template's "the newest". Pass version to take exactly one. THIS CANNOT BE UNDONE: a retired ref is refused for ever, identical bytes included, so the version you retire can never be published again — publish the next version instead. Computers are NOT affected: a computer is built from the image the ref resolved to and holds no reference to the document, so anything already running, stopped or suspended keeps working. What a retire breaks is resolution — a NEW create naming the ref is refused. Needs an account-wide key: a key confined to a workspace is refused (403) whatever it names. Say what it costs before you call it.

Inputs: name (required), confirm (required), namespace (required), version.

rotate_webhook_secretRotate a webhook’s signing secretAInspect

Mint a new signing secret for a subscription. THE ANSWER CARRIES IT ONCE, like create_webhook. The old secret goes on being honoured for 24 hours — every delivery in that window carries two signatures on the one webhook-signature header, new first, so a receiver that accepts either passes throughout — which is the window to get the new one deployed. Rotating again inside it replaces the previous secret rather than keeping three. Do this when a secret has leaked or when whoever held it has moved on.

Inputs: webhook_id (required).

screenshotScreenshot the desktopA
Read-only
Inspect

A picture of the screen, returned as an image with its capture name and original size when available. Fresh by default; give capture to crop the earlier frame you measured. Full-size capture pixels are the coordinates click, drag and scroll take; cropped or scaled pictures include a mapping. A saved frame of a suspended computer (served with fresh: false) is labelled as one: a downscaled picture of the screen as it was, not in click coordinates.

Inputs: fresh, scale, width, format, +4 more.

scrollScrollAInspect

Turn the wheel. With no coordinate it scrolls whatever is under the pointer; with one it scrolls what is at that point.

Inputs: direction (required), x, y, amount, +3 more.

set_computer_secretsReplace a computer's secret bindingsA
Destructive
Inspect

Replace the WHOLE list of secrets a computer is bound to — not a merge: any binding left out is removed, and secrets: [] removes every binding. Each entry names a secret id and exactly one of env (the environment variable it is delivered under) or file (delivered as /run/mandala-secrets/user/files/) — at most 32 secrets, 8 of them as files, none twice and no variable or file name twice — and is recorded at that secret's latest revision unless it names revision_id, which must be the revision the computer holds now (any other revision is refused). A binding's revision is what the computer last received, never a pin: naming it only says this change keeps the value the running computer already has, so the change does not stop it being suspended. Only ids, revisions and names are sent and answered — values are NEVER shown or set here. The new bindings reach the guest at its NEXT START OR RESTART: a running computer keeps what it booted with until then, and a suspended one resumes with its old values. Every start and restart delivers each secret's latest value. Separately, when a secret's value is replaced on a running computer: a secret bound as a FILE has that file rewritten in place within seconds; one bound as an ENVIRONMENT VARIABLE, on an image that supports it, reaches new shells within seconds, and every exec — plain or with desktop: true — runs with the bound variables as they are at that moment, so the next exec sees the new value; programs already running — the desktop session among them — keep the value they started with until a restart (older images wait for the restart). A file newly bound or renamed waits for the restart either way. Binding a computer that has NO secrets yet requires it to be STOPPED: that first binding is refused with 409 while the computer is running or suspended, because a computer started without secrets cannot receive them until it starts again, and a restart does not do that. Start it afterwards to deliver them. Send version from get_computer_secrets to change only the list you read: if it changed since, this is refused with 409 and nothing changes. Also 409 while a delivery to the computer is in progress. After a change that drops a secret or moves one to another revision, a running computer cannot be suspended or memory-snapshotted until it restarts. Owners and members only; Linux computers only, and binding one for the first time needs a template whose image can receive secrets.

Inputs: secrets (required), version, computer_id.

set_computer_sshSwitch SSH on or off for a computerA
Idempotent
Inspect

Turn SSH on or off for a computer. On, the computer runs an SSH server reachable only through the platform jump host, accepting the keys of every owner and member of the account, except keys added through an API key or connected app on another account, and keys of a member whose seat is suspended; off, the server stops and open SSH sessions are closed. No restart either way. Owners and members only.

Inputs: enabled (required), computer_id.

set_secretStore or replace a secret by nameA
Destructive
Inspect

Make a name hold a value: create the secret if the scope has no secret by that name, or replace its value if it has — the one to reach for when either will do. It reads the scope first and replaces against the revision it read; names match ignoring ASCII case, as the platform keeps them unique. If the secret is created or replaced by someone else between the read and the write, it reads again and tries again, up to 3 times. The value is NEVER shown back. Owners only. A new name counts against the account's limits on secrets held and created (list_secrets reports both). Every start and restart delivers each secret's latest value. Separately, when a secret's value is replaced on a running computer: a secret bound as a FILE has that file rewritten in place within seconds; one bound as an ENVIRONMENT VARIABLE, on an image that supports it, reaches new shells within seconds, and every exec — plain or with desktop: true — runs with the bound variables as they are at that moment, so the next exec sees the new value; programs already running — the desktop session among them — keep the value they started with until a restart (older images wait for the restart). A file newly bound or renamed waits for the restart either way. NOT safe to repeat blind when the answer is lost: list_secrets says whether the change landed.

Inputs: name (required), value (required), workspace_id.

snapshot_holdingsWhat a computer would leave behindA
Read-only
Inspect

How many snapshots a computer has, what they weigh, and the fingerprint that names that exact set. Read this before purging snapshots with delete_computer: the fingerprint is what binds the purge to the snapshots you were shown, so one that arrived after you looked cannot be swept up in it.

Inputs: computer_id.

snapshot_scheduleRead or set the nightly snapshotAInspect

When the platform takes this computer's automatic snapshot. Reading takes no arguments; setting takes an hour. There is deliberately no "last run" here — snapshots carry real capture times, and that is what a freshness check should read. This says when they are TAKEN and not how long they survive: get_retention is the other half, and it is what tells you whether the snapshots this schedule takes will still be there next month.

Inputs: set, clear, computer_id.

ssh_key_challengeGet a challenge to prove an SSH key is yoursAInspect

Issue a challenge to sign with the private half of a key about to be added, so add_ssh_key registers it as proven: a proven key connects to a computer by id or by name, an unproven one by id only. The answer carries the challenge, its namespace, when it expires, and sign_command: a shell command the PERSON runs on their own machine, replacing the key file it names with their private key file. Never ask for or handle the private key yourself. Send the challenge and the signature it prints to add_ssh_key. A challenge is not a credential: it belongs to this person alone, works once, expires within minutes, and asking for more than eight at once drops the oldest. Refused (403) where adding a key is: a key confined to a workspace, one that expires or is limited to computers, or a holder whose email is not verified.

Inputs: no named parameters.

start_computerStart a computerBInspect

Boot a computer, or resume a suspended one — a resume restores the saved session, same processes and windows, in about a second. A resumed guest's clock is set to the current time within a few seconds, best effort through its guest agent (one whose agent does not answer keeps the old time until NTP corrects it), and the desktop panel's clock can show the old time for up to a minute after that.

Inputs: computer_id, resume_only, idempotency_key.

stop_computerStop a computerAInspect

Shut a computer down: the guest is asked, and given up to 45 seconds to do it; a guest still up after that is forced off by the platform, so an ordinary stop always ends stopped and can take about 83 seconds to answer. Configure the MCP caller to allow at least 95 seconds; caller cancellation is still honored. On a suspended computer this discards the saved session, and the next start is a fresh boot. The disk is kept. force skips the asking and the 45-second wait and pulls the power at once.

Inputs: force, computer_id, idempotency_key.

suspend_computerSuspend a computerAInspect

Write the guest's RAM to disk and give the host its memory back. A pause, not a stop: start_computer resumes the same session. A computer that holds secrets suspends only on a host that seals saved sessions (its memory is encrypted on the way to disk); elsewhere, and while its secrets are still being delivered, it is refused with 409. After a change to its secret bindings that dropped a secret or moved one to another revision while it ran, it cannot be suspended until it restarts, since its memory may still hold the old value.

Inputs: computer_id, idempotency_key.

test_webhookSend a test deliveryAInspect

Queue one signed delivery of a synthetic webhook.test event through the ordinary path, so it is signed, retried and recorded exactly as a real one. The answer is the delivery record, ACCEPTED rather than finished: the endpoint has not been called yet when this returns. Read what it said back with list_webhook_deliveries a little later — a first attempt usually goes out within seconds, and a failed one is retried after 30 seconds. A disabled subscription is refused; enable it first with update_webhook. One exception: while the subscription already holds 10,000 deliveries not yet finished, its queue is full and the test is answered with state dropped and last_error "queue full", and is never sent. New events are being dropped the same way until the backlog drains.

Inputs: webhook_id (required).

type_textType textAInspect

Type a string into whatever has keyboard focus: literal text, 1 to 400 characters. For Enter, Tab or a shortcut, use press_key. Plain ASCII is typed as US-layout key events, about 12 ms a character, so 400 characters take about five seconds. Text containing any other character — accents, CJK, emoji — is typed WHOLE and in order by one guest helper: its ASCII as the same key presses and the rest by GTK Unicode composition. That works in Chromium (GTK3) and Xfce Terminal on a Linux X11 desktop; Firefox, GTK4 apps, native Wayland apps and Windows are unsupported for non-ASCII text, and such text is checked and refused before any key is pressed. Tab and newline are sent as keys and CRLF as one Return; a bare CR and other control characters are refused. The answer says which way it was typed. It confirms the keys were sent, not that the application accepted them: check with a screenshot before relying on it. For longer text, or non-ASCII text in an application this cannot type into, paste_text puts it on the clipboard and pastes it in one step.

Inputs: text (required), context, computer_id.

update_agent_scheduleChange an agent scheduleA
Destructive
Inspect

Change any of a schedule's fields; what is not sent stays. thread_id null makes each fire start a new thread. Its next fire becomes the first time after now, and it acts as this server's API key from then on. A schedule paused for a reason of its own stays paused: resume_agent_schedule resumes it. Five fields: minute hour day-of-month month day-of-week, each *, a number, a range a-b, a step */n, or a comma list; months and weekdays also take names (JAN, MON). At most one fire every five minutes. Example: "0 9 * * MON-FRI" for 09:00 on weekdays.

Inputs: schedule_id (required), cron, name, model, +6 more.

update_computerRename or resize a computerAInspect

Change a computer's name, its size, its idle window, its browser proxy, its egress proxy, or its end time. The platform refuses these in combination on purpose — a resize needs the computer stopped and the others do not, so one request cannot honour both without applying half of it. A SUSPENDED computer counts as stopped for a resize, and its saved desktop cannot survive one: the vCPU count and the memory size are part of the saved state, so it is discarded and the next start is a cold boot. Resume it and finish what is open before resizing, or say so before you do it.

Inputs: cpu, name, ram_mb, disk_gb, +7 more.

update_public_urlChange a public URL’s port or accessA
Idempotent
Inspect

Point a public URL at another port, switch it between public and private, or both. The label is the URL and does not change — delete it and create another for a new name. Fields you leave out are kept; name at least one.

Inputs: url_id (required), port, access, computer_id.

update_webhookChange a webhook subscriptionA
Idempotent
Inspect

Change the endpoint, the description, the filters, or whether it is enabled. Fields you leave out are kept as they are; name at least one. A new url is checked exactly as on create. enabled: true clears a disable the platform imposed for failures and starts fresh; enabled: false stops deliveries and records that you chose to. While the account’s plan includes no webhooks, enabled: true (and a new url) is refused with 402. The secret does not change — rotate_webhook_secret is for that.

Inputs: webhook_id (required), url, events, enabled, +2 more.

use_computerSelect a computerA
Idempotent
Inspect

Bind a computer to this session, so every later call can leave computer_id out. Answers with its status and screen resolution.

Inputs: computer_id (required).

waitWaitAInspect

Pause before looking again — for a page that is still painting or an application that is still starting. Capped at 30 seconds, because a wait here is a held HTTP request and a longer one would not return, it would fail.

Inputs: context, seconds, computer_id.

wait_for_computerWait for a computer to be readyA
Idempotent
Inspect

Poll until the computer is running, or until the software inside it answers. Use "guest" before exec, files or windows, and before expecting a screenshot to show a desktop rather than a boot screen; on Linux "guest" also waits until the desktop session is logged in, so exec with desktop: true is not refused as having no desktop session; on a computer with secrets bound, "guest" also waits until they have reached the desktop, so a command run next sees them, on one whose browser proxy is being set or removed it waits until its browsers have the change, and on one whose egress proxy is waiting for its credentials it waits until they arrive, since every connection the computer opens meanwhile is closed. Reports progress while it waits, so a client that sends a progressToken and sets resetTimeoutOnProgress can hold the request open; a client that cannot should lower timeout_s and call again rather than watch its own default timeout cancel the wait.

Inputs: until, timeout_s, computer_id.

wait_for_eventWait for something to happenAInspect

Block until the computer reports something, instead of screenshotting in a loop to find out whether it has. This is the tool that replaces polling: a window opening, a background command exiting, the desktop coming up, the machine going idle or changing power state. Types are window.opened, window.closed, window.focused, window.blurred, clipboard.changed, file.changed, process.exited, computer.ready, computer.idle, computer.started, computer.stopped, computer.suspended, and the list grows — pass none to wait for the next thing of any kind. It returns everything that happened up to and including the match, in order, so the answer is what the computer did rather than one fact out of it. Nothing is lost between calls: this server holds the stream open across turns, so a wait that times out has missed nothing and calling again picks up exactly where it left off. That is why the timeout is short — waiting again is free. Do not use it to wait for a click to land or a page to paint: neither is an event, and a screenshot is still how you find out what the screen looks like.

Inputs: pid, limit, since, types, +2 more.

wait_for_file_changeWait for a file to changeA
Destructive
Inspect

Block until something is created, changed or deleted anywhere under a directory in the guest, instead of running ls in a loop to find out whether it has. This is how you wait for a build to write its output, a download to land, or a script to produce a file. It nominates the directory on this computer's event stream, waits until the guest is genuinely watching it, and only then waits for a change — so a timeout from this tool means nothing changed, never "nothing was watching yet". The nomination sticks: up to 4 trees stay watched across your turns, so a second call on the same path is instant and a change that happens between two of your turns is still waiting for you. Nominate the NARROWEST directory you care about. A home directory under a build is thousands of changes a second, and what you get back for one of those is a single "too much changed" marker rather than the events. It reports changes, not contents: read_file and exec are still how you find out what is in a file. A rename inside the tree arrives as a delete and a create, and nothing is announced about what was already there when you nominated it — list the directory for that.

Inputs: path (required), limit, since, timeout_s, +1 more.

wait_for_operationWait for a lifecycle operation to finishA
Read-onlyIdempotent
Inspect

Poll a lifecycle operation until it is final. Answers once it has succeeded; a failed one is an error carrying error.code and the platform's sentence (resize_not_applied is a move that landed at the old size: the computer has moved, and update_computer finishes the resize). succeeded means the platform finished its step, not that the desktop has booted: wait_for_computer is still the wait for a desktop that answers. Most operations are already final when their call answers, so this is for a clone (running until its disk is copied) or a move. Reports progress while it waits, so a client that sends a progressToken and sets resetTimeoutOnProgress can hold the request open; get_operation reads it if the wait runs out.

Inputs: operation_id (required), timeout_s.

watch_buildWatch a build until it finishesA
Read-only
Inspect

Follow a build to its end and report what happened. Streams the platform's own progress — each event is sent only when something actually moved — and logs each one as it arrives, so a long build is visibly alive rather than indistinguishable from a hang. A build that FAILED is a normal answer here, not an error: read status and the failed step. Attaching to a build that has already finished is fine and returns immediately. Needs an account-wide key: a key confined to a workspace is refused (403).

Inputs: build_id (required).

whoamiWho this credential isA
Read-onlyIdempotent
Inspect

Who the API key this server runs with belongs to: the person (id, email, name), the account it acts on (id, name, plan, status: active or suspended), the role it acts with now (owner, member or viewer), the workspace it is confined to (null for the whole account), and the key itself (id, name, prefix, manage_keys: whether it may manage API keys, expires_at: when it stops working, null for never, and computer_ids: the only computers it may reach, null for every computer its scope reaches). An expired key is refused with 401 API key expired; a person mints a new one. For a key confined to a workspace the email, both names and the plan are null: the platform withholds them from a key that may be in the hands of an end customer. Needs no permission and any role; a suspended account can call it. No arguments.

Inputs: no named parameters.

window_actionAct on a windowAInspect

Focus, raise, minimize, maximize, unmaximize, close, move or resize one window. The reply is the window afterwards, not an acknowledgement — the window manager places the frame and applications snap to their own grid, so a move to 300,200 routinely lands at 305,229. Believe the response, not the request. On a Wayland desktop a tiled window cannot be moved or resized — float it first — and an action the compositor refuses is a 400. Prefer focus over raise: raising without focusing gives a window that is visibly in front and silently not receiving keystrokes. A 504 is neither a refusal nor a report that nothing happened unless its structured response explicitly says the request was not dispatched: an absent or ambiguous explanation leaves the action possibly already applied. An uncertain outcome is not permission to repeat it — the next call is list_windows, which says what the desktop is now, not this one again. Least of all for close, which cannot be undone.

Inputs: action (required), window_id (required), x, y, +3 more.

write_clipboardPut text on the desktop's clipboardAInspect

Puts text on the computer’s desktop clipboard, ready to paste. This leaves it on the clipboard and touches nothing on screen — follow it with press_key and keys ["ctrl","v"] to get the text into whatever has focus. Those are two separate key NAMES in the array, not one string "ctrl+v", which press_key would reject as an unknown key. Use this rather than the setsid/xclip/base64 recipe through exec: it is one call, it is confirmed, and it cannot be broken by a quote in the text. It requires a Linux desktop image with its desktop’s clipboard tool installed — xclip on X11, wl-clipboard (wl-paste/wl-copy) on Wayland images such as Omarchy. An image without that tool gets a 400 that names it and never clears; changing runtime state or retrying cannot fix that image dependency. On a Windows computer it needs no extra tool: the request runs in the signed-in desktop session, and a session too busy or too freshly signed in to run it in time answers a 409 that names no reason; that one may clear, so retry it a bounded number of times rather than looping. Unlike read_clipboard this DRIVES the computer, so a suspended one is resumed to serve it and that resume consumes running capacity. At most 64 KiB of text goes in — half what comes out, because the text crosses to the guest inside a single command argument. Empty text ("") CLEARS the clipboard, and is the only way to: do it after pasting a secret, since otherwise the desktop keeps holding it. The platform confirms the write by reading the selection back before it answers, so a success here means the desktop is holding your text rather than that a command ran; a refusal saying the desktop did not take it means something else claimed the clipboard in that instant, and sending it again works. Not every refusal here is one of those, and the answer says which it is rather than leaving you to match on the sentence: a computer that is not running is a 409 that start_computer fixes and that retrying never will, while a guest agent still inside its boot window is worth another attempt. A desktop that is not answering is deliberately left unclassified — it can equally be a guest still coming up or a session nobody is logged into — so bound your attempts there instead of looping.

Inputs: text (required), computer_id.

write_filePut a file into the guestAInspect

Write a file inside the computer. Paths must be absolute — the guest agent inherits whatever working directory it was started in, so a relative path resolves somewhere you did not name. By default the write goes straight to the path: a file already there is truncated as the upload starts, so a failed or cut-off write can leave only part of the new contents, and the old contents are gone. Pass overwrite: false to create the file only if nothing is there: a path that is taken is refused and that attempt writes nothing — retrying does not change that. With overwrite: false the contents are written beside the path and published only once complete, so incomplete contents never appear at it, though a failure while publishing or answering can leave the COMPLETE file there. After any error, read the path before retrying or overwriting, since what is there may be your own upload. When a partial file must never appear at the path, use overwrite: false or write_file_chunk. On a stopped computer this is a 400 that names no reason, which unlike other 400s clears: start_computer, then send it again. A refusal saying this computer’s host cannot do a create-only write, and a 503 on one, mean nothing was sent — but neither means the path is free. overwrite: false is for Linux computers; a Windows computer refuses it. A suspended computer is resumed to take the write, which consumes running capacity, unless no_wake is set.

Inputs: path (required), content (required), no_wake, encoding, +2 more.

write_file_chunkStage a resumable file chunkAInspect

Linux with python3 only. Stage up to 256 KiB in one chunk of a file up to 2 GiB. Supply raw bytes as base64, in order, keeping path, upload_id, size, overwrite and source contents unchanged. The final chunk publishes atomically. After any error call get_file_upload and continue from its offset; never guess or restart blindly. An empty chunk at offset=size retries publication. Call cancel_file_upload after completion or to abandon staging. Staging consumes guest disk until cancelled, with no expiry. May resume a suspended computer and consume running capacity. A 404 from an older host means resumable upload is not available on it: do not resend the chunk through write_file, which is neither atomic nor resumable. For large local files prefer the SDK or CLI, avoiding model-context transfers.

Inputs: path (required), size (required), offset (required), upload_id (required), +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 136 tools

    Disambiguation3/5

    The server is divided into many well-described families, but real boundary hazards remain: paste_text overlaps write_clipboard plus press_key; create_secret, set_secret and replace_secret overlap; and get_execution, read_execution_output, retain_execution_output, results and artifacts form several closely related clusters. Detailed descriptions mitigate most confusion, but an agent can still misselect within these families.

    Naming Consistency4/5

    Most names use a predictable snake_case verb_noun pattern with consistent family prefixes: list_, get_, create_, update_, delete_, set_, wait_for_, and so on. A few outliers such as whoami, exec, screenshot, click, scroll, drag and snapshot_schedule break the pattern, but naming remains readable and mostly predictable.

    Tool Count1/5

    At 136 tools this is far past the 25+ threshold and vastly beyond a well-scoped 3–15 tool surface. Even if many tools are individually justified by the platform's breadth, the count imposes excessive selection cost and makes the server feel like several products exposed at once.

    Completeness5/5

    Coverage is unusually complete: computer lifecycle, desktop I/O, files, snapshots, templates/builds, secrets, SSH, public URLs, webhooks, agents, schedules, usage, credits, artifacts and retained results all have lifecycle operations. Deliberate omissions such as raw API-key minting and revocation are documented and safe, and no obvious domain dead end remains.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Exposes Anthropic's computer-use action surface (screenshot, click, move, keyboard, clipboard, batch) against a persistent desktop display via MCP stdio protocol. Enables AI agents to control a virtual desktop environment through natural language instructions.
      24
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Cross-platform desktop automation MCP server that lets AI agents capture screenshots, run OCR with UI-element classification, control mouse/keyboard, and launch programs on Linux, macOS, and Windows.
      20
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables controlling your own Linux desktop machines from any MCP-capable LLM client, with opt-in agent capabilities for shell, filesystem, processes, screenshots, system info, and input injection.
      1
      MIT