Skip to content

About

Let local coding agents use your real Chrome and Mac/Windows apps in the background, through a Chrome extension and the macOS Accessibility API.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Agent Computer Use

npm · Privacy policy · Chrome Web Store submission · Issues

Agent Computer Use lets local coding agents (Codex, Claude Code, Gemini CLI, Cursor, OpenCode, Copilot CLI and any other MCP client) work in your real Chrome while you keep using it. Each agent opens its own background tabs, grouped per task, and acts on them with its own pointer and keyboard. Your pointer, focus and current tab are not touched.

It works through a Chrome extension. Chrome's remote debugging stays off, so there is no "Allow remote debugging?" dialog and no permanent "Chrome is being controlled by automated test software" bar.

Agents work in their own tab groups while you keep working in yours

Install

You need macOS, Linux or Windows 10 or later, Chrome, Chromium, Brave or Edge 116 or later, and Node.js 20 or later. The browser tools work on all three systems. The Mac app tools are macOS-only.

npx @csltd/agent-computer-use install

install registers the native host for every Chromium-based browser it finds and copies the host and the extension to ~/.agent-computer-use, so nothing depends on the npx cache.

On Windows, run the same command in PowerShell or Command Prompt. ~ is your user folder, so the files go to %USERPROFILE%\.agent-computer-use. install finds browsers by their %LOCALAPPDATA% profile folders, writes the host manifest to %USERPROFILE%\.agent-computer-use, and points each browser's HKEY_CURRENT_USER\Software\...\NativeMessagingHosts\com.agentcomputeruse.host registry key at it. No administrator rights are needed.

Run install from a regular terminal (PowerShell, Command Prompt or Windows Terminal), not from a terminal or agent running inside a packaged Microsoft Store or MSIX app such as the Claude desktop app. Windows redirects registry writes from packaged apps to a private copy, so the browser never sees the registration, while doctor run from inside that app still reports it as registered. If install already ran from such an app, run it again from a regular terminal.

The launcher it writes names Node by a path that survives upgrades, such as /opt/homebrew/bin/node, not the version-specific folder Homebrew installs into (/opt/homebrew/Cellar/node/<version>/bin/node), which disappears on brew upgrade. If your Node lives in a version-specific folder only (nvm, for example), run install again after you change Node versions.

Then:

  1. Open chrome://extensions, turn on Developer mode, click Load unpacked and choose ~/.agent-computer-use/extension. This step goes away once the extension is listed on the Chrome Web Store.
  2. Add the MCP server to your agent (below).
  3. Check the setup with npx @csltd/agent-computer-use doctor. Every line should say ok. Lines that say info or warn are about the optional Mac app tools and do not make doctor fail.

The extension cannot work on its own. Chrome only lets an extension talk to programs on your computer through a native messaging host, so the install step is always needed. A Chrome Web Store install has a different extension ID; register it with npx @csltd/agent-computer-use install --extension-id <id>.

After upgrading the package, run install again. doctor reports when the extension and the package versions differ.

An extension loaded from ~/.agent-computer-use/extension reloads itself, in every profile, within a minute of an install that changes its files or the host's. install writes a build id (a short hash of those files) next to both, and the extension compares its own with the host's every minute. It reloads once for each new build, so a mismatch that stays cannot make it reload again and again. Profiles that were loaded before a version with this feature are reloaded by hand once, at chrome://extensions. An extension that comes from the Chrome Web Store updates through the store, and one loaded from a checkout has no build id and is never reloaded for you.

Add it to your agent

The MCP server is npx -y @csltd/agent-computer-use mcp. Use the full path to npx if your agent does not inherit your shell's PATH. On Windows, npx is a .cmd script that most agents can only start through cmd, so use cmd as the command and put /c, npx in front of the arguments, for example claude mcp add -s user agent-computer-use -- cmd /c npx -y @csltd/agent-computer-use mcp. install prints the same settings with the version in the package name, such as @csltd/agent-computer-use@<version>, so the agent runs the release that matches the extension you installed. Without a version, npx fetches the newest release the next time it runs.

Codex (~/.codex/config.toml):

[mcp_servers.agent-computer-use]
command = "npx"
args = ["-y", "@csltd/agent-computer-use", "mcp"]

Claude Code:

claude mcp add -s user agent-computer-use -- npx -y @csltd/agent-computer-use mcp

Gemini CLI, Cursor, Windsurf, Kiro and most other clients (mcpServers JSON):

{
  "mcpServers": {
    "agent-computer-use": {
      "command": "npx",
      "args": ["-y", "@csltd/agent-computer-use", "mcp"]
    }
  }
}

