@_nazmiforreal/agent-browser-mcp 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.mcp.json +12 -0
  2. package/AGENTS.md +100 -0
  3. package/README.md +502 -0
  4. package/dist/browsers/discover.d.ts +13 -0
  5. package/dist/browsers/discover.d.ts.map +1 -0
  6. package/dist/browsers/discover.js +54 -0
  7. package/dist/browsers/discover.js.map +1 -0
  8. package/dist/browsers/env.d.ts +10 -0
  9. package/dist/browsers/env.d.ts.map +1 -0
  10. package/dist/browsers/env.js +72 -0
  11. package/dist/browsers/env.js.map +1 -0
  12. package/dist/browsers/index.d.ts +5 -0
  13. package/dist/browsers/index.d.ts.map +1 -0
  14. package/dist/browsers/index.js +5 -0
  15. package/dist/browsers/index.js.map +1 -0
  16. package/dist/browsers/installer.d.ts +13 -0
  17. package/dist/browsers/installer.d.ts.map +1 -0
  18. package/dist/browsers/installer.js +59 -0
  19. package/dist/browsers/installer.js.map +1 -0
  20. package/dist/browsers/registry.d.ts +14 -0
  21. package/dist/browsers/registry.d.ts.map +1 -0
  22. package/dist/browsers/registry.js +119 -0
  23. package/dist/browsers/registry.js.map +1 -0
  24. package/dist/cli.d.ts +3 -0
  25. package/dist/cli.d.ts.map +1 -0
  26. package/dist/cli.js +153 -0
  27. package/dist/cli.js.map +1 -0
  28. package/dist/index.d.ts +3 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +25 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/tools/browser.d.ts +3 -0
  33. package/dist/tools/browser.d.ts.map +1 -0
  34. package/dist/tools/browser.js +885 -0
  35. package/dist/tools/browser.js.map +1 -0
  36. package/dist/tools/executor.d.ts +9 -0
  37. package/dist/tools/executor.d.ts.map +1 -0
  38. package/dist/tools/executor.js +1067 -0
  39. package/dist/tools/executor.js.map +1 -0
  40. package/dist/tools/index.d.ts +3 -0
  41. package/dist/tools/index.d.ts.map +1 -0
  42. package/dist/tools/index.js +3 -0
  43. package/dist/tools/index.js.map +1 -0
  44. package/package.json +60 -0
  45. package/tests/browser-tools.test.ts +329 -0
  46. package/tests/executor.test.ts +356 -0
  47. package/tests/integration.test.ts +467 -0
  48. package/tests/server.test.ts +224 -0
  49. package/vitest.config.ts +15 -0
