@ricsam/browser-mcp 0.3.15 → 0.3.16
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/README.md +2 -2
- package/dist/{chunk-ts4nynm9.js → chunk-g9ksk86v.js} +18 -7
- package/dist/main.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Native Chrome companion. Requires Node >=22.14.0 and an installed
|
|
4
4
|
Google Chrome. No browser download or startup occurs during npm installation.
|
|
5
5
|
|
|
6
|
-
Release 0.3.
|
|
6
|
+
Release 0.3.16 uses one cross-platform Node package with matching server/chart 0.3.16, native protocol 3 and no database schema change. It fixes local resume status and unscoped CSS queries for body/html roots. Resume immediately acknowledges reconnecting/unpaused without claiming readiness; already-unpaused resume preserves the current state. Visible DOM matches without ARIA refs are counted and explicitly reported as incomplete, not missing. Keep administrative sign-ins outside automated profiles unless deliberately delegated: internal pages, local files and the Browser MCP dashboard are no longer blanket-blocked, subject to Chrome's interface limits. Older runtimes require an update for new capabilities. Stop the old CLI before upgrading, then restart the same named profile to preserve sign-ins and pairing; never replay uncertain actions automatically.
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npm install -g @ricsam/browser-mcp@0.3.
|
|
9
|
+
npm install -g @ricsam/browser-mcp@0.3.16
|
|
10
10
|
browser-mcp browser start --server https://browser-mcp.click --profile work
|
|
11
11
|
browser-mcp browser status --profile work
|
|
12
12
|
browser-mcp browser pause --profile work
|
|
@@ -54,7 +54,7 @@ function onceAsync(action) {
|
|
|
54
54
|
// cli/src/browser/owned-chrome.ts
|
|
55
55
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
56
56
|
// cli/package.json
|
|
57
|
-
var version = "0.3.
|
|
57
|
+
var version = "0.3.16";
|
|
58
58
|
|
|
59
59
|
// cli/src/browser/chrome-diagnostics.ts
|
|
60
60
|
import { constants } from "node:fs";
|
|
@@ -2015,7 +2015,8 @@ function captureInUtilityWorld({ elements, injected }, options) {
|
|
|
2015
2015
|
if (inActiveBranch(item.element))
|
|
2016
2016
|
priorityRefs.push(ref);
|
|
2017
2017
|
}
|
|
2018
|
-
const
|
|
2018
|
+
const queryRoot = options.scope || options.rootIsScope ? selectedRoot : selectedRoot.ownerDocument;
|
|
2019
|
+
const matches = options.query ? injected.querySelectorAll(injected.parseSelector(options.query), queryRoot).filter((element) => (!options.query.startsWith("aria-ref=") || index.refs.has(element)) && injected.elementState(element, "visible").matches && named(element, options.queryName, options.exact)) : [];
|
|
2019
2020
|
const matchRefs = matches.flatMap((element) => {
|
|
2020
2021
|
const ref = index.refs.get(element);
|
|
2021
2022
|
return ref ? [ref] : [];
|
|
@@ -2119,7 +2120,8 @@ async function passwordSafeAriaSnapshot(page, options = {}) {
|
|
|
2119
2120
|
children.set(ref, await captureFrame(captured.frame, `aria-ref=${ref} >> internal:control=enter-frame >> body,frameset`, {
|
|
2120
2121
|
...frameOptions,
|
|
2121
2122
|
scope: undefined,
|
|
2122
|
-
scopeName: undefined
|
|
2123
|
+
scopeName: undefined,
|
|
2124
|
+
rootIsScope: false
|
|
2123
2125
|
}, false, childPath));
|
|
2124
2126
|
}));
|
|
2125
2127
|
const lines = [];
|
|
@@ -2137,7 +2139,7 @@ async function passwordSafeAriaSnapshot(page, options = {}) {
|
|
|
2137
2139
|
};
|
|
2138
2140
|
const prefix = (options.frames ?? []).map((selector) => `${selector} >> internal:control=enter-frame >> `).join("");
|
|
2139
2141
|
const refScope = options.scope?.startsWith("aria-ref=") ? options.scope : undefined;
|
|
2140
|
-
document2.text = (await captureFrame(frame, refScope ?? `${prefix}body,frameset`, refScope ? { ...renderOptions, scope: undefined } : renderOptions, true)).join(`
|
|
2142
|
+
document2.text = (await captureFrame(frame, refScope ?? `${prefix}body,frameset`, refScope ? { ...renderOptions, scope: undefined, rootIsScope: true } : renderOptions, true)).join(`
|
|
2141
2143
|
`);
|
|
2142
2144
|
return document2;
|
|
2143
2145
|
}
|
|
@@ -2263,7 +2265,7 @@ function renderSnapshot(document2, input) {
|
|
|
2263
2265
|
if (document2.unavailableFrames.length)
|
|
2264
2266
|
notes.push("Some frames disappeared or were unavailable during capture; refresh before treating the observation as complete.");
|
|
2265
2267
|
if (unrepresentedMatches)
|
|
2266
|
-
notes.push(`${unrepresentedMatches} matching elements
|
|
2268
|
+
notes.push(`${unrepresentedMatches} visible matching elements are not represented by a ref in the ARIA outline. Use browser_inspect with a unique selector for exact DOM details, or read that unique scope for its represented subtree. Pagination only includes represented matches.`);
|
|
2267
2269
|
if (nextOffset !== null)
|
|
2268
2270
|
notes.push(`Continue query with offset ${nextOffset} and this snapshotId. A changed observation requires restarting the search.`);
|
|
2269
2271
|
return {
|
|
@@ -5536,8 +5538,10 @@ class Relay {
|
|
|
5536
5538
|
}, 20000);
|
|
5537
5539
|
heartbeat.unref();
|
|
5538
5540
|
socket.once("open", () => {
|
|
5541
|
+
if (this.paused || this.stopping || socket !== this.socket || socket.readyState !== WebSocket2.OPEN)
|
|
5542
|
+
return;
|
|
5539
5543
|
this.state = "authenticating";
|
|
5540
|
-
socket.send(JSON.stringify({ type: "auth", token: this.token, client: { protocol: 3, version: "0.3.
|
|
5544
|
+
socket.send(JSON.stringify({ type: "auth", token: this.token, client: { protocol: 3, version: "0.3.16", instanceId: this.runtime.instanceId, operations: [...BROWSER_OPERATIONS, ...this.runtime.plugins.flatMap((p) => p.operations), "session_end", "release_tab", "runtime_health", "runtime_recover"], capabilities: ["runtime-queue.v1", "runtime-quarantine.v1", "binary-artifacts.v1", "browser-controls.v1", "screenshot-ids.v1", "webmcp.page-context.v1", "clipboard.native.v1", "native-transfers.v1", "secrets.v1", "forwarding.v1", "live-view.v1"], liveView: { enabled: this.liveEnabled } } }));
|
|
5541
5545
|
});
|
|
5542
5546
|
socket.on("message", (bytes, binary) => {
|
|
5543
5547
|
if (binary || Buffer.byteLength(bytes.toString()) > LIMIT) {
|
|
@@ -5552,6 +5556,8 @@ class Relay {
|
|
|
5552
5556
|
return;
|
|
5553
5557
|
}
|
|
5554
5558
|
if (message.type === "ready") {
|
|
5559
|
+
if (this.paused || this.stopping || socket !== this.socket || socket.readyState !== WebSocket2.OPEN)
|
|
5560
|
+
return;
|
|
5555
5561
|
if (message.protocol !== 3 || typeof message.browserId !== "string" || !Number.isSafeInteger(message.credentialEpoch) || message.credentialEpoch < 1 || this.state !== "authenticating") {
|
|
5556
5562
|
socket.close(1002);
|
|
5557
5563
|
return;
|
|
@@ -5559,6 +5565,8 @@ class Relay {
|
|
|
5559
5565
|
this.state = "initializing";
|
|
5560
5566
|
(async () => {
|
|
5561
5567
|
await this.runtime.reconnect(message.browserId);
|
|
5568
|
+
if (this.paused || this.stopping || socket !== this.socket || socket.readyState !== WebSocket2.OPEN)
|
|
5569
|
+
return;
|
|
5562
5570
|
this.state = "connected";
|
|
5563
5571
|
this.live = new NativeLiveProducer({ mediaUrl: mediaURL(this.server), token: this.token, instanceId: this.runtime.instanceId, credentialEpoch: message.credentialEpoch, context: this.runtime.context, authorizePage: async (page) => {
|
|
5564
5572
|
try {
|
|
@@ -5839,7 +5847,10 @@ class Relay {
|
|
|
5839
5847
|
await this.runtime.disconnect();
|
|
5840
5848
|
}
|
|
5841
5849
|
resume() {
|
|
5850
|
+
if (!this.paused)
|
|
5851
|
+
return;
|
|
5842
5852
|
this.paused = false;
|
|
5853
|
+
this.state = "reconnecting";
|
|
5843
5854
|
}
|
|
5844
5855
|
async stop() {
|
|
5845
5856
|
this.stopping = true;
|
|
@@ -6728,7 +6739,7 @@ async function startProfile(root, server, profile, options, groupSignal) {
|
|
|
6728
6739
|
return;
|
|
6729
6740
|
} else if (cmd !== "status")
|
|
6730
6741
|
throw new Error("Invalid command");
|
|
6731
|
-
socket.end(JSON.stringify({ ...relay.health(), instanceId: session.instanceId, profile, version: "0.3.
|
|
6742
|
+
socket.end(JSON.stringify({ ...relay.health(), instanceId: session.instanceId, profile, version: "0.3.16", protocol: 3 }) + `
|
|
6732
6743
|
`);
|
|
6733
6744
|
})().catch(() => socket.destroy());
|
|
6734
6745
|
});
|
package/dist/main.js
CHANGED
|
@@ -8,7 +8,7 @@ var args = process.argv.slice(2);
|
|
|
8
8
|
var command = args.shift();
|
|
9
9
|
async function main() {
|
|
10
10
|
if (!command || command === "--help" || command === "help") {
|
|
11
|
-
console.log(`@ricsam/browser-mcp 0.3.
|
|
11
|
+
console.log(`@ricsam/browser-mcp 0.3.16
|
|
12
12
|
Usage: browser-mcp browser start|status|pause|resume|stop|recover [options]
|
|
13
13
|
browser-mcp files upload|download [options]
|
|
14
14
|
browser-mcp secrets export|exec [options]
|
|
@@ -18,11 +18,11 @@ Browser dependencies load only for browser commands. No automatic Chrome downloa
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
if (command === "--version") {
|
|
21
|
-
console.log("0.3.
|
|
21
|
+
console.log("0.3.16");
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
if (command === "browser")
|
|
25
|
-
return (await import("./chunk-
|
|
25
|
+
return (await import("./chunk-g9ksk86v.js")).runBrowser(args);
|
|
26
26
|
if (command === "files")
|
|
27
27
|
return (await import("./chunk-zv1900tw.js")).runFilesCommand(args);
|
|
28
28
|
if (command === "secrets")
|