real-browser-mcp-server 1.4.7 → 1.5.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/README.md +6 -10
- package/dist/lib/cjs/index.js +2 -381
- package/dist/lib/cjs/index.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -13
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/handlers/browser.d.ts.map +1 -1
- package/dist/src/mcp/handlers/browser.js +18 -2
- package/dist/src/mcp/handlers/browser.js.map +1 -1
- package/dist/src/mcp/handlers/dom.js +5 -5
- package/dist/src/mcp/handlers/dom.js.map +1 -1
- package/dist/src/mcp/handlers/helpers.d.ts +7 -3
- package/dist/src/mcp/handlers/helpers.d.ts.map +1 -1
- package/dist/src/mcp/handlers/helpers.js +21 -176
- package/dist/src/mcp/handlers/helpers.js.map +1 -1
- package/dist/src/mcp/handlers/index.d.ts.map +1 -1
- package/dist/src/mcp/handlers/index.js +11 -0
- package/dist/src/mcp/handlers/index.js.map +1 -1
- package/dist/src/mcp/handlers/network.d.ts +95 -12
- package/dist/src/mcp/handlers/network.d.ts.map +1 -1
- package/dist/src/mcp/handlers/network.js +73 -48
- package/dist/src/mcp/handlers/network.js.map +1 -1
- package/dist/src/mcp/handlers/utility-handlers.d.ts +47 -18
- package/dist/src/mcp/handlers/utility-handlers.d.ts.map +1 -1
- package/dist/src/mcp/handlers/utility-handlers.js +79 -70
- package/dist/src/mcp/handlers/utility-handlers.js.map +1 -1
- package/dist/src/mcp/handlers/vision.d.ts +143 -41
- package/dist/src/mcp/handlers/vision.d.ts.map +1 -1
- package/dist/src/mcp/handlers/vision.js +148 -76
- package/dist/src/mcp/handlers/vision.js.map +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +1 -12
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +6 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/shared/colors.d.ts +12 -0
- package/dist/src/shared/colors.d.ts.map +1 -0
- package/dist/src/shared/colors.js +15 -0
- package/dist/src/shared/colors.js.map +1 -0
- package/dist/src/shared/lib-core.d.ts +17 -0
- package/dist/src/shared/lib-core.d.ts.map +1 -0
- package/dist/src/shared/lib-core.js +421 -0
- package/dist/src/shared/lib-core.js.map +1 -0
- package/dist/src/shared/tools.d.ts.map +1 -1
- package/dist/src/shared/tools.js +64 -49
- package/dist/src/shared/tools.js.map +1 -1
- package/dist/test/cjs/test.js +61 -104
- package/dist/test/cjs/test.js.map +1 -1
- package/dist/test/mcp/smoke-test.d.ts +1 -1
- package/dist/test/mcp/smoke-test.d.ts.map +1 -1
- package/dist/test/mcp/smoke-test.js +8 -2
- package/dist/test/mcp/smoke-test.js.map +1 -1
- package/lib/esm/index.mjs +2 -396
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -1,398 +1,4 @@
|
|
|
1
|
-
import { chromium } from "patchright";
|
|
2
|
-
import { createCursor } from "ghost-cursor-patchright";
|
|
3
|
-
import { PlaywrightBlocker } from "@ghostery/adblocker-playwright";
|
|
4
1
|
import { pageController } from "./module/pageController.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import * as fs from 'fs';
|
|
7
|
-
import * as path from 'path';
|
|
8
|
-
import { execSync } from 'child_process';
|
|
2
|
+
import { createConnect } from "../../dist/src/shared/lib-core.js";
|
|
9
3
|
|
|
10
|
-
const
|
|
11
|
-
const __dirname = path.dirname(__filename);
|
|
12
|
-
|
|
13
|
-
let adBlockerInstance = null;
|
|
14
|
-
let adBlockerPromise = null;
|
|
15
|
-
function getAdBlocker() {
|
|
16
|
-
if (!adBlockerPromise) {
|
|
17
|
-
const cachePath = path.join(__dirname, 'adblocker.bin');
|
|
18
|
-
adBlockerPromise = PlaywrightBlocker.fromPrebuiltAdsAndTracking(fetch, {
|
|
19
|
-
path: cachePath,
|
|
20
|
-
read: fs.promises.readFile,
|
|
21
|
-
write: fs.promises.writeFile,
|
|
22
|
-
}).then(blocker => {
|
|
23
|
-
adBlockerInstance = blocker;
|
|
24
|
-
return blocker;
|
|
25
|
-
}).catch(err => {
|
|
26
|
-
console.error('[adblocker] Failed to initialize adblocker:', err.message);
|
|
27
|
-
return null;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return adBlockerPromise;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function loadEnvFile() {
|
|
34
|
-
const envPaths = [
|
|
35
|
-
path.join(process.cwd(), '.env'),
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
let currentDir = process.cwd();
|
|
39
|
-
for (let i = 0; i < 5; i++) {
|
|
40
|
-
const envPath = path.join(currentDir, '.env');
|
|
41
|
-
if (fs.existsSync(envPath) && !envPaths.includes(envPath)) {
|
|
42
|
-
envPaths.push(envPath);
|
|
43
|
-
}
|
|
44
|
-
const parentDir = path.dirname(currentDir);
|
|
45
|
-
if (parentDir === currentDir) break;
|
|
46
|
-
currentDir = parentDir;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
for (const envPath of envPaths) {
|
|
50
|
-
try {
|
|
51
|
-
if (fs.existsSync(envPath)) {
|
|
52
|
-
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
53
|
-
envContent.split('\n').forEach(line => {
|
|
54
|
-
const trimmed = line.trim();
|
|
55
|
-
if (trimmed && !trimmed.startsWith('#')) {
|
|
56
|
-
const [key, ...valueParts] = trimmed.split('=');
|
|
57
|
-
const value = valueParts.join('=').replace(/^["']|["']$/g, '');
|
|
58
|
-
if (key && !process.env[key]) {
|
|
59
|
-
process.env[key] = value;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
// Silently ignore .env loading errors
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
loadEnvFile();
|
|
72
|
-
|
|
73
|
-
function getDefaultHeadless() {
|
|
74
|
-
const envHeadless = process.env.HEADLESS;
|
|
75
|
-
if (envHeadless !== undefined && envHeadless !== null && envHeadless !== '') {
|
|
76
|
-
const value = envHeadless.toLowerCase().trim();
|
|
77
|
-
return value === 'true' || value === '1' || value === 'yes';
|
|
78
|
-
}
|
|
79
|
-
// Auto-detect CI environments
|
|
80
|
-
if (process.env.CI || process.env.GITHUB_ACTIONS || process.env.TRAVIS || process.env.CIRCLECI) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
// Auto-detect headless Linux environments without X11 or Wayland
|
|
84
|
-
if (process.platform === 'linux') {
|
|
85
|
-
const hasDisplay = process.env.DISPLAY || process.env.WAYLAND_DISPLAY;
|
|
86
|
-
if (!hasDisplay) {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function setupRealPage(browser, page) {
|
|
94
|
-
if (page._setupApplied) return page;
|
|
95
|
-
page._setupApplied = true;
|
|
96
|
-
|
|
97
|
-
// Enable ad blocker
|
|
98
|
-
if (adBlockerInstance) {
|
|
99
|
-
adBlockerInstance.enableBlockingInPage(page).catch(() => {});
|
|
100
|
-
} else {
|
|
101
|
-
getAdBlocker().then(blocker => {
|
|
102
|
-
if (blocker) {
|
|
103
|
-
blocker.enableBlockingInPage(page).catch(() => {});
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Human-like smooth scrolling with 60FPS Cubic Ease-Out physics
|
|
109
|
-
page.realScroll = async (deltaY, duration = 600) => {
|
|
110
|
-
try {
|
|
111
|
-
const stepDelay = 15; // ~60 FPS
|
|
112
|
-
const steps = Math.max(10, Math.floor(duration / stepDelay));
|
|
113
|
-
const easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
|
|
114
|
-
let currentScroll = 0;
|
|
115
|
-
for (let i = 1; i <= steps; i++) {
|
|
116
|
-
const t = i / steps;
|
|
117
|
-
const targetScroll = deltaY * easeOutCubic(t);
|
|
118
|
-
const diff = targetScroll - currentScroll;
|
|
119
|
-
await page.mouse.wheel(0, diff);
|
|
120
|
-
currentScroll = targetScroll;
|
|
121
|
-
await new Promise(r => setTimeout(r, stepDelay));
|
|
122
|
-
}
|
|
123
|
-
} catch (e) {
|
|
124
|
-
// Fallback to native window scroll in case of wheel errors
|
|
125
|
-
try {
|
|
126
|
-
await page.evaluate((y) => window.scrollBy({ top: y, behavior: 'smooth' }), deltaY);
|
|
127
|
-
} catch (_) {}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// Ghost Cursor integration - Bézier curve human-like mouse movement
|
|
132
|
-
try {
|
|
133
|
-
const cursor = createCursor(page);
|
|
134
|
-
page.realCursor = {
|
|
135
|
-
move: async (selector, options = {}) => {
|
|
136
|
-
try {
|
|
137
|
-
await cursor.actions.move(selector, options);
|
|
138
|
-
} catch (e) {
|
|
139
|
-
// Fallback to native hover if ghost-cursor fails
|
|
140
|
-
try { await page.hover(selector); } catch (_) {}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
page.realClick = async (selector, options = {}) => {
|
|
145
|
-
try {
|
|
146
|
-
await cursor.actions.click({ target: selector, ...options });
|
|
147
|
-
} catch (e) {
|
|
148
|
-
// Fallback to native click if ghost-cursor fails
|
|
149
|
-
await page.click(selector, options);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
} catch (e) {
|
|
153
|
-
// Fallback if ghost-cursor-patchright fails to initialize
|
|
154
|
-
if (!page.realClick) {
|
|
155
|
-
page.realClick = async (selector, options) => {
|
|
156
|
-
await page.click(selector, options);
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
if (!page.realCursor) {
|
|
160
|
-
page.realCursor = {
|
|
161
|
-
move: async (selector) => {
|
|
162
|
-
try { await page.hover(selector); } catch (_) {}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return page;
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function getBraveExecutablePath() {
|
|
173
|
-
if (process.env.BRAVE_PATH && fs.existsSync(process.env.BRAVE_PATH)) {
|
|
174
|
-
return process.env.BRAVE_PATH;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const platform = process.platform;
|
|
178
|
-
|
|
179
|
-
// Try automatic scanning via CLI / registry query
|
|
180
|
-
if (platform === 'win32') {
|
|
181
|
-
const regQueries = [
|
|
182
|
-
'reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\brave.exe" /ve',
|
|
183
|
-
'reg query "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\brave.exe" /ve',
|
|
184
|
-
'reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Clients\\StartMenuInternet\\Brave-Browser\\shell\\open\\command" /ve'
|
|
185
|
-
];
|
|
186
|
-
|
|
187
|
-
for (const cmd of regQueries) {
|
|
188
|
-
try {
|
|
189
|
-
const output = execSync(cmd, { stdio: ['ignore', 'pipe', 'ignore'] }).toString();
|
|
190
|
-
const match = output.match(/REG_SZ\s+(.*)/);
|
|
191
|
-
if (match && match[1]) {
|
|
192
|
-
let p = match[1].trim().replace(/^"|"$/g, '');
|
|
193
|
-
if (!p.toLowerCase().endsWith('.exe')) {
|
|
194
|
-
const exeIndex = p.toLowerCase().indexOf('.exe');
|
|
195
|
-
if (exeIndex !== -1) {
|
|
196
|
-
p = p.substring(0, exeIndex + 4).replace(/^"|"$/g, '');
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (fs.existsSync(p)) return p;
|
|
200
|
-
}
|
|
201
|
-
} catch (e) {}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
const output = execSync('where brave.exe', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim().split('\r\n')[0];
|
|
206
|
-
if (output && fs.existsSync(output)) return output;
|
|
207
|
-
} catch (e) {}
|
|
208
|
-
} else if (platform === 'darwin') {
|
|
209
|
-
try {
|
|
210
|
-
const output = execSync('mdfind "kMDItemCFBundleIdentifier == \'com.brave.Browser\'"', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim().split('\n')[0];
|
|
211
|
-
if (output) {
|
|
212
|
-
const p = path.join(output, 'Contents', 'MacOS', 'Brave Browser');
|
|
213
|
-
if (fs.existsSync(p)) return p;
|
|
214
|
-
}
|
|
215
|
-
} catch (e) {}
|
|
216
|
-
} else {
|
|
217
|
-
try {
|
|
218
|
-
const output = execSync('which brave-browser || which brave', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
|
219
|
-
if (output && fs.existsSync(output)) return output;
|
|
220
|
-
} catch (e) {}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Fallback to hardcoded common paths
|
|
224
|
-
let paths = [];
|
|
225
|
-
if (platform === 'win32') {
|
|
226
|
-
paths = [
|
|
227
|
-
path.join(process.env.PROGRAMFILES || 'C:\\Program Files', 'BraveSoftware', 'Brave-Browser', 'Application', 'brave.exe'),
|
|
228
|
-
path.join(process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)', 'BraveSoftware', 'Brave-Browser', 'Application', 'brave.exe'),
|
|
229
|
-
path.join(process.env.LOCALAPPDATA || '', 'BraveSoftware', 'Brave-Browser', 'Application', 'brave.exe')
|
|
230
|
-
].filter(p => p);
|
|
231
|
-
} else if (platform === 'darwin') {
|
|
232
|
-
paths = [
|
|
233
|
-
'/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
|
|
234
|
-
];
|
|
235
|
-
} else {
|
|
236
|
-
paths = [
|
|
237
|
-
'/usr/bin/brave-browser',
|
|
238
|
-
'/usr/bin/brave',
|
|
239
|
-
'/usr/bin/brave-browser-stable',
|
|
240
|
-
'/usr/bin/brave-browser-beta',
|
|
241
|
-
'/usr/bin/brave-browser-nightly',
|
|
242
|
-
'/usr/local/bin/brave-browser',
|
|
243
|
-
'/usr/local/bin/brave'
|
|
244
|
-
];
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
for (const p of paths) {
|
|
248
|
-
if (p && fs.existsSync(p)) {
|
|
249
|
-
return p;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
async function applyUserAgentOverride(page, userAgent, userAgentMetadata) {
|
|
257
|
-
try {
|
|
258
|
-
const client = await page.context().newCDPSession(page);
|
|
259
|
-
await client.send('Emulation.setUserAgentOverride', {
|
|
260
|
-
userAgent: userAgent,
|
|
261
|
-
userAgentMetadata: userAgentMetadata
|
|
262
|
-
});
|
|
263
|
-
} catch (e) {
|
|
264
|
-
// Ignore errors
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export async function connect({
|
|
269
|
-
args = [],
|
|
270
|
-
headless = getDefaultHeadless(),
|
|
271
|
-
proxy = {},
|
|
272
|
-
turnstile = false,
|
|
273
|
-
executablePath = undefined,
|
|
274
|
-
} = {}) {
|
|
275
|
-
let playwrightProxy = undefined;
|
|
276
|
-
if (proxy && proxy.host && proxy.port) {
|
|
277
|
-
playwrightProxy = {
|
|
278
|
-
server: `${proxy.host}:${proxy.port}`
|
|
279
|
-
};
|
|
280
|
-
if (proxy.username && proxy.password) {
|
|
281
|
-
playwrightProxy.username = proxy.username;
|
|
282
|
-
playwrightProxy.password = proxy.password;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// 1. Launch a temporary browser to retrieve the native user agent and properties
|
|
287
|
-
const tempBrowser = await chromium.launch({
|
|
288
|
-
headless: true,
|
|
289
|
-
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
|
290
|
-
...(executablePath ? { executablePath } : {}),
|
|
291
|
-
});
|
|
292
|
-
const tempContext = await tempBrowser.newContext();
|
|
293
|
-
const tempPage = await tempContext.newPage();
|
|
294
|
-
let nativeUa = '';
|
|
295
|
-
let isBrave = false;
|
|
296
|
-
try {
|
|
297
|
-
nativeUa = await tempPage.evaluate(() => navigator.userAgent);
|
|
298
|
-
isBrave = await tempPage.evaluate(() => typeof navigator.brave !== 'undefined');
|
|
299
|
-
} catch (e) {
|
|
300
|
-
nativeUa = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/148.0.0.0 Safari/537.36';
|
|
301
|
-
isBrave = executablePath && executablePath.toLowerCase().includes('brave');
|
|
302
|
-
}
|
|
303
|
-
await tempBrowser.close();
|
|
304
|
-
|
|
305
|
-
let modifiedUa = nativeUa.replace(/HeadlessChrome\//g, 'Chrome/');
|
|
306
|
-
const chromeVersionMatch = modifiedUa.match(/Chrome\/([\d.]+)/);
|
|
307
|
-
const chromeVersion = chromeVersionMatch ? chromeVersionMatch[1] : '148.0.0.0';
|
|
308
|
-
const majorVersion = chromeVersion.split('.')[0];
|
|
309
|
-
|
|
310
|
-
const brands = [
|
|
311
|
-
{ brand: 'Chromium', version: majorVersion },
|
|
312
|
-
{ brand: 'Not/A)Brand', version: '99' }
|
|
313
|
-
];
|
|
314
|
-
if (isBrave) {
|
|
315
|
-
brands.unshift({ brand: 'Brave', version: majorVersion });
|
|
316
|
-
} else {
|
|
317
|
-
brands.unshift({ brand: 'Google Chrome', version: majorVersion });
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
let platformName = 'Windows';
|
|
321
|
-
if (nativeUa.includes('Macintosh') || nativeUa.includes('Mac OS X')) {
|
|
322
|
-
platformName = 'macOS';
|
|
323
|
-
} else if (nativeUa.includes('Linux')) {
|
|
324
|
-
platformName = 'Linux';
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
const userAgentMetadata = {
|
|
328
|
-
brands: brands,
|
|
329
|
-
mobile: false,
|
|
330
|
-
platform: platformName,
|
|
331
|
-
platformVersion: platformName === 'macOS' ? '14.0.0' : platformName === 'Linux' ? '6.0.0' : '10.0.0',
|
|
332
|
-
architecture: 'x86',
|
|
333
|
-
model: '',
|
|
334
|
-
bitness: '64',
|
|
335
|
-
wow64: false
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const chromiumArgs = [
|
|
339
|
-
`--user-agent=${modifiedUa}`,
|
|
340
|
-
'--disable-blink-features=AutomationControlled',
|
|
341
|
-
'--no-sandbox',
|
|
342
|
-
'--disable-setuid-sandbox',
|
|
343
|
-
...args
|
|
344
|
-
];
|
|
345
|
-
|
|
346
|
-
// If headless is true, we run with headless: false but pass '--headless=new' to args.
|
|
347
|
-
// This triggers Chromium's modern undetected headless mode instead of Playwright's default old headless shell.
|
|
348
|
-
let launchHeadless = headless;
|
|
349
|
-
if (headless === true) {
|
|
350
|
-
launchHeadless = false;
|
|
351
|
-
if (!chromiumArgs.includes('--headless=new')) {
|
|
352
|
-
chromiumArgs.push('--headless=new');
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
const browser = await chromium.launch({
|
|
357
|
-
headless: launchHeadless,
|
|
358
|
-
args: chromiumArgs,
|
|
359
|
-
proxy: playwrightProxy,
|
|
360
|
-
...(executablePath ? { executablePath } : {}),
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
// Ensure ad blocker is ready
|
|
364
|
-
await getAdBlocker();
|
|
365
|
-
|
|
366
|
-
const context = await browser.newContext({
|
|
367
|
-
viewport: null,
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
let page = await context.newPage();
|
|
371
|
-
|
|
372
|
-
await applyUserAgentOverride(page, modifiedUa, userAgentMetadata);
|
|
373
|
-
|
|
374
|
-
setupRealPage(browser, page);
|
|
375
|
-
|
|
376
|
-
page = await pageController({
|
|
377
|
-
browser,
|
|
378
|
-
page,
|
|
379
|
-
proxy,
|
|
380
|
-
turnstile,
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
context.on('page', async (newPage) => {
|
|
384
|
-
await applyUserAgentOverride(newPage, modifiedUa, userAgentMetadata);
|
|
385
|
-
setupRealPage(browser, newPage);
|
|
386
|
-
await pageController({
|
|
387
|
-
browser,
|
|
388
|
-
page: newPage,
|
|
389
|
-
proxy,
|
|
390
|
-
turnstile,
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
return {
|
|
395
|
-
browser,
|
|
396
|
-
page,
|
|
397
|
-
};
|
|
398
|
-
}
|
|
4
|
+
export const connect = createConnect(pageController);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "real-browser-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "MCP Server for Real Browser - Patchright (undetected Playwright fork) with Stealth Mode, Ad Blocker, and Turnstile Auto-Solver for undetectable web automation.",
|
|
5
5
|
"main": "dist/lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.mjs",
|