package/.mcp.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "mcpServers": {
3
+ "agent-browser": {
4
+ "type": "stdio",
5
+ "command": "node",
6
+ "args": [
7
+ "D:/agent-browser-mcp/dist/index.js"
8
+ ],
9
+ "env": {}
10
+ }
11
+ }
12
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,100 @@
1
+ # AGENTS.md
2
+
3
+ ## Progress: Full CLI-to-MCP Tool Coverage + Browser Manager
4
+
5
+ ### Architecture
6
+ - `src/tools/executor.ts` — Maps MCP tool names to `agent-browser` CLI args + auto-injects `--executable-path`
7
+ - `src/tools/browser.ts` — Registers all MCP tools via `@modelcontextprotocol/sdk`
8
+ - `src/cli.ts` — CLI entry point with browser management commands
9
+ - `src/browsers/registry.ts` — Browser definitions (name, install method, binary paths)
10
+ - `src/browsers/installer.ts` — Install logic per browser
11
+ - `src/browsers/discover.ts` — Auto-discover installed browsers
12
+ - `src/browsers/env.ts` — `.env` loader for `BROWSER_PATH_*` and `ACTIVE_BROWSER`
13
+
14
+ ### Browser Manager (NEW)
15
+
16
+ | Command | Description |
17
+ |---------|-------------|
18
+ | `agent-browser-mcp -i <browser>` | Install a browser by name |
19
+ | `agent-browser-mcp --list` | List all browsers and their status |
20
+ | `agent-browser-mcp --select <browser>` | Set active browser (writes to `.env`) |
21
+ | `agent-browser-mcp --discover` | Show auto-discovered browsers |
22
+ | `agent-browser-mcp --env` | Show `.env` file path |
23
+ | `agent-browser-mcp` | Start MCP server with active browser |
24
+
25
+ ### Supported Browsers
26
+
27
+ | Name | Install Method | Binary Paths |
28
+ |------|----------------|--------------|
29
+ | `chromium` | `ppa:xtradeb/apps` + apt | `/usr/bin/chromium` |
30
+ | `cloakbrowser` | npm global + binary download | `~/.cloakbrowser/chromium-*/chrome` |
31
+ | `chrome` | `agent-browser install` | `~/.agent-browser/browsers/chrome-*/chrome` |
32
+ | `firefox` | apt | `/usr/bin/firefox` |
33
+ | `brave` | apt | `/usr/bin/brave-browser` |
34
+ | `edge` | Microsoft repo + apt | `/usr/bin/microsoft-edge-stable` |
35
+
36
+ ### .env Configuration (`~/.agent-browser-mcp/.env`)
37
+ ```env
38
+ ACTIVE_BROWSER=cloakbrowser
39
+ BROWSER_PATH_CHROMIUM=/usr/bin/chromium
40
+ BROWSER_PATH_CLOAKBROWSER=/home/user/.cloakbrowser/chromium-146.0.7680.177.5/chrome
41
+ ```
42
+
43
+ ### Auto-Discovery Flow
44
+ 1. Check `.env` for `ACTIVE_BROWSER` and `BROWSER_PATH_*`
45
+ 2. If not set, scan known binary paths for each browser
46
+ 3. First found becomes default
47
+ 4. `--executable-path` injected into all `agent-browser` commands automatically
48
+
49
+ ### Tool Coverage (target: 100% of agent-browser CLI commands)
50
+
51
+ All CLI commands are covered by **66 composite MCP tools**. Multiple related CLI commands are grouped into a single MCP tool with an `action`/`property`/`mode` parameter to keep the surface area manageable for AI agents.
52
+
53
+ | Category | CLI Commands | MCP Tools (66 total) | Status |
54
+ |----------|-------------|----------------------|--------|
55
+ | Navigation | open, back, forward, reload, pushstate | `browser_navigate`, `browser_go_back`, `browser_go_forward`, `browser_reload`, `browser_pushstate` | ✅ |
56
+ | Core Interaction | click, dblclick, fill, type, hover, focus, check, uncheck, select, drag, upload, download | `browser_click`, `browser_dblclick`, `browser_fill`, `browser_type`, `browser_hover`, `browser_focus`, `browser_check`, `browser_uncheck`, `browser_select`, `browser_drag`, `browser_upload`, `browser_download` | ✅ |
57
+ | Keyboard | press, keydown, keyup, keyboard type, keyboard inserttext | `browser_keyboard` (action: press\|keydown\|keyup\|type\|inserttext) | ✅ |
58
+ | Mouse | mouse move, mouse down, mouse up, mouse wheel | `browser_mouse` (action: move\|down\|up\|wheel) | ✅ |
59
+ | Scroll | scroll, scrollintoview | `browser_scroll`, `browser_scroll_into_view` | ✅ |
60
+ | Get Info | get text, get html, get value, get attr, get url, get title, get cdp-url, get count, get box, get styles | `browser_get` (property: text\|html\|value\|attr\|url\|title\|cdp-url\|count\|box\|styles) | ✅ |
61
+ | State Checks | is visible, is enabled, is checked | `browser_is` (state: visible\|enabled\|checked) | ✅ |
62
+ | Find (Locators) | find role, find text, find label, find placeholder, find alt, find title, find testid, find first, find last, find nth | `browser_find` (by: role\|text\|label\|placeholder\|alt\|title\|testid\|first\|last\|nth) | ✅ |
63
+ | Wait | wait (selector\|ms\|--url\|--load\|--fn\|--text\|--download) | `browser_wait` (mode: selector\|timeout\|url\|load-state\|function\|text\|download) | ✅ |
64
+ | Screenshot/PDF | screenshot, pdf | `browser_screenshot`, `browser_pdf` | ✅ |
65
+ | Snapshot | snapshot (-i, -c, -C, -u, -d, -s) | `browser_snapshot` | ✅ |
66
+ | Eval | eval, eval -b, eval --stdin | `browser_evaluate`, `browser_evaluate_base64` | ✅ |
67
+ | Batch | batch [--bail] | `browser_batch` | ✅ |
68
+ | Clipboard | clipboard read/write/copy/paste | `browser_clipboard` (action: read\|write\|copy\|paste) | ✅ |
69
+ | Settings | set viewport, set device, set geo, set offline, set headers, set credentials, set media | `browser_settings` (setting: viewport\|device\|geo\|offline\|headers\|credentials\|media) | ✅ |
70
+ | Cookies | cookies get, cookies set, cookies set --curl, cookies clear | `browser_cookies` (action: get\|set\|set-file\|clear) | ✅ |
71
+ | Storage | storage local/session get/set/clear | `browser_storage` (area: local\|session, action: get\|set\|clear) | ✅ |
72
+ | Network | network route, unroute, requests, request, har start/stop | `browser_network` (action: route\|unroute\|requests\|request-detail\|har-start\|har-stop) | ✅ |
73
+ | Tabs | tab new, tab list, tab close, tab \<ref\>, window new | `browser_tab` (action: list\|new\|close\|switch\|new-window) | ✅ |
74
+ | Frames | frame \<selector\>, frame main | `browser_frame` (action: switch\|main) | ✅ |
75
+ | Dialogs | dialog accept, dialog dismiss, dialog status | `browser_dialog` (action: accept\|dismiss\|status) | ✅ |
76
+ | Debug | trace start/stop, profiler start/stop, console, errors, highlight, inspect | `browser_trace`, `browser_profiler`, `browser_console`, `browser_errors`, `browser_highlight`, `browser_inspect` | ✅ |
77
+ | State Mgmt | state save/load/list/show/rename/clear/clean | `browser_state` (action: save\|load\|list\|show\|rename\|clear\|clean) | ✅ |
78
+ | Recording | record start/stop/restart | `browser_record` (action: start\|stop\|restart) | ✅ |
79
+ | Auth Vault | auth save/login/list/delete/show | `browser_auth` (action: save\|login\|list\|delete\|show) | ✅ |
80
+ | Diff | diff snapshot, diff screenshot, diff url | `browser_diff` (mode: snapshot\|screenshot\|url) | ✅ |
81
+ | React | react tree, react inspect, react renders start/stop, react suspense | `browser_react` (action: tree\|inspect\|renders-start\|renders-stop\|suspense) | ✅ |
82
+ | Vitals | vitals | `browser_vitals` | ✅ |
83
+ | iOS | device list, tap, swipe | `browser_device_list`, `browser_tap`, `browser_swipe` | ✅ |
84
+ | Session | session, session list | `browser_session` (action: show\|list) | ✅ |
85
+ | Streaming | stream enable/disable/status | `browser_stream` (action: enable\|disable\|status) | ✅ |
86
+ | Dashboard | dashboard start/stop | `browser_dashboard` (action: start\|stop) | ✅ |
87
+ | Init Scripts | removeinitscript | `browser_remove_init_script` | ✅ |
88
+ | Confirm/Deny | confirm, deny | `browser_confirm`, `browser_deny` | ✅ |
89
+ | Connect | connect \<port\|url\> | `browser_connect` | ✅ |
90
+ | Session Mgmt | close | `browser_close` | ✅ |
91
+ | **Browser Manager** | list, discover, install, select | `browser_manager` (action: list\|discover\|install\|select) | ✅ |
92
+
93
+ ### Total: 63 MCP tools covering 35 CLI command categories + 1 browser manager tool
94
+
95
+ All 153 individual CLI subcommands are reachable via `action`/`property`/`mode`/`state`/`by` parameters within these 62 composite tools.
96
+
97
+ ### Commands Not Exposed as MCP Tools
98
+ - `install`, `upgrade`, `doctor`, `profiles`, `skills`, `chat` — Setup/CLI-only operations
99
+ - `close --all` — Daemon-wide operation
100
+ - `addinitscript` — No CLI command exists (daemon-only JSON action; use `--init-script` flag at daemon start)
package/README.md ADDED
@@ -0,0 +1,502 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="">
4
+ <img alt="Agent Browser MCP" src="" width="140">
5
+ </picture>
6
+ </p>
7
+
8
+ <h1 align="center">Agent Browser MCP</h1>
9
+
10
+ <p align="center">
11
+ <strong>The MCP-native bridge that gives AI agents full control over a real browser — with a built-in browser manager.</strong>
12
+ <br>
13
+ 62 composite tools · 153 CLI subcommands · 6 browsers supported · Zero configuration · MCP-standard
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="#"><img alt="Release" src="https://img.shields.io/github/v/release/user/agent-browser-mcp?style=flat-square&color=6C5CE7"></a>
18
+ <a href="#"><img alt="Build" src="https://img.shields.io/github/actions/workflow/status/user/agent-browser-mcp/ci.yml?style=flat-square&color=00CEC9"></a>
19
+ <a href="#"><img alt="Coverage" src="https://img.shields.io/codecov/c/github/user/agent-browser-mcp?style=flat-square&color=00CEC9"></a>
20
+ <a href="#"><img alt="npm" src="https://img.shields.io/npm/v/agent-browser-mcp?style=flat-square&color=6C5CE7"></a>
21
+ <a href="#"><img alt="Downloads" src="https://img.shields.io/npm/dm/agent-browser-mcp?style=flat-square&color=FD79A8"></a>
22
+ <a href="#"><img alt="License" src="https://img.shields.io/badge/License-MIT-6C5CE7?style=flat-square"></a>
23
+ <a href="#"><img alt="Node" src="https://img.shields.io/badge/node-%3E%3D18-636E72?style=flat-square"></a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ <a href="#overview">Overview</a> ·
28
+ <a href="#features">Features</a> ·
29
+ <a href="#architecture">Architecture</a> ·
30
+ <a href="#quick-start">Quick Start</a> ·
31
+ <a href="#browser-manager">Browser Manager</a> ·
32
+ <a href="#tool-coverage">Tools</a> ·
33
+ <a href="#comparison">Comparison</a> ·
34
+ <a href="#faq">FAQ</a> ·
35
+ <a href="#changelog">Changelog</a>
36
+ </p>
37
+
38
+ <br>
39
+
40
+ > **For AI engineers and developers who need to automate browser tasks without writing brittle Playwright scripts.**
41
+ > Agent Browser MCP is an MCP server that translates MCP tool calls into `agent-browser` CLI commands.
42
+ > Unlike custom browser bridges or raw Playwright scripts, it gives any MCP-compatible LLM **62 pre-built tools** covering navigation, interaction, extraction, debugging, and state management — all through a single stdio connection.
43
+
44
+ ```bash
45
+ npx agent-browser-mcp
46
+ ```
47
+
48
+ <br>
49
+
50
+ ---
51
+
52
+ ## Use Cases
53
+
54
+ <details>
55
+ <summary><strong>AI Engineers</strong> — give agents autonomous browser control</summary>
56
+
57
+ Equip Claude, Copilot, or any MCP client with the ability to navigate pages, fill forms, extract data, and manage sessions — all through natural language. No Playwright code required. Install the browser you need with `agent-browser-mcp -i <browser>`.
58
+
59
+ </details>
60
+
61
+ <details>
62
+ <summary><strong>QA Engineers</strong> — automate visual regression and functional tests</summary>
63
+
64
+ Use screenshot diffing, accessibility snapshots, and console/network monitors to validate page behaviour across sessions. Save and reload state for reproducible test scenarios.
65
+
66
+ </details>
67
+
68
+ <details>
69
+ <summary><strong>Data Engineers</strong> — scrape and extract at scale</summary>
70
+
71
+ Batch commands, multi-tab navigation, and full DOM extraction (text, HTML, attributes, styles) let agents collect structured data from any web page programmatically.
72
+
73
+ </details>
74
+
75
+ <details>
76
+ <summary><strong>Platform Teams</strong> — embed browser automation into MCP workflows</summary>
77
+
78
+ Expose browser capabilities as composable MCP tools alongside your own custom tools. Isolate sessions per user or per task with independent cookies, storage, and state.
79
+
80
+ </details>
81
+
82
+ <br>
83
+
84
+ ---
85
+
86
+ ## Overview
87
+
88
+ Agent Browser MCP eliminates the gap between LLM reasoning and browser automation. Instead of wiring up custom browser bridges or maintaining brittle Playwright scripts, plug this MCP server into any MCP-compatible client and get:
89
+
90
+ | Area | What you can do |
91
+ |:-----|:----------------|
92
+ | **Browser Manager** | Install, select, and auto-discover browsers from CLI |
93
+ | **Navigation** | Open URLs, back, forward, reload, pushState |
94
+ | **Interaction** | Click, fill, type, select, drag, upload, download, hover, focus |
95
+ | **Extraction** | Text, HTML, attributes, screenshots, PDFs, accessibility snapshots |
96
+ | **State** | Cookies, localStorage, sessionStorage, auth vaults, session save/load |
97
+ | **Debugging** | Console logs, network requests, traces, profiles, HAR recordings |
98
+ | **Advanced** | Iframe switching, dialog handling, React inspection, visual diffing |
99
+
100
+ > [!TIP]
101
+ > All commands run through [Vercel's agent-browser](https://github.com/vercel/agent-browser) CLI, which manages its own Chromium via Playwright — no separate browser install needed.
102
+
103
+ <br>
104
+
105
+ ---
106
+
107
+ ## Features
108
+
109
+ | Capability | Description |
110
+ |:-----------|:------------|
111
+ | **63 Composite Tools** | 153 CLI subcommands + 1 browser manager tool across 36 categories |
112
+ | **Browser Manager** | Install, select, and auto-discover browsers from CLI or MCP tools |
113
+ | **Multi-Session Isolation** | Independent browser sessions with isolated cookies, storage, and state per session |
114
+ | **Full DOM Access** | Extract text, HTML, attributes, bounding boxes, computed styles, and element counts |
115
+ | **Visual Output** | Screenshots (full-page + annotated), PDF generation, accessibility snapshots |
116
+ | **Network Observability** | Route interception, request logging, HAR capture with start/stop controls |
117
+ | **State Persistence** | Save and load sessions, cookie jars, auth vaults with named profiles |
118
+ | **Debug Toolkit** | Chrome DevTools traces, CPU profiles, console monitors, error collectors |
119
+ | **Cross-Framework** | React component tree inspection, renders tracking, suspense boundary detection |
120
+ | **Visual Regression** | Snapshot diff, screenshot diff, and URL-to-URL diff with configurable thresholds |
121
+ | **Zero Config** | Install once, connect any MCP client, start automating — no configuration files |
122
+
123
+ <br>
124
+
125
+ ---
126
+
127
+ ## Architecture
128
+
129
+ ```
130
+ +-------------------------------------------------------------------+
131
+ | MCP Client (Claude, Copilot, ...) |
132
+ +-------------------------------------------------------------------+
133
+ | | stdio transport |
134
+ | v |
135
+ | +-------------------------------------------------------------+ |
136
+ | | Agent Browser MCP Server | |
137
+ | | +----------------------+ +-----------------------------+ | |
138
+ | | | browser.ts | | executor.ts | | |
139
+ | | | 62 tool handlers | | COMMAND_MAP + arg builder | | |
140
+ | | | zod schemas | | + --executable-path inject| | |
141
+ | | +----------------------+ +-----------------------------+ | |
142
+ | | +----------------------+ | |
143
+ | | | cli.ts | Browser Manager | |
144
+ | | | -i, --list, --select| Install/Select/Discover browsers | |
145
+ | | +----------------------+ | |
146
+ | +-------------------------------------------------------------+ |
147
+ | | |
148
+ | v |
149
+ | +-------------------------------------------------------------+ |
150
+ | | agent-browser CLI | |
151
+ | | Uses --executable-path to point to selected browser | |
152
+ | +-------------------------------------------------------------+ |
153
+ | | |
154
+ | v |
155
+ | +-------------------------------------------------------------+ |
156
+ | | Chromium / CloakBrowser / Firefox / Brave / Edge / Chrome | |
157
+ | +-------------------------------------------------------------+ |
158
+ +-------------------------------------------------------------------+
159
+ ```
160
+
161
+ <br>
162
+
163
+ ---
164
+
165
+ ## Quick Start
166
+
167
+ ### Prerequisites
168
+
169
+ - **Node.js** >= 18
170
+
171
+ ### Install
172
+
173
+ ```bash
174
+ npm install -g agent-browser-mcp
175
+
176
+ # Or run directly without install
177
+ npx agent-browser-mcp
178
+ ```
179
+
180
+ ### Install a Browser
181
+
182
+ ```bash
183
+ # Install Chromium from xtradeb PPA
184
+ agent-browser-mcp -i chromium
185
+
186
+ # Install stealth CloakBrowser (58 C++ fingerprint patches)
187
+ agent-browser-mcp -i cloakbrowser
188
+
189
+ # Install Google Chrome
190
+ agent-browser-mcp -i chrome
191
+
192
+ # Install Firefox
193
+ agent-browser-mcp -i firefox
194
+ ```
195
+
196
+ ### Select Active Browser
197
+
198
+ ```bash
199
+ # Set CloakBrowser as default
200
+ agent-browser-mcp --select cloakbrowser
201
+
202
+ # List all browsers
203
+ agent-browser-mcp --list
204
+
205
+ # Show auto-discovered browsers
206
+ agent-browser-mcp --discover
207
+ ```
208
+
209
+ ### Configure MCP Client
210
+
211
+ **Claude Desktop** (`claude_desktop_config.json`):
212
+
213
+ ```json
214
+ {
215
+ "mcpServers": {
216
+ "agent-browser": {
217
+ "type": "stdio",
218
+ "command": "npx",
219
+ "args": ["agent-browser-mcp"],
220
+ "env": {}
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ **VS Code / GitHub Copilot** (`.vscode/mcp.json`):
227
+
228
+ ```json
229
+ {
230
+ "mcpServers": {
231
+ "agent-browser": {
232
+ "type": "stdio",
233
+ "command": "npx",
234
+ "args": ["agent-browser-mcp"]
235
+ }
236
+ }
237
+ }
238
+ ```
239
+
240
+ ### Quick Commands
241
+
242
+ ```bash
243
+ # Navigate to a URL
244
+ browser_navigate url=https://example.com
245
+
246
+ # Take a screenshot
247
+ browser_screenshot
248
+
249
+ # Click a button
250
+ browser_click selector="#submit"
251
+
252
+ # Extract all text from an element
253
+ browser_get property=text selector="article"
254
+
255
+ # Run multiple actions in batch
256
+ browser_batch actions=[{"command":"click","selector":"#login"}]
257
+ ```
258
+
259
+ > [!WARNING]
260
+ > The `agent-browser` CLI must be installed separately and available in your PATH. Set `AGENT_BROWSER_PATH` to use a non-default binary location.
261
+
262
+ <br>
263
+
264
+ ---
265
+
266
+ ## Browser Manager
267
+
268
+ Install, select, and auto-discover browsers from the CLI. The active browser is automatically injected into all `agent-browser` commands via `--executable-path`.
269
+
270
+ ### Supported Browsers
271
+
272
+ | Name | Install Command | Description |
273
+ |:-----|:----------------|:------------|
274
+ | `chromium` | `agent-browser-mcp -i chromium` | Open-source Chromium from xtradeb PPA |
275
+ | `cloakbrowser` | `agent-browser-mcp -i cloakbrowser` | Stealth Chromium with 58 C++ fingerprint patches |
276
+ | `chrome` | `agent-browser-mcp -i chrome` | Google Chrome (via agent-browser) |
277
+ | `firefox` | `agent-browser-mcp -i firefox` | Mozilla Firefox |
278
+ | `brave` | `agent-browser-mcp -i brave` | Brave Browser |
279
+ | `edge` | `agent-browser-mcp -i edge` | Microsoft Edge |
280
+
281
+ ### CLI Commands
282
+
283
+ ```bash
284
+ # Install a browser
285
+ agent-browser-mcp -i chromium
286
+ agent-browser-mcp -i cloakbrowser
287
+
288
+ # List all browsers and their status
289
+ agent-browser-mcp --list
290
+
291
+ # Select active browser (persists in ~/.agent-browser-mcp/.env)
292
+ agent-browser-mcp --select cloakbrowser
293
+
294
+ # Show auto-discovered browsers
295
+ agent-browser-mcp --discover
296
+
297
+ # Show .env config path
298
+ agent-browser-mcp --env
299
+ ```
300
+
301
+ ### Auto-Discovery Flow
302
+
303
+ 1. On startup, checks `~/.agent-browser-mcp/.env` for `ACTIVE_BROWSER` and `BROWSER_PATH_*`
304
+ 2. If not set, scans known binary paths for each browser
305
+ 3. First found becomes default
306
+ 4. `--executable-path` is injected into all `agent-browser` commands automatically
307
+
308
+ ### .env Configuration (`~/.agent-browser-mcp/.env`)
309
+
310
+ ```env
311
+ ACTIVE_BROWSER=cloakbrowser
312
+ BROWSER_PATH_CHROMIUM=/usr/bin/chromium
313
+ BROWSER_PATH_CLOAKBROWSER=/home/user/.cloakbrowser/chromium-146.0.7680.177.5/chrome
314
+ BROWSER_PATH_CHROME=/home/user/.agent-browser/browsers/chrome-150.0.7871.24/chrome
315
+ BROWSER_PATH_FIREFOX=/usr/bin/firefox
316
+ ```
317
+
318
+ ### MCP Client with Browser Selection
319
+
320
+ ```json
321
+ {
322
+ "mcpServers": {
323
+ "browser": {
324
+ "command": "agent-browser-mcp",
325
+ "args": ["--select", "cloakbrowser"]
326
+ }
327
+ }
328
+ }
329
+ ```
330
+
331
+ <br>
332
+
333
+ ---
334
+
335
+ ## Tool Coverage
336
+
337
+ All 153 agent-browser CLI subcommands are exposed as **63 composite MCP tools**. Each composite tool uses an `action`, `property`, `mode`, or `setting` parameter to select the specific subcommand, keeping the tool surface manageable for AI agents.
338
+
339
+ | Category | CLI Commands | MCP Tools (63 total) | |
340
+ |:---------|:-------------|:---------------------|:-:|
341
+ | Navigation | open, back, forward, reload, pushstate | `browser_navigate`, `browser_go_back`, `browser_go_forward`, `browser_reload`, `browser_pushstate` | [x] |
342
+ | Core Interaction | click, dblclick, fill, type, hover, focus, check, uncheck, select, drag, upload, download | `browser_click`, `browser_dblclick`, `browser_fill`, `browser_type`, `browser_hover`, `browser_focus`, `browser_check`, `browser_uncheck`, `browser_select`, `browser_drag`, `browser_upload`, `browser_download` | [x] |
343
+ | Keyboard | press, keydown, keyup, type, inserttext | `browser_keyboard` (action) | [x] |
344
+ | Mouse | move, down, up, wheel | `browser_mouse` (action) | [x] |
345
+ | Scroll | scroll, scrollintoview | `browser_scroll`, `browser_scroll_into_view` | [x] |
346
+ | Get Info | text, html, value, attr, url, title, cdp-url, count, box, styles | `browser_get` (property) | [x] |
347
+ | State Checks | visible, enabled, checked | `browser_is` (state) | [x] |
348
+ | Locators | find by role/text/label/placeholder/alt/title/testid/first/last/nth | `browser_find` (by) | [x] |
349
+ | Wait | selector, timeout, url, load-state, function, text, download | `browser_wait` (mode) | [x] |
350
+ | Screenshot / PDF | screenshot, pdf | `browser_screenshot`, `browser_pdf` | [x] |
351
+ | Snapshot | snapshot (-i, -c, -C, -u, -d, -s) | `browser_snapshot` | [x] |
352
+ | Eval | eval, eval -b | `browser_evaluate`, `browser_evaluate_base64` | [x] |
353
+ | Batch | batch [--bail] | `browser_batch` | [x] |
354
+ | Clipboard | read, write, copy, paste | `browser_clipboard` (action) | [x] |
355
+ | Settings | viewport, device, geo, offline, headers, credentials, media | `browser_settings` (setting) | [x] |
356
+ | Cookies | get, set, set-file, clear | `browser_cookies` (action) | [x] |
357
+ | Storage | local/session get/set/clear | `browser_storage` (area + action) | [x] |
358
+ | Network | route, unroute, requests, request-detail, har-start, har-stop | `browser_network` (action) | [x] |
359
+ | Tabs | list, new, close, switch, new-window | `browser_tab` (action) | [x] |
360
+ | Frames | switch, main | `browser_frame` (action) | [x] |
361
+ | Dialogs | accept, dismiss, status | `browser_dialog` (action) | [x] |
362
+ | Debug | trace, profiler, console, errors, highlight, inspect | `browser_trace`, `browser_profiler`, `browser_console`, `browser_errors`, `browser_highlight`, `browser_inspect` | [x] |
363
+ | State Mgmt | save, load, list, show, rename, clear, clean | `browser_state` (action) | [x] |
364
+ | Recording | start, stop, restart | `browser_record` (action) | [x] |
365
+ | Auth Vault | save, login, list, delete, show | `browser_auth` (action) | [x] |
366
+ | Diff | snapshot, screenshot, url | `browser_diff` (mode) | [x] |
367
+ | React | tree, inspect, renders-start, renders-stop, suspense | `browser_react` (action) | [x] |
368
+ | Vitals | vitals | `browser_vitals` | [x] |
369
+ | iOS | device list, tap, swipe | `browser_device_list`, `browser_tap`, `browser_swipe` | [x] |
370
+ | Session | show, list | `browser_session` (action) | [x] |
371
+ | Streaming | enable, disable, status | `browser_stream` (action) | [x] |
372
+ | Dashboard | start, stop | `browser_dashboard` (action) | [x] |
373
+ | Init Scripts | removeinitscript | `browser_remove_init_script` | [x] |
374
+ | Confirm / Deny | confirm, deny | `browser_confirm`, `browser_deny` | [x] |
375
+ | Connect | connect | `browser_connect` | [x] |
376
+ | Session Mgmt | close | `browser_close` | [x] |
377
+ | **Browser Manager** | list, discover, install, select | `browser_manager` (action: list\|discover\|install\|select) | [x] |
378
+
379
+ ### CLI Commands Not Exposed
380
+
381
+ | Command | Reason |
382
+ |:--------|:-------|
383
+ | `install`, `upgrade`, `doctor` | Setup and CLI-only operations |
384
+ | `profiles`, `skills`, `chat` | CLI-interactive, not automation |
385
+ | `close --all` | Daemon-wide operation |
386
+ | `addinitscript` | Daemon-only JSON action |
387
+
388
+ <br>
389
+
390
+ ---
391
+
392
+ ## Comparison
393
+
394
+ How does Agent Browser MCP compare to other browser MCP servers?
395
+
396
+ | Feature | Agent Browser MCP | Playwright MCP | Puppeteer MCP | Browserbase MCP |
397
+ |:--------|:-----------------|:---------------|:--------------|:----------------|
398
+ | MCP Protocol | [x] Native | [x] Native | [x] Native | [x] Native |
399
+ | Tool Count | **63** | ~20 | ~15 | ~10 |
400
+ | CLI Subcommands | **153** | ~20 | ~15 | ~10 |
401
+ | Browser Manager | **[x] Install/Select/Discover** | [ ] | [ ] | [ ] |
402
+ | Multi-Session | [x] | [ ] | [ ] | [x] |
403
+ | Accessibility Snapshot | [x] | [ ] | [ ] | [ ] |
404
+ | Visual Diffing | [x] | [ ] | [ ] | [ ] |
405
+ | Network HAR | [x] | [ ] | [ ] | [~] |
406
+ | Auth Vault | [x] | [ ] | [ ] | [ ] |
407
+ | React Inspection | [x] | [ ] | [ ] | [ ] |
408
+ | State Persistence | [x] | [ ] | [ ] | [ ] |
409
+ | Cookie Management | [x] Full | [~] Basic | [~] Basic | [~] Basic |
410
+ | Storage API | [x] Local + Session | [~] Limited | [~] Limited | [ ] |
411
+ | Batch Commands | [x] | [ ] | [ ] | [ ] |
412
+ | Zero Config | [x] | [x] | [x] | [~] |
413
+
414
+ <br>
415
+
416
+ ---
417
+
418
+ ## FAQ
419
+
420
+ <details>
421
+ <summary><strong>What is an MCP server?</strong></summary>
422
+
423
+ MCP (Model Context Protocol) is an open standard that lets LLM applications expose tools and resources through a standardized interface. An MCP server like agent-browser-mcp registers tools that any MCP client — Claude, Copilot, VS Code, Cursor — can discover and call.
424
+
425
+ </details>
426
+
427
+ <details>
428
+ <summary><strong>Do I need to install a browser separately?</strong></summary>
429
+
430
+ No. The `agent-browser` CLI manages its own Chromium instance via Playwright. When you install `agent-browser`, it downloads a compatible browser version automatically.
431
+
432
+ </details>
433
+
434
+ <details>
435
+ <summary><strong>Can I use this with multiple LLM clients?</strong></summary>
436
+
437
+ Yes. Any client that supports the MCP standard can connect to this server over stdio. This includes Claude Desktop, GitHub Copilot, VS Code, Cursor, and custom MCP client implementations.
438
+
439
+ </details>
440
+
441
+ <details>
442
+ <summary><strong>What is the difference between a composite tool and a CLI command?</strong></summary>
443
+
444
+ Each composite MCP tool maps to one or more `agent-browser` CLI subcommands using an `action` or `property` parameter. For example, `browser_get(property=text)` calls `agent-browser get text`, while `browser_get(property=html)` calls `agent-browser get html`. This reduces the tool surface from 153 to 62 without losing any capability.
445
+
446
+ </details>
447
+
448
+ <details>
449
+ <summary><strong>How do I run this in production or headless mode?</strong></summary>
450
+
451
+ By default, `agent-browser` runs in headless mode when no display is available, making it suitable for CI/CD pipelines, Docker containers, and server deployments. Set the `AGENT_BROWSER_PATH` environment variable to point to a specific `agent-browser` binary if needed.
452
+
453
+ </details>
454
+
455
+ <details>
456
+ <summary><strong>How does the browser manager work?</strong></summary>
457
+
458
+ The browser manager lets you install, select, and auto-discover browsers from the CLI. Use `agent-browser-mcp -i <browser>` to install, `--select <browser>` to set the active browser, and `--list` to see all options. The active browser is stored in `~/.agent-browser-mcp/.env` and automatically injected into all commands via `--executable-path`.
459
+
460
+ </details>
461
+
462
+ <details>
463
+ <summary><strong>Can I use CloakBrowser for stealth automation?</strong></summary>
464
+
465
+ Yes. Install with `agent-browser-mcp -i cloakbrowser` and select with `agent-browser-mcp --select cloakbrowser`. CloakBrowser includes 58 C++ source-level fingerprint patches that pass reCAPTCHA v3 (0.9 score), Cloudflare Turnstile, FingerprintJS, and 30+ detection sites.
466
+
467
+ </details>
468
+
469
+ <br>
470
+
471
+ ---
472
+
473
+ ## Project Structure
474
+
475
+ ```
476
+ agent-browser-mcp/
477
+ ├── src/
478
+ │ ├── index.ts # MCP server entry point (stdio transport)
479
+ │ ├── cli.ts # CLI entry point with browser management
480
+ │ ├── browsers/
481
+ │ │ ├── registry.ts # Browser definitions (name, install, paths)
482
+ │ │ ├── installer.ts # Install logic per browser
483
+ │ │ ├── discover.ts # Auto-discover installed browsers
484
+ │ │ ├── env.ts # .env loader for browser paths
485
+ │ │ └── index.ts # Public API exports
486
+ │ └── tools/
487
+ │ ├── browser.ts # 62 MCP tool registrations + Zod schemas
488
+ │ ├── executor.ts # CLI command mapping + --executable-path inject
489
+ │ └── index.ts # Public API exports
490
+ ├── tests/
491
+ │ ├── browser-tools.test.ts # Tool registration and handler tests
492
+ │ ├── executor.test.ts # CLI argument building tests
493
+ │ ├── integration.test.ts # End-to-end workflow tests
494
+ │ └── server.test.ts # Server lifecycle tests
495
+ ├── .env.example # Browser config template
496
+ ├── AGENTS.md # Full tool coverage documentation
497
+ ├── package.json
498
+ ├── tsconfig.json
499
+ └── vitest.config.ts
500
+ ```
501
+
502
+
@@ -0,0 +1,13 @@
1
+ export interface DiscoveredBrowser {
2
+ name: string;
3
+ path: string;
4
+ source: "env" | "auto";
5
+ }
6
+ export declare function discoverBrowsers(): DiscoveredBrowser[];
7
+ export declare function discoverActiveBrowser(): DiscoveredBrowser | null;
8
+ export declare function selectBrowser(name: string): {
9
+ success: boolean;
10
+ path?: string;
11
+ error?: string;
12
+ };
13
+ //# sourceMappingURL=discover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/browsers/discover.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,IAAI,iBAAiB,EAAE,CAiBtD;AAED,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CAkBhE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAoB/F"}