brave-real-browser-mcp-server 2.23.6 → 2.23.8
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
CHANGED
|
@@ -63,7 +63,7 @@ handleM3u8Parser, handleCookieManager,
|
|
|
63
63
|
// Download tools
|
|
64
64
|
handleFileDownloader,
|
|
65
65
|
// Enhanced streaming/download tools
|
|
66
|
-
handleIframeHandler,
|
|
66
|
+
handleIframeHandler, handleStreamExtractor, } from './handlers/advanced-tools.js';
|
|
67
67
|
// State for video recording
|
|
68
68
|
const recorderState = new Map();
|
|
69
69
|
debug('All modules loaded successfully');
|
|
@@ -259,10 +259,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
259
259
|
if (!page)
|
|
260
260
|
throw new Error('Browser not initialized. Call browser_init first.');
|
|
261
261
|
return { content: [{ type: 'text', text: JSON.stringify(await handleIframeHandler(page, args)) }] };
|
|
262
|
-
case TOOL_NAMES.POPUP_HANDLER:
|
|
263
|
-
if (!page)
|
|
264
|
-
throw new Error('Browser not initialized. Call browser_init first.');
|
|
265
|
-
return { content: [{ type: 'text', text: JSON.stringify(await handlePopupHandler(page, args)) }] };
|
|
266
262
|
case TOOL_NAMES.STREAM_EXTRACTOR:
|
|
267
263
|
if (!page)
|
|
268
264
|
throw new Error('Browser not initialized. Call browser_init first.');
|
|
@@ -323,15 +323,6 @@ const TOOL_DEFINITIONS = {
|
|
|
323
323
|
{ name: 'selector', type: 'string', description: 'CSS selector of target iframe', required: false },
|
|
324
324
|
],
|
|
325
325
|
},
|
|
326
|
-
popup_handler: {
|
|
327
|
-
name: 'popup_handler',
|
|
328
|
-
description: 'Handle popups, new tabs, and ad overlays during navigation',
|
|
329
|
-
category: 'Advanced',
|
|
330
|
-
parameters: [
|
|
331
|
-
{ name: 'action', type: 'string', description: 'Popup handling action', required: false, enum: ['block', 'allow', 'close', 'switch', 'list', 'closeAll'] },
|
|
332
|
-
{ name: 'autoCloseAds', type: 'boolean', description: 'Automatically close detected ad popups', required: false, default: true },
|
|
333
|
-
],
|
|
334
|
-
},
|
|
335
326
|
};
|
|
336
327
|
// ============================================================
|
|
337
328
|
// LSP SERVER
|
|
@@ -164,6 +164,18 @@ export class SelfHealingLocators {
|
|
|
164
164
|
catch (error) {
|
|
165
165
|
// Continue to fallbacks
|
|
166
166
|
}
|
|
167
|
+
// 💡 NEW: Try to interpret the selector as direct text content
|
|
168
|
+
// This allows users to pass "Submit" or "Download" and have it work "smoothly"
|
|
169
|
+
if (!primarySelector.includes('[') && !primarySelector.includes('#') && !primarySelector.includes('.')) {
|
|
170
|
+
const textElement = await this.findByText(pageInstance, primarySelector);
|
|
171
|
+
if (textElement) {
|
|
172
|
+
return {
|
|
173
|
+
element: textElement,
|
|
174
|
+
usedSelector: `//*[text()[contains(., "${primarySelector}")]]`,
|
|
175
|
+
strategy: 'implicit-text-match'
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
167
179
|
// Generate and try fallback selectors
|
|
168
180
|
const fallbacks = await this.generateFallbacks(pageInstance, primarySelector, expectedText);
|
|
169
181
|
for (const fallback of fallbacks) {
|
package/dist/tool-definitions.js
CHANGED
|
@@ -149,7 +149,7 @@ export const TOOLS = [
|
|
|
149
149
|
properties: {
|
|
150
150
|
selector: {
|
|
151
151
|
type: 'string',
|
|
152
|
-
description: 'CSS selector of element to click',
|
|
152
|
+
description: 'CSS selector of element to click. Also supports direct text content (e.g., "Download") for AI convenience.',
|
|
153
153
|
},
|
|
154
154
|
waitForNavigation: {
|
|
155
155
|
type: 'boolean',
|
|
@@ -626,21 +626,6 @@ export const TOOLS = [
|
|
|
626
626
|
},
|
|
627
627
|
},
|
|
628
628
|
},
|
|
629
|
-
{
|
|
630
|
-
name: 'popup_handler',
|
|
631
|
-
description: 'Handle popups, new tabs, and ad overlays during navigation',
|
|
632
|
-
inputSchema: {
|
|
633
|
-
type: 'object',
|
|
634
|
-
additionalProperties: false,
|
|
635
|
-
properties: {
|
|
636
|
-
action: { type: 'string', enum: ['block', 'allow', 'close', 'switch', 'list', 'closeAll'], description: 'Popup handling action' },
|
|
637
|
-
autoCloseAds: { type: 'boolean', description: 'Automatically close detected ad popups', default: true },
|
|
638
|
-
waitForTarget: { type: 'boolean', description: 'Wait for new tab/popup to open', default: false },
|
|
639
|
-
targetIndex: { type: 'number', description: 'Index of tab to switch to' },
|
|
640
|
-
timeout: { type: 'number', description: 'Timeout for waiting operations in ms', default: 10000 },
|
|
641
|
-
},
|
|
642
|
-
},
|
|
643
|
-
},
|
|
644
629
|
{
|
|
645
630
|
name: 'stream_extractor',
|
|
646
631
|
description: 'Master tool: Extract direct download/stream URLs from any page with automatic redirect following, countdown waiting, and format detection',
|
|
@@ -698,7 +683,6 @@ export const TOOL_NAMES = {
|
|
|
698
683
|
FILE_DOWNLOADER: 'file_downloader',
|
|
699
684
|
// Enhanced tools
|
|
700
685
|
IFRAME_HANDLER: 'iframe_handler',
|
|
701
|
-
POPUP_HANDLER: 'popup_handler',
|
|
702
686
|
STREAM_EXTRACTOR: 'stream_extractor',
|
|
703
687
|
};
|
|
704
688
|
// Tool categories for organization
|
package/dist/unified-server.js
CHANGED
|
@@ -536,7 +536,6 @@ async function main() {
|
|
|
536
536
|
console.error(' 🍪 cookie_manager - Manage cookies');
|
|
537
537
|
console.error(' 📥 file_downloader - Download files');
|
|
538
538
|
console.error(' 🖼️ iframe_handler - Handle iframes');
|
|
539
|
-
console.error(' 🚫 popup_handler - Handle popups/ads');
|
|
540
539
|
console.error('');
|
|
541
540
|
console.error('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
542
541
|
console.error('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brave-real-browser-mcp-server",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.8",
|
|
4
4
|
"description": "🦁 MCP server for Brave Real Browser - NPM Workspaces Monorepo with anti-detection features, SSE streaming, and LSP compatibility",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@modelcontextprotocol/sdk": "latest",
|
|
52
52
|
"@types/turndown": "latest",
|
|
53
|
-
"brave-real-browser": "^2.4.
|
|
53
|
+
"brave-real-browser": "^2.4.8",
|
|
54
54
|
"turndown": "latest",
|
|
55
55
|
"vscode-languageserver": "^9.0.1",
|
|
56
56
|
"vscode-languageserver-textdocument": "^1.0.12"
|