brave-real-browser-mcp-server 2.41.5 → 2.41.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser-mcp-server",
3
- "version": "2.41.5",
3
+ "version": "2.41.7",
4
4
  "description": "MCP Server for Brave Real Browser - Puppeteer with Brave Browser, Stealth Mode, Ad Blocker, and Turnstile Auto-Solver for undetectable web automation.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.mjs",
@@ -8,8 +8,7 @@
8
8
  "workspaces": [
9
9
  "packages/brave-real-blocker",
10
10
  "packages/brave-real-launcher",
11
- "packages/brave-real-puppeteer-core",
12
- "packages/brave-real-playwright-core"
11
+ "packages/brave-real-puppeteer-core"
13
12
  ],
14
13
  "exports": {
15
14
  ".": {
@@ -75,7 +74,7 @@
75
74
  "license": "ISC",
76
75
  "dependencies": {
77
76
  "@modelcontextprotocol/sdk": "^1.25.3",
78
- "brave-real-puppeteer-core": "^24.37.1-brave.4",
77
+ "brave-real-puppeteer-core": "^24.37.1-brave.6",
79
78
  "ghost-cursor": "^1.4.2",
80
79
  "puppeteer-extra": "^3.3.6",
81
80
  "puppeteer-extra-plugin-stealth": "^2.11.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-blocker",
3
- "version": "1.17.5",
3
+ "version": "1.17.7",
4
4
  "description": "Advanced uBlock Origin management and stealth features for Brave Real Browser",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -64,7 +64,7 @@
64
64
  "@types/adm-zip": "^0.5.5",
65
65
  "@types/fs-extra": "^11.0.4",
66
66
  "@types/node": "^20.0.0",
67
- "brave-real-puppeteer-core": "^24.37.1-brave.4",
67
+ "brave-real-puppeteer-core": "^24.37.1-brave.6",
68
68
  "mocha": "^10.4.0",
69
69
  "puppeteer-core": ">=24.0.0",
70
70
  "sinon": "^17.0.1",
@@ -104,7 +104,7 @@ export class BraveBlocker {
104
104
 
105
105
  constructor(options: BraveBlockerOptions = {}) {
106
106
  this.options = options;
107
-
107
+
108
108
  // Initialize filter updater if auto-update is enabled (default: true)
109
109
  if (this.options.enableFilterAutoUpdate !== false) {
110
110
  this.filterUpdater = getFilterUpdater({
@@ -119,26 +119,26 @@ export class BraveBlocker {
119
119
  */
120
120
  async init() {
121
121
  if (this.initialized) return;
122
-
122
+
123
123
  try {
124
124
  // Start with prebuilt lists as base
125
125
  this.blocker = await PuppeteerBlocker.fromPrebuiltAdsAndTracking(fetch);
126
-
126
+
127
127
  // Collect additional filter strings
128
128
  let additionalFilters = BUILTIN_CUSTOM_FILTERS;
129
-
129
+
130
130
  // Try to fetch latest filters using FilterUpdater (auto-update from uBlock Origin)
131
131
  if (this.filterUpdater) {
132
132
  try {
133
- console.log('[BraveBlocker] Fetching latest uBlock Origin filters...');
133
+ console.error('[BraveBlocker] Fetching latest uBlock Origin filters...');
134
134
  const latestFilters = await this.filterUpdater.getFilters();
135
-
135
+
136
136
  if (latestFilters && latestFilters.length > 0) {
137
137
  additionalFilters += '\n' + latestFilters;
138
-
138
+
139
139
  const cacheInfo = this.filterUpdater.getCacheInfo();
140
- console.log('[BraveBlocker] Loaded latest uBlock Origin filters');
141
- console.log('[BraveBlocker] Cache expires:', cacheInfo.expiresAt?.toISOString());
140
+ console.error('[BraveBlocker] Loaded latest uBlock Origin filters');
141
+ console.error('[BraveBlocker] Cache expires:', cacheInfo.expiresAt?.toISOString());
142
142
  }
143
143
  } catch (filterError) {
144
144
  console.warn('[BraveBlocker] Failed to fetch latest filters:', (filterError as Error).message);
@@ -149,19 +149,19 @@ export class BraveBlocker {
149
149
  // No filter updater, use local custom filters only
150
150
  additionalFilters += '\n' + this.loadLocalCustomFiltersString();
151
151
  }
152
-
152
+
153
153
  // Parse additional filters and enable them separately
154
154
  // Note: We keep prebuilt as base and parse custom separately to avoid conflicts
155
155
  try {
156
156
  const customBlocker = await PuppeteerBlocker.parse(additionalFilters);
157
157
  // Store for later reference but don't try to merge serialized data
158
- console.log('[BraveBlocker] Parsed additional filters successfully');
158
+ console.error('[BraveBlocker] Parsed additional filters successfully');
159
159
  } catch (parseError) {
160
160
  console.warn('[BraveBlocker] Failed to parse additional filters:', (parseError as Error).message);
161
161
  }
162
-
162
+
163
163
  this.initialized = true;
164
- console.log('[BraveBlocker] Initialized with ad blocking engine');
164
+ console.error('[BraveBlocker] Initialized with ad blocking engine');
165
165
  } catch (e) {
166
166
  console.error('[BraveBlocker] Failed to initialize:', e);
167
167
  // Fallback to basic blocker
@@ -169,18 +169,18 @@ export class BraveBlocker {
169
169
  this.initialized = true;
170
170
  }
171
171
  }
172
-
172
+
173
173
  /**
174
174
  * Load local custom filters as string
175
175
  */
176
176
  private loadLocalCustomFiltersString(): string {
177
- const customFiltersPath = this.options.customFiltersPath ||
177
+ const customFiltersPath = this.options.customFiltersPath ||
178
178
  path.join(currentDir, '..', 'assets', 'ublock-custom-filters.txt');
179
-
179
+
180
180
  try {
181
181
  if (fs.existsSync(customFiltersPath)) {
182
182
  const content = fs.readFileSync(customFiltersPath, 'utf-8');
183
- console.log('[BraveBlocker] Loaded custom filters from:', customFiltersPath);
183
+ console.error('[BraveBlocker] Loaded custom filters from:', customFiltersPath);
184
184
  return content;
185
185
  }
186
186
  } catch (e) {
@@ -231,10 +231,10 @@ export class BraveBlocker {
231
231
  if (opts.enableRedirectBlocking) {
232
232
  await injectRedirectBlocking(page);
233
233
  }
234
-
235
- console.log('[BraveBlocker] All protections enabled for page');
234
+
235
+ console.error('[BraveBlocker] All protections enabled for page');
236
236
  }
237
-
237
+
238
238
  /**
239
239
  * Check if a URL should be blocked
240
240
  */
@@ -34,14 +34,14 @@ export const UBLOCK_FILTER_LISTS = {
34
34
  ublock_unbreak: 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt',
35
35
  ublock_quick_fixes: 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/quick-fixes.txt',
36
36
  ublock_annoyances: 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt',
37
-
37
+
38
38
  // EasyList
39
39
  easylist: 'https://easylist.to/easylist/easylist.txt',
40
40
  easyprivacy: 'https://easylist.to/easylist/easyprivacy.txt',
41
-
41
+
42
42
  // uBlock Origin scriptlets and resources
43
43
  ublock_scriptlets: 'https://raw.githubusercontent.com/AzagraMac/nicholast-adblock-list/main/nicholast-adblock-list.txt',
44
-
44
+
45
45
  // Anti-popup and anti-redirect lists
46
46
  anti_popup: 'https://raw.githubusercontent.com/nicholast/nicholast-anti-popup-list/main/nicholast-anti-popup-list.txt',
47
47
  anti_redirect: 'https://raw.githubusercontent.com/nicholast/nicholast-anti-redirect-list/main/nicholast-anti-redirect-list.txt',
@@ -82,7 +82,7 @@ const DEFAULT_OPTIONS: Required<FilterUpdaterOptions> = {
82
82
  cacheExpiry: 7 * 24 * 60 * 60 * 1000, // 7 days
83
83
  enabledLists: [
84
84
  'ublock_filters',
85
- 'ublock_badware',
85
+ 'ublock_badware',
86
86
  'ublock_privacy',
87
87
  'ublock_quick_fixes',
88
88
  'ublock_annoyances',
@@ -132,7 +132,7 @@ export class FilterUpdater {
132
132
  private saveCache(cache: FilterCache): void {
133
133
  try {
134
134
  fs.writeFileSync(this.cacheFilePath, JSON.stringify(cache, null, 2));
135
- console.log('[FilterUpdater] Cache saved successfully');
135
+ console.error('[FilterUpdater] Cache saved successfully');
136
136
  } catch (e) {
137
137
  console.error('[FilterUpdater] Failed to save cache:', e);
138
138
  }
@@ -143,16 +143,16 @@ export class FilterUpdater {
143
143
  */
144
144
  private isCacheValid(): boolean {
145
145
  if (this.options.forceUpdate) return false;
146
-
146
+
147
147
  const cache = this.loadCache();
148
148
  if (!cache) return false;
149
-
149
+
150
150
  const now = Date.now();
151
151
  if (now >= cache.expiresAt) {
152
- console.log('[FilterUpdater] Cache expired, will update');
152
+ console.error('[FilterUpdater] Cache expired, will update');
153
153
  return false;
154
154
  }
155
-
155
+
156
156
  this.cache = cache;
157
157
  return true;
158
158
  }
@@ -165,30 +165,30 @@ export class FilterUpdater {
165
165
  try {
166
166
  const controller = new AbortController();
167
167
  const timeoutId = setTimeout(() => controller.abort(), this.options.fetchTimeout);
168
-
169
- const response = await fetch(url, {
168
+
169
+ const response = await fetch(url, {
170
170
  signal: controller.signal,
171
171
  headers: {
172
172
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
173
173
  }
174
174
  });
175
-
175
+
176
176
  clearTimeout(timeoutId);
177
-
177
+
178
178
  if (!response.ok) {
179
179
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
180
180
  }
181
-
181
+
182
182
  const text = await response.text();
183
- console.log(`[FilterUpdater] Fetched ${name}: ${text.length} bytes`);
183
+ console.error(`[FilterUpdater] Fetched ${name}: ${text.length} bytes`);
184
184
  return text;
185
185
  } catch (e: any) {
186
186
  console.warn(`[FilterUpdater] Failed to fetch ${name} (attempt ${attempt + 1}):`, e.message);
187
-
187
+
188
188
  // Try backup URL if available
189
189
  const backupUrl = BACKUP_FILTER_LISTS[name as keyof typeof BACKUP_FILTER_LISTS];
190
190
  if (attempt === retries && backupUrl) {
191
- console.log(`[FilterUpdater] Trying backup URL for ${name}`);
191
+ console.error(`[FilterUpdater] Trying backup URL for ${name}`);
192
192
  try {
193
193
  const response = await fetch(backupUrl);
194
194
  if (response.ok) {
@@ -198,11 +198,11 @@ export class FilterUpdater {
198
198
  // Backup also failed
199
199
  }
200
200
  }
201
-
201
+
202
202
  if (attempt === retries) {
203
203
  return ''; // Return empty string on final failure
204
204
  }
205
-
205
+
206
206
  // Wait before retry
207
207
  await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)));
208
208
  }
@@ -217,7 +217,7 @@ export class FilterUpdater {
217
217
  try {
218
218
  if (fs.existsSync(this.options.customFiltersPath)) {
219
219
  const content = fs.readFileSync(this.options.customFiltersPath, 'utf-8');
220
- console.log(`[FilterUpdater] Loaded custom filters: ${content.length} bytes`);
220
+ console.error(`[FilterUpdater] Loaded custom filters: ${content.length} bytes`);
221
221
  return content;
222
222
  }
223
223
  } catch (e) {
@@ -230,11 +230,11 @@ export class FilterUpdater {
230
230
  * Fetch all enabled filter lists and combine them
231
231
  */
232
232
  async updateFilters(): Promise<string> {
233
- console.log('[FilterUpdater] Starting filter update...');
234
-
233
+ console.error('[FilterUpdater] Starting filter update...');
234
+
235
235
  // Check cache first
236
236
  if (this.isCacheValid() && this.cache) {
237
- console.log('[FilterUpdater] Using cached filters (valid until:', new Date(this.cache.expiresAt).toISOString(), ')');
237
+ console.error('[FilterUpdater] Using cached filters (valid until:', new Date(this.cache.expiresAt).toISOString(), ')');
238
238
  return this.cache.combinedFilters;
239
239
  }
240
240
 
@@ -277,7 +277,7 @@ export class FilterUpdater {
277
277
  this.cache = cache;
278
278
  this.saveCache(cache);
279
279
 
280
- console.log(`[FilterUpdater] Updated filters: ${combinedFilters.length} bytes total`);
280
+ console.error(`[FilterUpdater] Updated filters: ${combinedFilters.length} bytes total`);
281
281
  return combinedFilters;
282
282
  }
283
283
 
@@ -334,7 +334,7 @@ ${content}
334
334
  if (!cache) {
335
335
  return { valid: false, expiresAt: null, lastUpdated: null };
336
336
  }
337
-
337
+
338
338
  return {
339
339
  valid: Date.now() < cache.expiresAt,
340
340
  expiresAt: new Date(cache.expiresAt),
@@ -349,7 +349,7 @@ ${content}
349
349
  try {
350
350
  if (fs.existsSync(this.cacheFilePath)) {
351
351
  fs.unlinkSync(this.cacheFilePath);
352
- console.log('[FilterUpdater] Cache cleared');
352
+ console.error('[FilterUpdater] Cache cleared');
353
353
  }
354
354
  } catch (e) {
355
355
  console.error('[FilterUpdater] Failed to clear cache:', e);
@@ -38,16 +38,16 @@ if (!globalObj[SINGLETON_KEY]) {
38
38
  */
39
39
  export function getBraveBlockerSingleton(options: BraveBlockerOptions = {}): BraveBlocker {
40
40
  const storage = globalObj[SINGLETON_KEY];
41
-
41
+
42
42
  if (!storage.instance) {
43
43
  storage.instance = new BraveBlocker(options);
44
44
  storage.options = options;
45
- console.log('[BraveBlocker] Created singleton instance');
45
+ console.error('[BraveBlocker] Created singleton instance');
46
46
  } else if (Object.keys(options).length > 0 && !storage.initialized) {
47
47
  // Allow updating options before initialization
48
- console.log('[BraveBlocker] Using existing singleton (options ignored after first creation)');
48
+ console.error('[BraveBlocker] Using existing singleton (options ignored after first creation)');
49
49
  }
50
-
50
+
51
51
  return storage.instance;
52
52
  }
53
53
 
@@ -60,13 +60,13 @@ export function getBraveBlockerSingleton(options: BraveBlockerOptions = {}): Bra
60
60
  export async function initBraveBlockerSingleton(options: BraveBlockerOptions = {}): Promise<BraveBlocker> {
61
61
  const storage = globalObj[SINGLETON_KEY];
62
62
  const blocker = getBraveBlockerSingleton(options);
63
-
63
+
64
64
  if (!storage.initialized) {
65
65
  await blocker.init();
66
66
  storage.initialized = true;
67
- console.log('[BraveBlocker] Singleton initialized successfully');
67
+ console.error('[BraveBlocker] Singleton initialized successfully');
68
68
  }
69
-
69
+
70
70
  return blocker;
71
71
  }
72
72
 
@@ -87,7 +87,7 @@ export function resetBraveBlockerSingleton(): void {
87
87
  storage.instance = null;
88
88
  storage.initialized = false;
89
89
  storage.options = null;
90
- console.log('[BraveBlocker] Singleton reset');
90
+ console.error('[BraveBlocker] Singleton reset');
91
91
  }
92
92
 
93
93
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-launcher",
3
- "version": "1.23.5",
3
+ "version": "1.23.7",
4
4
  "description": "Launch Brave Browser with ease from node. Based on chrome-launcher with Brave-specific support.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -54,7 +54,7 @@
54
54
  "typescript": "^5.0.0"
55
55
  },
56
56
  "dependencies": {
57
- "brave-real-blocker": "^1.17.5",
57
+ "brave-real-blocker": "^1.17.7",
58
58
  "escape-string-regexp": "^5.0.0",
59
59
  "is-wsl": "^3.1.0",
60
60
  "which": "^6.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-playwright-core",
3
- "version": "1.59.5",
3
+ "version": "1.59.7",
4
4
  "description": "Brave-optimized Playwright Core (v1.57.0) with comprehensive stealth patches and error stack sanitization",
5
5
  "keywords": [
6
6
  "playwright",
@@ -32,7 +32,7 @@ export {
32
32
  } from 'brave-real-launcher';
33
33
 
34
34
  // Import stealth functions for easy integration
35
- import {
35
+ import {
36
36
  getComprehensiveStealthScript,
37
37
  getPuppeteerOptimizedScript,
38
38
  getPlaywrightOptimizedScript,
@@ -81,11 +81,11 @@ export async function applyStealthToPuppeteer(page, options = {}) {
81
81
  comprehensiveStealth = true,
82
82
  userAgent = null
83
83
  } = options;
84
-
84
+
85
85
  try {
86
86
  // Get CDP session
87
87
  const client = await page.target().createCDPSession();
88
-
88
+
89
89
  // Apply CDP bypasses first (before any other scripts)
90
90
  if (cdpBypasses) {
91
91
  const cdpScript = getCDPBypassScripts();
@@ -94,7 +94,7 @@ export async function applyStealthToPuppeteer(page, options = {}) {
94
94
  runImmediately: true
95
95
  });
96
96
  }
97
-
97
+
98
98
  // Apply comprehensive stealth
99
99
  if (comprehensiveStealth) {
100
100
  const stealthScript = getPuppeteerOptimizedScript(options);
@@ -103,11 +103,11 @@ export async function applyStealthToPuppeteer(page, options = {}) {
103
103
  runImmediately: true
104
104
  });
105
105
  }
106
-
106
+
107
107
  // Set user agent if provided or use dynamic
108
108
  const ua = userAgent || getDynamicUserAgent(false);
109
109
  const uaMetadata = getDynamicUserAgentMetadata(false);
110
-
110
+
111
111
  await client.send('Emulation.setUserAgentOverride', {
112
112
  userAgent: ua,
113
113
  userAgentMetadata: {
@@ -122,8 +122,8 @@ export async function applyStealthToPuppeteer(page, options = {}) {
122
122
  wow64: uaMetadata.wow64
123
123
  }
124
124
  });
125
-
126
- console.log('[brave-real-puppeteer-core] Stealth applied to Puppeteer page');
125
+
126
+ console.error('[brave-real-puppeteer-core] Stealth applied to Puppeteer page');
127
127
  return true;
128
128
  } catch (error) {
129
129
  console.error('[brave-real-puppeteer-core] Failed to apply stealth:', error.message);
@@ -149,20 +149,20 @@ export async function applyStealthToPlaywright(page, options = {}) {
149
149
  comprehensiveStealth = true,
150
150
  userAgent = null
151
151
  } = options;
152
-
152
+
153
153
  try {
154
154
  // For Playwright, use addInitScript
155
155
  if (cdpBypasses) {
156
156
  const cdpScript = getCDPBypassScripts();
157
157
  await page.addInitScript(cdpScript);
158
158
  }
159
-
159
+
160
160
  if (comprehensiveStealth) {
161
161
  const stealthScript = getPlaywrightOptimizedScript(options);
162
162
  await page.addInitScript(stealthScript);
163
163
  }
164
-
165
- console.log('[brave-real-puppeteer-core] Stealth applied to Playwright page');
164
+
165
+ console.error('[brave-real-puppeteer-core] Stealth applied to Playwright page');
166
166
  return true;
167
167
  } catch (error) {
168
168
  console.error('[brave-real-puppeteer-core] Failed to apply stealth:', error.message);
@@ -181,19 +181,19 @@ export async function applyStealthToPlaywrightContext(context, options = {}) {
181
181
  cdpBypasses = true,
182
182
  comprehensiveStealth = true
183
183
  } = options;
184
-
184
+
185
185
  try {
186
186
  if (cdpBypasses) {
187
187
  const cdpScript = getCDPBypassScripts();
188
188
  await context.addInitScript(cdpScript);
189
189
  }
190
-
190
+
191
191
  if (comprehensiveStealth) {
192
192
  const stealthScript = getPlaywrightOptimizedScript(options);
193
193
  await context.addInitScript(stealthScript);
194
194
  }
195
-
196
- console.log('[brave-real-puppeteer-core] Stealth applied to Playwright context');
195
+
196
+ console.error('[brave-real-puppeteer-core] Stealth applied to Playwright context');
197
197
  return true;
198
198
  } catch (error) {
199
199
  console.error('[brave-real-puppeteer-core] Failed to apply stealth:', error.message);
@@ -209,18 +209,18 @@ export async function applyStealthToPlaywrightContext(context, options = {}) {
209
209
  */
210
210
  export async function connectWithBlocker(options = {}, launchedBrave = null) {
211
211
  const browser = await puppeteerCore.connect(options);
212
-
212
+
213
213
  // If launchedBrave has blocker, setup ecosystem chain
214
214
  if (launchedBrave?.blocker) {
215
215
  launchedBrave.setupEcosystemChain?.(browser);
216
-
216
+
217
217
  // Enable blocker on existing pages
218
218
  const pages = await browser.pages();
219
219
  for (const page of pages) {
220
220
  await launchedBrave.enableBlockerOnPage?.(page);
221
221
  }
222
222
  }
223
-
223
+
224
224
  return {
225
225
  browser,
226
226
  blocker: launchedBrave?.blocker || null
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-puppeteer-core",
3
- "version": "24.37.1-brave.4",
3
+ "version": "24.37.1-brave.6",
4
4
  "description": "🦁 Brave Real-World Optimized Puppeteer & Playwright Core with 1-5ms ultra-fast timing, 50+ professional stealth features, intelligent browser auto-detection, and 100% bot detection bypass. Features cross-platform Brave browser integration, comprehensive anti-detection, and breakthrough performance improvements.",
5
5
  "keywords": [
6
6
  "automation",
@@ -134,7 +134,7 @@
134
134
  "test-version": "node ./scripts/test-version-management.js"
135
135
  },
136
136
  "dependencies": {
137
- "brave-real-launcher": "^1.23.5",
137
+ "brave-real-launcher": "^1.23.7",
138
138
  "get-east-asian-width": "^1.4.0",
139
139
  "yargs": "^18.0.0"
140
140
  },