A short line in your agent instructions helps the agent pick the right tool, for example:

For browser work, use the agent-computer-use MCP. Open tabs with tab_open and a short emoji-prefixed group name per task, read pages with snapshot, act with the [ref=eN] references it returns, and close your tabs with tab_close when done.

How it works

flowchart LR
  A1[Agent 1] -->|MCP over stdio| M1[agent-computer-use mcp]
  A2[Agent 2] -->|MCP over stdio| M2[agent-computer-use mcp]
  M1 -->|JSON lines| S[(Unix socket<br>~/.agent-computer-use/hosts/PID.sock)]
  M2 -->|JSON lines| S
  S --- H[Native host<br>started by Chrome]
  H -->|native messaging| E[Agent Computer Use extension]
  E -->|chrome.debugger| T[Agent tabs in the background]
Loading
  • Chrome starts a native host for each profile whose extension is loaded. Each host listens on its own Unix socket, hosts/<process id>.sock, that only your user account can open, and removes it when it stops. On Windows each host listens on its own named pipe, \\.\pipe\agent-computer-use-<hash>-<process id>, and leaves an empty marker file, hosts/<process id>.pipe, so that agents can find it. It removes the marker when it stops.
  • Each agent runs agent-computer-use mcp, which finds the hosts, picks a profile (see Several browsers and profiles), connects to it and exposes browser tools.
  • The extension opens agent tabs with active: false, puts them in a coloured tab group named after the task, and forwards the agent's DevTools commands to those tabs through chrome.debugger.
  • Clicks and key presses go straight to the page as DevTools input events. Pages see real, trusted events, and your pointer stays where it is.
  • The extension detaches the debugger after two quiet minutes, so Chrome's "started debugging this browser" bar shows only while an agent is working. Dismissing that bar stops the agent on that tab: the tab is released, and nothing re-attaches to it until you ask the agent to claim it again with tab_claim.

Agents read pages as an outline and act by reference

Tab groups and colours

Every tab an agent opens goes into a tab group named after its task, so you can see at a glance which tabs belong to an agent and which are yours. Tabs join the group the extension already made for that title in the window. They never join a group you made yourself, even one with the same name. Otherwise a new group is made. The extension forgets its groups when you close them, or when Chrome restarts its background worker, so the next tab then makes a new group.

  • Each group title gets its own colour, worked out from the title, so the same task is always the same colour from one run to the next. Grey is not used, because it is what Chrome gives an uncoloured group.
  • tab_open takes an optional color (grey, blue, red, yellow, green, pink, purple, cyan or orange). It repaints the group if the extension already made it. Without it, an existing group keeps the colour it has.
  • AGENT_COMPUTER_USE_GROUP sets the title agents use when they do not give one. AGENT_COMPUTER_USE_COLOR sets the colour of every new group, in place of the one worked out from the title.

Several browsers and profiles

