@ricsam/browser-mcp 0.0.0 → 0.3.2
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 +14 -0
- package/README.md +51 -43
- package/THIRD_PARTY_NOTICES.md +17 -0
- package/dist/chunk-1sjcwr28.js +4 -0
- package/dist/chunk-2hzkme2s.js +41 -0
- package/dist/chunk-3kc8te5e.js +5006 -0
- package/dist/chunk-847prxk6.js +98 -0
- package/dist/chunk-cy1a8r79.js +255 -0
- package/dist/chunk-j6psfksr.js +52 -0
- package/dist/chunk-swy0qtx0.js +60 -0
- package/dist/chunk-xgk37h9a.js +77 -0
- package/dist/main.js +36 -0
- package/package.json +10 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Browser MCP CLI Distribution License
|
|
2
|
+
Copyright (c) 2026 ricsam. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is granted to install and execute the published @ricsam/browser-mcp
|
|
5
|
+
CLI package, and to make copies reasonably necessary for those purposes.
|
|
6
|
+
This permission does not grant rights to publish the private source repository,
|
|
7
|
+
redistribute modified versions, sublicense the software, or distribute source
|
|
8
|
+
outside the published package. All rights not expressly granted are reserved.
|
|
9
|
+
Third-party dependencies retain their own licenses; see THIRD_PARTY_NOTICES.md.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
12
|
+
IMPLIED, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
|
14
|
+
CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM USE OF THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,53 @@
|
|
|
1
1
|
# @ricsam/browser-mcp
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
3
|
+
Native Chrome companion, version 0.3.0. Requires Node >=22.14 and an installed
|
|
4
|
+
Google Chrome. No browser download or startup occurs during npm installation.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npx @ricsam/browser-mcp --help
|
|
8
|
+
npx @ricsam/browser-mcp browser start --server https://browser-mcp.click --profile work
|
|
9
|
+
browser-mcp browser status --profile work
|
|
10
|
+
browser-mcp browser pause --profile work
|
|
11
|
+
browser-mcp browser resume --profile work
|
|
12
|
+
browser-mcp browser stop --profile work
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Approve the printed pairing link in your ordinary browser. Credentials are stored
|
|
16
|
+
in restrictive files under `~/.browser-mcp`; never pass them in command arguments.
|
|
17
|
+
Profiles are dedicated and persistent by default. `--ephemeral` is explicit.
|
|
18
|
+
`--chrome-path /absolute/path/to/chrome` selects an installed binary, never a
|
|
19
|
+
profile. Profile names cannot contain paths. Your daily-driver profile is never
|
|
20
|
+
opened, copied or attached. `--live-view` enables screenshot-based live view
|
|
21
|
+
locally (off by default); remote viewers cannot enable it.
|
|
22
|
+
|
|
23
|
+
Foreground pipe lifecycle: keep the CLI running. Ctrl-C, stop, or normal CLI exit
|
|
24
|
+
closes its Chrome. There is no detach or automatic CDP reattachment. Each launch
|
|
25
|
+
has a fresh instance identity. Relay reconnect does not replay admitted actions.
|
|
26
|
+
Crash locks are deliberately not removed automatically: verify the exact prior
|
|
27
|
+
owner and Chrome processes are stopped before operator recovery. Retained crash
|
|
28
|
+
files are not automatically scavenged. Never remove directories by name prefix.
|
|
29
|
+
|
|
30
|
+
Linux requires a graphical display and working Chrome sandbox (unprivileged
|
|
31
|
+
user namespaces or a vendor-supported sandbox). macOS discovery is implemented
|
|
32
|
+
but requires platform verification before release. Windows browser hosting is
|
|
33
|
+
explicitly unavailable pending private ACL/lifecycle verification. Agent-only
|
|
34
|
+
helpers do not load Playwright or require a display:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
browser-mcp files --help
|
|
38
|
+
browser-mcp secrets --help
|
|
39
|
+
browser-mcp forward --help
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Native file/secret capabilities use separate bounded HTTPS streams. Secret
|
|
43
|
+
exports require explicit safe output paths; they are never printed to stdout.
|
|
44
|
+
Do not source page-derived dotenv as shell code. Capability files are sensitive.
|
|
45
|
+
|
|
46
|
+
Password inputs are masked at observation source, including nested frames.
|
|
47
|
+
Snapshots require exactly Playwright 1.63.0. Screenshots/live view, arbitrary JS,
|
|
48
|
+
ordinary page text and hostile scripts are **not** universally redacted. Clipboard
|
|
49
|
+
requires explicit authority and browser permissions; permissions are not silently
|
|
50
|
+
granted. Control-plane and privileged frames are blocked. The runtime is not a
|
|
51
|
+
remote shell, public CDP endpoint or arbitrary host-filesystem server.
|
|
52
|
+
|
|
53
|
+
License: see LICENSE. Public dependency notices: THIRD_PARTY_NOTICES.md.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Notices
|
|
2
|
+
|
|
3
|
+
Browser semantic/action, event, input and snapshot modules were adapted with the
|
|
4
|
+
owner's authorization from the private `ricsam/r5d-dev` project, package
|
|
5
|
+
`packages/r5d-browser`. That repository and its unpublished APIs are not runtime
|
|
6
|
+
dependencies. The snapshot adapter is specifically reconciled with Playwright
|
|
7
|
+
1.63.0 and fails closed on incompatible private snapshot APIs.
|
|
8
|
+
|
|
9
|
+
Public runtime dependencies installed alongside this package:
|
|
10
|
+
|
|
11
|
+
- `playwright-core` 1.63.0 — Microsoft Corporation, Apache License 2.0.
|
|
12
|
+
Its package includes LICENSE, NOTICE and ThirdPartyNotices.txt. Those notices
|
|
13
|
+
apply to its bundled third-party code. No browser binary is included here.
|
|
14
|
+
- `ws` 8.22.0 — Einar Otto Stangvik and contributors, MIT License.
|
|
15
|
+
See `ws/LICENSE` in the installed dependency.
|
|
16
|
+
|
|
17
|
+
Chrome is separately installed software governed by its vendor's terms.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// cli/src/agent/capability.ts
|
|
2
|
+
import { open, constants } from "node:fs/promises";
|
|
3
|
+
import { Readable } from "node:stream";
|
|
4
|
+
async function readCapability(path) {
|
|
5
|
+
let text = "";
|
|
6
|
+
if (path === "-") {
|
|
7
|
+
for await (const chunk of process.stdin) {
|
|
8
|
+
text += chunk;
|
|
9
|
+
if (Buffer.byteLength(text) > 16384)
|
|
10
|
+
throw new Error("Capability too large");
|
|
11
|
+
}
|
|
12
|
+
} else {
|
|
13
|
+
const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
14
|
+
try {
|
|
15
|
+
const s = await file.stat();
|
|
16
|
+
if (!s.isFile() || s.size > 16384 || process.platform !== "win32" && (s.mode & 63) !== 0)
|
|
17
|
+
throw new Error("Capability file must be private");
|
|
18
|
+
text = await file.readFile("utf8");
|
|
19
|
+
} finally {
|
|
20
|
+
await file.close();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const cap = JSON.parse(text);
|
|
24
|
+
const u = new URL(cap.url);
|
|
25
|
+
if (u.protocol !== "https:" || u.username || u.password || u.search || u.hash || !/^\/api\/native-data\/[a-zA-Z0-9-]+$/.test(u.pathname) || !["GET", "PUT"].includes(cap.method) || !/^Bearer [A-Za-z0-9_-]{43}$/.test(cap.headers.Authorization) || cap.expiresAt <= Date.now() || !Number.isSafeInteger(cap.limits.maxBytes) || cap.limits.maxBytes < 0 || cap.limits.maxBytes > 256 * 1024 * 1024)
|
|
26
|
+
throw new Error("Invalid capability");
|
|
27
|
+
return cap;
|
|
28
|
+
}
|
|
29
|
+
async function capabilityFetch(cap, body) {
|
|
30
|
+
const response = await fetch(cap.url, { method: cap.method, headers: { Authorization: cap.headers.Authorization }, body: body ? Readable.toWeb(body) : undefined, duplex: "half", redirect: "error", signal: AbortSignal.timeout(120000) });
|
|
31
|
+
if (!response.ok)
|
|
32
|
+
throw new Error("Capability transfer failed; do not automatically retry");
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
async function exclusiveOutput(path) {
|
|
36
|
+
if (process.platform === "win32")
|
|
37
|
+
throw new Error("Secret/file output on Windows requires ACL support; unavailable");
|
|
38
|
+
return open(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 384);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { readCapability, capabilityFetch, exclusiveOutput };
|