@nuwax-ai/nuwa-browser-mcp 0.5.3 → 0.5.4
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 +11 -0
- package/dist/cli.js +5 -1
- package/dist/doctor.js +3 -0
- package/package.json +5 -3
- package/preflight.mjs +43 -0
package/README.md
CHANGED
|
@@ -57,6 +57,17 @@ npx -y @nuwax-ai/nuwa-browser-mcp doctor
|
|
|
57
57
|
|
|
58
58
|
典型循环:`nuwa_taskspace_use` → `nuwa_navigate` → `nuwa_snapshot` → `nuwa_click` / `nuwa_type` → `nuwa_snapshot`(验证)。
|
|
59
59
|
|
|
60
|
+
## 服务器 / 无头部署(Linux)
|
|
61
|
+
|
|
62
|
+
无显示器的 Linux 服务器可以整套跑(安装器自动用 xvfb 虚拟显示拉起应用):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -fsSL https://s3.nuwax.com:9443/nuwax-packages/agent-engines/nuwa-browser/install-from-s3.sh | bash -s -- --no-skill --no-sandbox
|
|
66
|
+
npx -y @nuwax-ai/nuwa-browser-mcp doctor
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
要点:root / 容器必须 `--no-sandbox`(Chromium 硬性限制,root 无法开沙箱);GUI 在 xvfb 虚拟显示内运行,需要人看时可用 VNC。注意 MCP server 与应用必须**同机**——它是本机 IPC 薄传输,不支持脱离桌面应用单独云托管。
|
|
70
|
+
|
|
60
71
|
## 排障
|
|
61
72
|
|
|
62
73
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -48,7 +48,11 @@ export function defaultCliPath() {
|
|
|
48
48
|
return c;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
throw new Error("nuwa-browser CLI not found —
|
|
51
|
+
throw new Error("nuwa-browser CLI not found — this MCP server drives the nuwa-browser desktop app, " +
|
|
52
|
+
"which must be installed (and running) on this machine.\n" +
|
|
53
|
+
" install: curl -fsSL https://s3.nuwax.com:9443/nuwax-packages/agent-engines/nuwa-browser/install-from-s3.sh | bash\n" +
|
|
54
|
+
" verify: npx -y @nuwax-ai/nuwa-browser-mcp doctor\n" +
|
|
55
|
+
" (or set NUWA_BROWSER_BIN to an existing CLI path)");
|
|
52
56
|
}
|
|
53
57
|
const CMD_SPECIAL_RE = /[\s"^&|<>()]/;
|
|
54
58
|
function quoteCmdArg(a) {
|
package/dist/doctor.js
CHANGED
|
@@ -33,6 +33,9 @@ export async function doctor() {
|
|
|
33
33
|
console.log(`[fail] app IPC check: ${res.output.trim() || `(exit=${res.code})`}`);
|
|
34
34
|
if (/cannot connect|socket|ECONNREFUSED|ENOENT/i.test(res.output)) {
|
|
35
35
|
console.log(" fix: start the nuwa-browser app and retry");
|
|
36
|
+
if (process.platform === "linux") {
|
|
37
|
+
console.log(" server/headless: install with --no-sandbox; the installer launches the app under xvfb-run when no display is present");
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
return 1;
|
|
38
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuwax-ai/nuwa-browser-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "MCP server exposing nuwa-browser — any MCP client can drive the agent browser (navigate, snapshot, click, type, collect).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"files": [
|
|
12
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"preflight.mjs"
|
|
13
14
|
],
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">=22"
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "tsc -p tsconfig.json && chmod +x dist/index.js",
|
|
49
|
-
"test": "pnpm run build && node --test \"src/**/*.test.mjs\""
|
|
50
|
+
"test": "pnpm run build && node --test \"src/**/*.test.mjs\"",
|
|
51
|
+
"postinstall": "node preflight.mjs"
|
|
50
52
|
}
|
|
51
53
|
}
|
package/preflight.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* preflight.mjs — best-effort install-time hint (npm postinstall).
|
|
3
|
+
*
|
|
4
|
+
* The MCP server is a thin transport over the nuwa-browser desktop app: it
|
|
5
|
+
* spawns the local `nuwa-browser` CLI, which talks to the running app's IPC
|
|
6
|
+
* socket. This script tells the operator at install time whether that
|
|
7
|
+
* prerequisite exists. It NEVER fails the install — worst case it prints the
|
|
8
|
+
* install one-liner. (Skipped silently under --ignore-scripts.)
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
|
|
12
|
+
const INSTALL_CMD =
|
|
13
|
+
"curl -fsSL https://s3.nuwax.com:9443/nuwax-packages/agent-engines/nuwa-browser/install-from-s3.sh | bash";
|
|
14
|
+
|
|
15
|
+
let cliPath = null;
|
|
16
|
+
try {
|
|
17
|
+
const { defaultCliPath } = await import("./dist/cli.js");
|
|
18
|
+
cliPath = defaultCliPath();
|
|
19
|
+
} catch {
|
|
20
|
+
// dist not built yet (fresh checkout) — nothing to probe.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const isWin = process.platform === "win32";
|
|
24
|
+
const appMarkers = isWin
|
|
25
|
+
? [`${process.env.USERPROFILE || ""}\\AppData\\Local\\Programs\\nuwa-browser\\nuwa-browser.exe`]
|
|
26
|
+
: ["/Applications/nuwa-browser.app", "/opt/nuwa-browser"];
|
|
27
|
+
const appInstalled = appMarkers.some((p) => p && existsSync(p));
|
|
28
|
+
|
|
29
|
+
if (!cliPath) {
|
|
30
|
+
console.warn(
|
|
31
|
+
`[nuwa-mcp] nuwa-browser CLI not found on this machine.\n` +
|
|
32
|
+
` This MCP server drives the nuwa-browser desktop app (same machine) — install it first:\n` +
|
|
33
|
+
` ${INSTALL_CMD}\n` +
|
|
34
|
+
` then verify with: npx -y @nuwax-ai/nuwa-browser-mcp doctor`,
|
|
35
|
+
);
|
|
36
|
+
} else if (!appInstalled) {
|
|
37
|
+
console.warn(
|
|
38
|
+
`[nuwa-mcp] nuwa-browser CLI found (${cliPath}), but no desktop app install was detected.\n` +
|
|
39
|
+
` If tools fail, re-run the installer: ${INSTALL_CMD}`,
|
|
40
|
+
);
|
|
41
|
+
} else {
|
|
42
|
+
console.log(`[nuwa-mcp] nuwa-browser detected (CLI: ${cliPath}) — ready.`);
|
|
43
|
+
}
|