You can have the extension in more than one Chrome profile, and in more than one browser at once: Chrome, Chrome Beta or Canary, Brave, Edge and Chromium all work, each with its own profiles. Each one connects separately. An agent starts in the profile you used last, like a person would. The extension notes when you last focused one of its windows, and the agent picks the newest.

  • profiles_list shows every connected profile: an id, the browser, its name, the account email, when you last used it (lastFocusedAt) and which one the agent is inUse. doctor lists them too. An id is the browser and the profile's name, such as brave:me@example.com or chrome:work. When two profiles would have the same one (the same account in Chrome and in Chrome Canary, or profiles with no name or email), it ends with a short code, such as chrome:me@example.com#3fa2b1.
  • Most profiles that are not signed in to Chrome have no email. The local program then uses the name Chrome itself shows for the profile (such as "Work" or "Person 2"), which it finds in the browser's own Local State file, as chrome:work. It works out which profile folder a host belongs to by looking for a random token that the extension keeps in its storage. This is best effort: when it cannot find the name, the profile goes without one.
  • To choose the name yourself, click the extension's icon in that profile, type it under Name this profile and press Save. A name you type wins over Chrome's name, which wins over the account email.
  • The account email is off by default. To let agents see it, tick Show agents this profile's account email in the extension's popup in that profile. Chrome then asks for the identity permission, and clearing the box gives it back.
  • profile_use with match switches the agent to another profile. match is any part of the browser name, the name you gave the profile, the name Chrome shows for it, the account email or an id, and ignores case. If several profiles match, the one you used last wins, and an id that matches exactly always wins. tab_open takes the same text as profile, to switch and open a tab in one call. The agent stays in the new profile.
  • Tabs belong to one profile's extension. So profile_use refuses while the agent still controls tabs in its current profile, and tells it which. The agent closes them with tab_close, or passes releaseTabs: true to let go of them. Letting go does not close them. They stay open for you, and no agent controls them.
  • To start an agent in a particular profile, set AGENT_COMPUTER_USE_PROFILE to the same kind of text, for example work@example.com or brave. If nothing matches, the error lists the profiles that are connected. An agent can still switch afterwards, unless you set AGENT_COMPUTER_USE_ALLOW_PROFILE_SWITCH=0. That also makes profiles_list show only the profile the agent is in, and the error for a profile that is not connected say only that it is not connected, with no list of the others.
  • An agent stays in its profile until its MCP session ends. If Chrome restarts, it reconnects to the same profile on its next call, provided that profile's extension sends a token (the current extension does, once it has been reloaded; an older one does not). A profile whose extension sends no token cannot be recognised after its host goes away, because another profile can look exactly the same, so the agent's calls fail and say so, and say to reload the extension in that profile. The agent is told to ask you which profile to use; you can then choose it with profile_use, or start the agent again. Profiles that send the same token (a copied Chrome profile folder copies it) are treated the same way: if the agent's profile is one of them and goes away, its calls fail and say so, instead of moving to the other. A profile that is not connected at all fails like that too, instead of the agent moving to another profile because that one became the newest. One case cannot be seen: a copy that starts after the agent has picked its profile, when the original goes away before the two have ever been connected at the same time.
  • A profile that is not signed in to Chrome and has no name can only be told apart by its browser, its id code or by being the one you used last.
  • The extension cannot tell Chrome's release channels apart, so Chrome Beta and Canary both show as Chrome. Use the id to pick between them.
  • Tabs open in the profile's last used window. If that profile has no normal window open, the extension makes one without taking focus.

An older version of the extension does not report its profile. It still works, but it counts as never used, so another profile wins.

After upgrading, restart the MCP servers of your agents (start a new session). One that was started before the upgrade only looks at the old broker.sock (on Windows, the old single named pipe), which the new host no longer makes, so it cannot see the per-profile sockets and pipes.

Settings

Set these in the env of the agent's MCP server entry. They are all optional.

