brave-real-browser-mcp-server 2.19.20 → 2.20.0

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.
@@ -22,7 +22,9 @@ export async function handleNavigate(args) {
22
22
  waitUntil: waitUntil,
23
23
  timeout: 60000
24
24
  });
25
- }, 60000, 'page-navigation');
25
+ // Auto-handle Cloudflare challenges if detected
26
+ await waitForCloudflareBypass(pageInstance);
27
+ }, 90000, 'page-navigation');
26
28
  // console.(`✅ Navigation successful to: ${url}`);
27
29
  success = true;
28
30
  break;
@@ -143,3 +145,30 @@ async function withWorkflowValidation(toolName, args, operation) {
143
145
  throw error;
144
146
  }
145
147
  }
148
+ /**
149
+ * Helper to wait for Cloudflare/Turnstile challenges to resolve
150
+ */
151
+ async function waitForCloudflareBypass(pageInstance) {
152
+ try {
153
+ // Initial stable wait
154
+ await new Promise(resolve => setTimeout(resolve, 2000));
155
+ const maxWait = 40000;
156
+ const startTime = Date.now();
157
+ while (Date.now() - startTime < maxWait) {
158
+ const isChallenge = await pageInstance.evaluate(() => {
159
+ const bodyText = (document.body?.innerText || '').toLowerCase();
160
+ // Strict checks to avoid false positives on normal sites
161
+ return bodyText.includes('verifying you are human') ||
162
+ bodyText.includes('checking your browser before accessing');
163
+ });
164
+ if (!isChallenge) {
165
+ return; // Not a challenge page, or passed
166
+ }
167
+ // Still blocked, wait
168
+ await new Promise(resolve => setTimeout(resolve, 1000));
169
+ }
170
+ }
171
+ catch (error) {
172
+ // Ignore bypass errors, continue to result
173
+ }
174
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser-mcp-server",
3
- "version": "2.19.20",
3
+ "version": "2.20.0",
4
4
  "description": "🦁 MCP server for Brave Real Browser - NPM Workspaces Monorepo with anti-detection features",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@modelcontextprotocol/sdk": "latest",
41
41
  "@types/turndown": "latest",
42
- "brave-real-browser": "^2.1.20",
42
+ "brave-real-browser": "^2.2.0",
43
43
  "turndown": "latest"
44
44
  },
45
45
  "peerDependencies": {