Profiles (multi-browser)

Apus supports multiple named profiles (routing configs). Profiles can be:

Defaults:

All control endpoints accept ?profile=<name>; the CLI uses --browser-profile.

Existing session via Chrome DevTools MCP

Apus can also attach to a running Chromium-based browser profile through the official Chrome DevTools MCP server. This reuses the tabs and login state already open in that browser profile.

Official background and setup references:

Built-in profile: user. Create your own custom existing-session profile if you want a different name or browser data directory.

By default the built-in user profile uses Chrome MCP auto-connect, which targets the default local Google Chrome profile. Use userDataDir for Brave, Edge, Chromium, or a non-default Chrome profile. ~ expands to your OS home directory:

{
  browser: {
    profiles: {
      brave: {
        driver: "existing-session",
        attachOnly: true,
        userDataDir: "~/Library/Application Support/BraveSoftware/Brave-Browser",
      },
    },
  },
}

Then in the matching browser:

  1. Open that browser's inspect page for remote debugging.
  2. Enable remote debugging.
  3. Keep the browser running and approve the connection prompt when Apus attaches.

Common inspect pages:

Live attach smoke test:

apus browser --browser-profile user start
apus browser --browser-profile user status
apus browser --browser-profile user tabs
apus browser --browser-profile user snapshot --format ai

What success looks like:

What to check if attach does not work:

For startup failures, check the browser/chrome-mcp logs for a bounded, redacted tail of subprocess stderr when available.

Agent use:

Notes:

Custom Chrome MCP launch

Apus includes an exact-pinned Chrome DevTools MCP 1.10.1 dependency with a temporary document-identity patch and starts its CLI directly with the runtime running Apus, Node or Bun. The npm package carries the patched dependency; source checkouts obtain it through pnpm install. This keeps the server used at runtime aligned with Apus's browser contract tests. The patch is tracked in the upstream repair.

Override the server per profile for a custom executable or version. Custom servers are operator-managed and must preserve Chrome MCP's connection arguments and document-bound element identity.

Field What it does
mcpCommand Custom server executable. Absolute paths are honored; omitted or explicit npx selects Apus's packaged server.
mcpArgs Extra arguments passed unchanged to mcpCommand. Connection options override the generated endpoint or auto-connect arguments.

mcpArgs extends the selected server's arguments. Existing configurations that set mcpCommand: "npx" continue to select the built-in pinned server. The default launcher enables --experimentalVision for native coordinate clicks. A custom mcpCommand must expose the click_at tool to support click-coords; pass the server's corresponding feature flag in mcpArgs when required.

When mcpArgs does not set a connection option, Apus forwards a configured cdpUrl to Chrome MCP instead of generating --autoConnect:

Explicit endpoint arguments in mcpArgs override cdpUrl; adding --autoConnect alongside an endpoint does not hide it. Apus uses the selected endpoint for CDP control and checks Browser CDP policy before starting Chrome MCP. A matching blockedHostnames entry denies attachment even when private-network access is trusted. Unrelated blocklist entries do not prevent attachment, and the default strict-policy restrictions still apply.

Invalid, empty, duplicate, or conflicting endpoint arguments fail with an error before launch. Supply one valid endpoint, or omit cdpUrl and endpoint arguments to use host-local attachment.

When an endpoint is selected, userDataDir is ignored: Chrome MCP attaches to the running browser behind that endpoint rather than opening a profile directory.

Existing-session feature limitations

Compared to the managed apus profile, existing-session drivers are more constrained:

  • Ambiguous iframe refs - The packaged server scopes element IDs to their frame and document. If a custom server returns the same ID for different documents, Apus discards the snapshot and invalidates its refs. Ref-free page screenshots remain available; update the custom server or use a managed browser profile for ref-based work.
  • Screenshots - page captures and --ref element captures work; CSS --element selectors do not. Playwright is not required for page or ref-based element screenshots. (--full-page cannot combine with --ref or --element on any profile, not just existing-session.)
  • Actions - click, type, hover, scrollIntoView, drag, and select require snapshot refs (no CSS selectors). click-coords sends native input at visible viewport coordinates without a snapshot ref, supporting left clicks and double clicks. Right/middle buttons and nonzero delays return an unsupported-operation error. click is left-button only (no button overrides or modifiers). type does not support slowly=true; use fill or press. press does not support delayMs. type, hover, scrollIntoView, drag, select, and fill do not support per-call timeoutMs overrides; evaluate does. select accepts one exact HTML option value, including empty or whitespace values; duplicate display labels do not change which value is selected. batch is not supported; send actions individually.
  • Wait / upload / dialog - wait --url supports exact, substring, and glob patterns (same as managed); wait --load networkidle is not supported on existing-session profiles (it works on managed and raw/remote CDP profiles). Upload hooks require ref or inputRef and do not support CSS element; pass multiple paths when the page's file input accepts multiple files. Dialog hooks do not support timeout overrides or dialogId.
  • Dialog visibility - Managed browser action responses include blockedByDialog and browserState.dialogs.pending when an action opens a modal dialog; snapshots also include pending dialog state. Respond with browser dialog --accept/--dismiss --dialog-id <id> while a dialog is pending. Dialogs handled outside Apus appear under browserState.dialogs.recent.
  • Playwright-only features - PDF export, download interception, responsebody, and the agent actions requests, errors, text, and emulate require a Playwright-backed profile, such as the managed apus profile. Use snapshot to inspect an existing-session page.