Variable What it does
AGENT_COMPUTER_USE_PROFILE Start in the profile whose id, name (the one you gave it, or Chrome's), account email or browser name contains this text. Without it, agents start in the profile you used last.
AGENT_COMPUTER_USE_GROUP The tab group title for tabs opened without a group. Defaults to 🤖 Agent task.
AGENT_COMPUTER_USE_COLOR The colour of every new tab group, one of the colours above. Without it, the colour comes from the group title.
AGENT_COMPUTER_USE_ALLOW_CLAIM Set to 0 or false to leave out tab_claim. See Security.
AGENT_COMPUTER_USE_ALLOW_EVALUATE Set to 0 or false to leave out evaluate. See Security.
AGENT_COMPUTER_USE_ALLOW_PROFILE_SWITCH Set to 0 or false to leave out profile_use and the profile option of tab_open, so agents stay where they start, and to make profiles_list show only the profile they are in. See Security.
AGENT_COMPUTER_USE_HOME Where the host, extension, sockets and desktop helper live. Defaults to ~/.agent-computer-use. Set it when you run install, which writes it into the host launcher (Chrome starts the host with no environment of its own), and set it the same way in your agent's MCP server entry, so that they use the same folder.

Tools

Tool What it does
profiles_list Lists the connected browser profiles, with id, browser, account and when you last used each, and which one the agent is using
profile_use Switches the agent to another browser profile, by browser name, account email or id
tabs_list Lists every open tab with its id, title, URL and group, and whether you control it
tab_open Opens a URL in a new background tab inside a named, coloured tab group, optionally in another profile
tab_claim Takes control of a tab you already have open, for when you ask an agent to work in it
tab_close Closes a tab the agent controls
navigate Loads a URL, or goes back, forward or reloads, and waits for the page
snapshot Returns the page as an outline of headings, text, links and controls, with [ref=eN] references
click, hover Clicks or hovers an element by reference
type, press_key Types into a field, optionally replacing its value or pressing Enter; presses keys and shortcuts
select_option Chooses options in a <select>
scroll Scrolls an element into view or the page by screens
screenshot Captures the viewport or the whole page, in PNG or JPEG
evaluate Runs JavaScript in the page and returns the result
console_messages, network_requests Console output, errors and requests since the agent attached
wait_for Waits for text to appear or disappear, or for a number of seconds
handle_dialog Accepts or dismisses alert, confirm and prompt dialogs

Snapshots and element lookups run in an isolated script world, so the page's own scripts cannot see or change them. Snapshots leave out text nobody can see (fully transparent, without size, or above or left of the page) and put page text in quotes with backslashes and quotes escaped, so a page cannot slip in lines that look like controls. That makes hidden instructions harder to plant. It does not stop a page from saying something misleading in plain sight, so treat everything a page says as untrusted.

Mac apps (macOS)

On macOS the same MCP server also controls native apps through the Accessibility API. Agents read an app's windows as an outline of controls with [ref=...] references and act on them by reference, the same way they work with pages. The user's pointer does not move.

Tool What it does Screen locked
desktop_status Reports whether the screen is locked, the Accessibility and Screen Recording permissions, and keep-awake works
desktop_keep_awake Keeps the display and system awake, so the screen does not lock on idle, until turned off or logout works
desktop_apps Lists running apps with bundle id, process id and window titles works
desktop_open Opens an app, file or URL in the background expected to work, not yet tested locked
desktop_focus Brings an app to the front, for commands that act on the current selection expected to work, not yet tested locked
desktop_snapshot Returns an app's windows, and optionally its menu bar, as an outline with references works
desktop_action Presses a button or performs another accessibility action, such as ShowMenu or Increment expected to work, not yet tested locked
desktop_set_value Replaces the value of a text field or other editable element expected to work, not yet tested locked
desktop_menu Chooses a menu bar command by its titles, for example ["File", "New Window"] expected to work, not yet tested locked
desktop_press_key Presses a key or shortcut; Cmd shortcuts run through the menu item that owns them Cmd shortcuts expected to work, not yet tested locked
desktop_type Types text into the app's focused element no
desktop_screenshot Captures an app's front window or the whole screen no

macOS keeps apps running behind the lock screen and answers Accessibility reads, but it does not deliver keyboard input and screen captures only show the lock screen. Actions and value changes use the same Accessibility calls as reads, but have not been tested on a locked screen yet. Turn on desktop_keep_awake before you leave the Mac so the screen does not lock in the first place.

A reference such as w0.3.1~a1b2c3 is the control's place in the window, plus a short code made from its role and label. If the window has changed since the snapshot and that place now holds a different control, the action fails with "the element changed" instead of pressing the wrong thing. Take a new desktop_snapshot and try again. Results name the control they acted on, for example Performed Press on Button "Save".

app can be a name, a bundle id (like com.apple.TextEdit, tried as a name too if it is not found) or a process id. desktop_open refuses an app or url that starts with -, and desktop_focus an app, so a value can never be read as an option of the open command. Arguments, including the text of desktop_type, reach the helper on stdin, so they do not show in a process list.

The tools run a small Swift helper, src/desktop-helper.swift, which install or the first desktop tool call compiles into ~/.agent-computer-use/desktop. Compiling needs the Xcode Command Line Tools (xcode-select --install).

macOS grants Accessibility and Screen Recording to the app that starts the agent (Codex, Claude, T3 Code, Terminal and so on), and the helper inherits them. If desktop_status reports accessibility: false, allow that app in System Settings > Privacy & Security > Accessibility, and for screenshots under Screen Recording, then restart it. desktop_screenshot says so when Screen Recording is missing. doctor only notes missing desktop permissions and never fails because of them, since the Mac app tools are optional.

Security

  • Only this extension can start the native host: its manifest lists the extension's ID in allowed_origins.
  • The sockets live in ~/.agent-computer-use/hosts, a folder with mode 700, and have mode 600, so only processes running as your user can connect. Any such process can use the tools, which is the same trust level as your user account.
  • On Windows each host's named pipe keeps Windows' default access rules: full access for your account, administrators and SYSTEM, and read-only access for everyone else. Read-only access is not enough to send commands, so other standard accounts cannot use the tools, but administrators can. Pipe names are shared by the whole machine, and another account that knows your user name and folder could create a pipe first. Agents connect to the pipe whose name they work out from a marker file in your own hosts folder, never to a name that a file holds. Only when there is no marker at all do they also try the single pipe, \\.\pipe\agent-computer-use-<hash>, which a host from an earlier version listens on until Chrome starts a new one.
  • An agent can only send commands to tabs it opened or claimed. tab_claim accepts any tab id, so tell your agents to claim a tab only when you ask. To take the tool away altogether, set AGENT_COMPUTER_USE_ALLOW_CLAIM=0 (or false) in the MCP server's env. An agent that a web page has tricked then has no way to grab your signed-in tabs. It is on by default so existing setups keep working.
  • AGENT_COMPUTER_USE_ALLOW_EVALUATE=0 (or false) leaves out the evaluate tool, so agents cannot run their own JavaScript in the pages of sites you are signed in to, where it could read or change your accounts. tab_open and navigate then also refuse javascript: addresses.
  • Agents can move between the profiles that have the extension, with profile_use, so pointing an agent at one profile with AGENT_COMPUTER_USE_PROFILE only sets where it starts. Set AGENT_COMPUTER_USE_ALLOW_PROFILE_SWITCH=0 (or false) to leave out profile_use and the profile option of tab_open, and the agent stays where you put it. profiles_list then shows only that profile, so the agent does not learn about the others.
  • Those settings change what one MCP server offers its agent. They do not stop another program running as your user from using the socket.
  • The extension forwards only the DevTools commands the tools use (a fixed list in extension/background.js), so an agent cannot read cookies, change download settings or add scripts to every page through it. Two options of allowed commands that would do the same (a script to run on every load of a page, and script access to every origin) are refused too. It only opens and navigates to http:, https: and data: addresses, and about:blank, and refuses everything else: local files, chrome: pages, pages of extensions (this one included), javascript: addresses, and addresses that are not whole, since Chrome would read popup.html as a page of this extension. It will not attach to a tab that shows such a page, tab_claim will not take one, and it lets go of a tab the moment it navigates to one. (data: pages are allowed because they cannot use extension features.) A page script that evaluate runs can still try to change the address itself. The tab is then released as soon as Chrome reports it, but turn evaluate off too if that matters to you.
  • Agents can read and change everything in the tabs they control, including signed-in sessions. Keep that in mind before you point an agent at an account.
  • On macOS, agents can read and operate every app the user can, through the permissions of the app that runs them.
  • The extension's popup lists the tabs agents control and has a button to release them all.

Chrome shows when an agent is working, and the popup releases agent tabs

Privacy

Nothing is sent to the developer or any server. The extension passes page content and tab details only to the local program, which passes them to the agents you connect. See PRIVACY.md.

Limitations

  • Snapshots cover the main page and same-origin iframes. Cross-origin iframes are listed but not expanded.
  • Chrome does not let extensions debug chrome:// pages, the Chrome Web Store or other extensions' pages. Agent Computer Use also refuses file: pages and its own pages, and anything that is not an http:, https: or data: page or about:blank.
  • Chrome slows timers and animations in background tabs.
  • Mac apps built without accessibility support, such as some games and canvas-drawn apps, show few or no controls in desktop_snapshot.
  • Menu commands and shortcuts that act on the current selection only work in the front app. Call desktop_focus first.
  • The desktop tools are macOS-only. On Windows and Linux the MCP server offers the browser tools only.
  • On Windows and Linux, shortcuts use Control rather than Meta, for example Control+a to select all.

Uninstall

npx @csltd/agent-computer-use uninstall

On Windows this also deletes the registry keys install added. Then remove the extension at chrome://extensions and the MCP entry from your agents.

Development

git clone https://github.com/konstantinosbotonakis/agent-computer-use.git
cd agent-computer-use
npm install
npm test
node bin/agent-computer-use.mjs install

Running install from a checkout prints MCP settings that point at the checkout. While developing, load the extension unpacked from the repository's extension folder so a reload picks up your changes.

  • The test workflow runs npm test on Linux, macOS and Windows for every pull request. On Windows the install test replaces reg.exe with a fake (test/fixtures/fake-registry.mjs), so it never writes to the real registry. Windows has no socket files, so the tests that stand fake hosts on them are skipped there, while the host tests run real hosts on named pipes. test/fixtures/pretend-windows.mjs makes a process on another system take the Windows branches, for tests that need to.
  • npm run package:store builds the Chrome Web Store upload in dist/.
  • To release, set the same version in package.json, package-lock.json and extension/manifest.json (npm version <x.y.z> --no-git-tag-version updates the first two), push to main, then publish a GitHub release tagged v<x.y.z> from main. The publish workflow checks that the release commit is on main and that the versions match, runs the tests on macOS and publishes to npm through trusted publishing. Its actions are pinned to commit SHAs, so updating them is a deliberate change.
  • node scripts/render-store-images.mjs renders the store screenshots and promo tile in store/images from the HTML in store/.
  • docs/chrome-web-store.md has the listing text, permission justifications and data disclosures.

License

MIT. Built by Custom Services Limited.

About

Let local coding agents use your real Chrome and Mac/Windows apps in the background, through a Chrome extension and the macOS Accessibility API.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages