mcp-camoufox 0.4.8 → 0.4.9
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/dist/index.js +45 -16
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -134,27 +134,56 @@ server.tool("browser_launch", "Launch Camoufox stealth browser and navigate to U
|
|
|
134
134
|
const w = width > 0 ? width : 1280;
|
|
135
135
|
const h = height > 0 ? height : 800;
|
|
136
136
|
// Auto-download Camoufox binary if not installed
|
|
137
|
-
|
|
137
|
+
// camoufox-js does NOT auto-download — we handle it here
|
|
138
|
+
await (async () => {
|
|
138
139
|
const { execSync } = await import("child_process");
|
|
139
140
|
const { existsSync, readdirSync } = await import("fs");
|
|
140
141
|
const { join: pathJoin } = await import("path");
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const os = await import("os");
|
|
143
|
+
// Detect cache dir per platform (same logic as camoufox-js pkgman.ts)
|
|
144
|
+
const homeDir = os.homedir();
|
|
145
|
+
const platform = os.platform();
|
|
146
|
+
let cacheDir;
|
|
147
|
+
if (platform === "darwin") {
|
|
148
|
+
cacheDir = pathJoin(homeDir, "Library", "Caches", "camoufox");
|
|
149
|
+
}
|
|
150
|
+
else if (platform === "win32") {
|
|
151
|
+
cacheDir = pathJoin(process.env.LOCALAPPDATA || pathJoin(homeDir, "AppData", "Local"), "camoufox");
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
cacheDir = pathJoin(process.env.XDG_CACHE_HOME || pathJoin(homeDir, ".cache"), "camoufox");
|
|
155
|
+
}
|
|
156
|
+
// Check if binary exists (look for version.json inside cache dir)
|
|
157
|
+
const versionFile = pathJoin(cacheDir, "version.json");
|
|
158
|
+
const isInstalled = existsSync(versionFile);
|
|
149
159
|
if (!isInstalled) {
|
|
150
|
-
console.error("
|
|
151
|
-
|
|
152
|
-
console.error("[mcp-camoufox]
|
|
160
|
+
console.error("");
|
|
161
|
+
console.error("=".repeat(60));
|
|
162
|
+
console.error("[mcp-camoufox] First-time setup: downloading Camoufox browser");
|
|
163
|
+
console.error("[mcp-camoufox] This is ~500MB and only happens once.");
|
|
164
|
+
console.error("[mcp-camoufox] Please wait 2-5 minutes...");
|
|
165
|
+
console.error("=".repeat(60));
|
|
166
|
+
console.error("");
|
|
167
|
+
try {
|
|
168
|
+
// Use npx to run camoufox-js CLI fetch command
|
|
169
|
+
const cmd = platform === "win32" ? "npx.cmd" : "npx";
|
|
170
|
+
execSync(`${cmd} camoufox-js fetch`, {
|
|
171
|
+
stdio: "inherit",
|
|
172
|
+
timeout: 900000, // 15 min max
|
|
173
|
+
env: { ...process.env, npm_config_yes: "true" },
|
|
174
|
+
});
|
|
175
|
+
console.error("");
|
|
176
|
+
console.error("[mcp-camoufox] Download complete! Browser ready.");
|
|
177
|
+
console.error("");
|
|
178
|
+
}
|
|
179
|
+
catch (fetchErr) {
|
|
180
|
+
console.error(`[mcp-camoufox] Auto-download failed: ${fetchErr.message?.slice(0, 200)}`);
|
|
181
|
+
console.error("[mcp-camoufox] Try manually: npx camoufox-js fetch");
|
|
182
|
+
throw new Error("Camoufox browser binary not found. Auto-download failed. " +
|
|
183
|
+
"Please run manually: npx camoufox-js fetch");
|
|
184
|
+
}
|
|
153
185
|
}
|
|
154
|
-
}
|
|
155
|
-
catch (e) {
|
|
156
|
-
console.error(`[mcp-camoufox] Auto-download check: ${e.message?.slice(0, 100)}`);
|
|
157
|
-
}
|
|
186
|
+
})();
|
|
158
187
|
const ctx = await Camoufox({
|
|
159
188
|
headless,
|
|
160
189
|
humanize,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-camoufox",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "MCP server for stealth browser automation via Camoufox — 39 tools, Chrome DevTools MCP-level power with anti-bot stealth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"start": "node dist/index.js",
|
|
18
18
|
"dev": "tsc --watch",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
-
"postinstall": "npx camoufox-js fetch || echo '[mcp-camoufox] Browser will download on first launch.'"
|
|
19
|
+
"prepublishOnly": "npm run build"
|
|
21
20
|
},
|
|
22
21
|
"keywords": [
|
|
23
22
|
"mcp",
|