browsirai 0.1.1 → 0.2.1
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.
- package/LICENSE +661 -78
- package/README.md +120 -6
- package/dist/bin.js +7 -17
- package/dist/bin.js.map +1 -1
- package/dist/cli/commands/act.js +1226 -0
- package/dist/cli/commands/act.js.map +1 -0
- package/dist/cli/commands/nav.js +739 -0
- package/dist/cli/commands/nav.js.map +1 -0
- package/dist/cli/commands/net.js +556 -0
- package/dist/cli/commands/net.js.map +1 -0
- package/dist/cli/commands/obs.js +1049 -0
- package/dist/cli/commands/obs.js.map +1 -0
- package/dist/cli/run.js +728 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli.js +7 -17
- package/dist/cli.js.map +1 -1
- package/dist/server.js +4 -2
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# browsirai
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/browsirai)
|
|
4
|
-
[](LICENSE)
|
|
5
5
|
|
|
6
6
|
**Your browser. Your sessions. Your agent.**
|
|
7
7
|
|
|
8
|
-
An MCP server that connects AI coding agents to your real Chrome via CDP.
|
|
8
|
+
An MCP server + CLI that connects AI coding agents to your real Chrome via CDP. Use as an MCP server for LLM-driven automation, or as a standalone CLI for direct browser control from the terminal.
|
|
9
9
|
|
|
10
10
|
## Why browsirai?
|
|
11
11
|
|
|
@@ -21,14 +21,69 @@ An MCP server that connects AI coding agents to your real Chrome via CDP. Like `
|
|
|
21
21
|
|
|
22
22
|
- **Always up to date** — Auto-upgrade checks npm registry on every server start. Next session launches with the latest version. Zero manual intervention.
|
|
23
23
|
|
|
24
|
+
## Demos
|
|
25
|
+
|
|
26
|
+
<table>
|
|
27
|
+
<tr>
|
|
28
|
+
<td width="50%">
|
|
29
|
+
|
|
30
|
+
**"show me my GitHub repos with star counts"**
|
|
31
|
+
|
|
32
|
+
Your GitHub session is already there. No API tokens, no OAuth.
|
|
33
|
+
|
|
34
|
+
https://github.com/user-attachments/assets/980a60c7-36c7-47f5-9598-dcc351ba93cf
|
|
35
|
+
|
|
36
|
+
</td>
|
|
37
|
+
<td width="50%">
|
|
38
|
+
|
|
39
|
+
**"block my calendar tonight 7-8pm for dinner"**
|
|
40
|
+
|
|
41
|
+
No Google OAuth registration. No Calendar API credentials. Your browser is already authenticated.
|
|
42
|
+
|
|
43
|
+
https://github.com/user-attachments/assets/51574049-b02c-4821-a0d0-d2ede9115c26
|
|
44
|
+
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td width="50%">
|
|
49
|
+
|
|
50
|
+
**"what am I working on right now?"**
|
|
51
|
+
|
|
52
|
+
Reads your open tabs — the highest-signal context source no other agent can access.
|
|
53
|
+
|
|
54
|
+
https://github.com/user-attachments/assets/4e61fede-bee6-4749-b26f-5eaf79e182f3
|
|
55
|
+
|
|
56
|
+
</td>
|
|
57
|
+
<td width="50%">
|
|
58
|
+
|
|
59
|
+
**"check this repo for console errors and network requests"**
|
|
60
|
+
|
|
61
|
+
Structured CDP data. ~500 tokens via snapshot vs ~10K via screenshot. 20x cheaper.
|
|
62
|
+
|
|
63
|
+
https://github.com/user-attachments/assets/95e4643f-d6f6-4315-85f4-cf0774128192
|
|
64
|
+
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td colspan="2">
|
|
69
|
+
|
|
70
|
+
**"which component renders this button? give me the source file."**
|
|
71
|
+
|
|
72
|
+
Walks the React Fiber tree at runtime via CDP. No source maps, no devtools extension. React, Vue, Svelte.
|
|
73
|
+
|
|
74
|
+
https://github.com/user-attachments/assets/e3370a69-a3ae-450b-bf2c-786e58ce27db
|
|
75
|
+
|
|
76
|
+
</td>
|
|
77
|
+
</tr>
|
|
78
|
+
</table>
|
|
79
|
+
|
|
24
80
|
## Quick Start
|
|
25
81
|
|
|
26
82
|
```bash
|
|
27
|
-
|
|
28
|
-
browsirai install
|
|
83
|
+
npx browsirai install
|
|
29
84
|
```
|
|
30
85
|
|
|
31
|
-
|
|
86
|
+
Auto-detects your AI platform and configures the MCP server. No global install needed.
|
|
32
87
|
|
|
33
88
|
<details>
|
|
34
89
|
<summary><strong>Claude Code</strong></summary>
|
|
@@ -170,6 +225,65 @@ mcpServers:
|
|
|
170
225
|
```
|
|
171
226
|
</details>
|
|
172
227
|
|
|
228
|
+
## CLI Mode
|
|
229
|
+
|
|
230
|
+
browsirai also works as a standalone CLI — no LLM required. Same commands, same Chrome connection.
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
browsirai open example.com
|
|
234
|
+
browsirai snapshot -i
|
|
235
|
+
browsirai click @e5
|
|
236
|
+
browsirai fill @e2 "hello world"
|
|
237
|
+
browsirai press Enter
|
|
238
|
+
browsirai eval "document.title"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Commands (30)
|
|
242
|
+
|
|
243
|
+
| Category | Commands |
|
|
244
|
+
|----------|----------|
|
|
245
|
+
| **Navigation** | `open` (goto, navigate), `back`, `scroll`, `wait`, `tab` (tabs), `close`, `resize` |
|
|
246
|
+
| **Observation** | `snapshot`, `screenshot`, `html`, `eval`, `find`, `source`, `console`, `network` |
|
|
247
|
+
| **Actions** | `click`, `fill`, `type`, `press` (key), `hover`, `drag`, `select`, `upload`, `dialog` |
|
|
248
|
+
| **Network** | `route`, `abort`, `unroute`, `save`, `load`, `diff` |
|
|
249
|
+
|
|
250
|
+
### Short Flags
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
browsirai snapshot -i # interactive elements only
|
|
254
|
+
browsirai snapshot -c # compact output
|
|
255
|
+
browsirai snapshot -d 3 # depth limit
|
|
256
|
+
browsirai snapshot -s "main" # scope to selector
|
|
257
|
+
browsirai screenshot -o ss.png # save to file
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Positional Arguments
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
browsirai click @e5 # ref (not --ref=@e5)
|
|
264
|
+
browsirai click "#submit" # CSS selector
|
|
265
|
+
browsirai fill @e2 "text" # ref + value
|
|
266
|
+
browsirai drag @e1 @e2 # source + target
|
|
267
|
+
browsirai select @e3 "option1" # ref + value(s)
|
|
268
|
+
browsirai scroll down # direction
|
|
269
|
+
browsirai resize 1280 720 # width height
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Workflow Example
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
browsirai open github.com/login
|
|
276
|
+
browsirai snapshot -i
|
|
277
|
+
# @e12 textbox "Username"
|
|
278
|
+
# @e15 textbox "Password"
|
|
279
|
+
# @e18 button "Sign in"
|
|
280
|
+
browsirai fill @e12 "user@example.com"
|
|
281
|
+
browsirai fill @e15 "password"
|
|
282
|
+
browsirai click @e18
|
|
283
|
+
browsirai wait --url="github.com/dashboard"
|
|
284
|
+
browsirai snapshot -i
|
|
285
|
+
```
|
|
286
|
+
|
|
173
287
|
## Features
|
|
174
288
|
|
|
175
289
|
| Feature | Description |
|
|
@@ -451,4 +565,4 @@ Yes — the LLM sees the same content you'd see in the browser. This is inherent
|
|
|
451
565
|
|
|
452
566
|
## License
|
|
453
567
|
|
|
454
|
-
|
|
568
|
+
AGPL-3.0 — free to use, modify, and distribute. If you modify and deploy as a network service, you must open-source your changes.
|
package/dist/bin.js
CHANGED
|
@@ -458,7 +458,8 @@ async function launchChromeWithDebugging(port = 9222, headless = false) {
|
|
|
458
458
|
}
|
|
459
459
|
const args = [
|
|
460
460
|
`--remote-debugging-port=${targetPort}`,
|
|
461
|
-
"--remote-allow-origins=*"
|
|
461
|
+
"--remote-allow-origins=*",
|
|
462
|
+
"--no-sandbox"
|
|
462
463
|
];
|
|
463
464
|
if (dataDir) {
|
|
464
465
|
args.push(`--user-data-dir=${dataDir}`, "--no-first-run", "--no-default-browser-check", "--disable-extensions");
|
|
@@ -572,7 +573,8 @@ async function launchHeadlessChrome() {
|
|
|
572
573
|
"--no-first-run",
|
|
573
574
|
"--no-default-browser-check",
|
|
574
575
|
"--disable-extensions",
|
|
575
|
-
"--disable-gpu"
|
|
576
|
+
"--disable-gpu",
|
|
577
|
+
"--no-sandbox"
|
|
576
578
|
], {
|
|
577
579
|
detached: true,
|
|
578
580
|
stdio: "ignore"
|
|
@@ -4914,21 +4916,9 @@ async function runCli(args) {
|
|
|
4914
4916
|
break;
|
|
4915
4917
|
}
|
|
4916
4918
|
default: {
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
`browsirai v${VERSION}`,
|
|
4921
|
-
"",
|
|
4922
|
-
"Usage: browsirai [command]",
|
|
4923
|
-
"",
|
|
4924
|
-
"Commands:",
|
|
4925
|
-
" (none) Start the MCP server (default)",
|
|
4926
|
-
" doctor Run diagnostics",
|
|
4927
|
-
" install Install browser integration",
|
|
4928
|
-
" --version Print version",
|
|
4929
|
-
""
|
|
4930
|
-
].join("\n")
|
|
4931
|
-
);
|
|
4919
|
+
const cliUrl = new URL("./cli/run.js", import.meta.url);
|
|
4920
|
+
const { runCLI } = await import(cliUrl.href);
|
|
4921
|
+
await runCLI(args);
|
|
4932
4922
|
break;
|
|
4933
4923
|
}
|
|
4934
4924
|
}
|