brave-real-browser-mcp-server 2.11.0 → 2.11.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.
@@ -14,7 +14,7 @@ export async function handleAdvancedVideoExtraction(args) {
14
14
  requirePage: true,
15
15
  });
16
16
  const page = getCurrentPage();
17
- const waitTime = args.waitTime || 10000;
17
+ const waitTime = args.waitTime || 20000;
18
18
  // Collect all video-related data
19
19
  const videoData = {
20
20
  directVideoUrls: [],
@@ -183,7 +183,11 @@ export async function handleAdvancedVideoExtraction(args) {
183
183
  'button[data-download]',
184
184
  'a[href*=".mp4"]',
185
185
  'a[href*=".mkv"]',
186
- 'a[class*="download"]'
186
+ 'a[class*="download"]',
187
+ 'a[href*=".webm"]',
188
+ '.download-btn',
189
+ '.btn-download',
190
+ '[class*="download"]'
187
191
  ];
188
192
  downloadSelectors.forEach(selector => {
189
193
  document.querySelectorAll(selector).forEach((el) => {
@@ -6,7 +6,7 @@ import { sleep } from '../system-utils.js';
6
6
  * REST API Endpoint Finder - Discover REST API endpoints
7
7
  */
8
8
  export async function handleRESTAPIEndpointFinder(args) {
9
- const { url, analyzeNetworkRequests = true, scanDuration = 5000 } = args;
9
+ const { url, analyzeNetworkRequests = true, scanDuration = 10000 } = args;
10
10
  try {
11
11
  const page = getPageInstance();
12
12
  if (!page) {
@@ -195,7 +195,8 @@ export async function handleExtractJSON(args) {
195
195
  const results = [];
196
196
  // Extract JSON from script tags
197
197
  if (source === 'script' || source === 'all') {
198
- const scripts = document.querySelectorAll('script[type="application/json"], script[type="application/ld+json"]');
198
+ const defaultSelector = selector || 'script[type="application/json"], script[type="application/ld+json"], script';
199
+ const scripts = document.querySelectorAll(defaultSelector);
199
200
  scripts.forEach((script, index) => {
200
201
  try {
201
202
  const content = script.textContent || '';
@@ -346,7 +347,7 @@ export async function handleExtractSchema(args) {
346
347
  });
347
348
  const page = getCurrentPage();
348
349
  const format = args.format || 'all';
349
- const schemaType = args.schemaType;
350
+ const schemaType = args.schemaType || ['WebPage', 'Organization', 'Product', 'BreadcrumbList'];
350
351
  const schemaData = await page.evaluate(({ format, schemaType }) => {
351
352
  const results = [];
352
353
  // Extract JSON-LD
@@ -358,7 +359,9 @@ export async function handleExtractSchema(args) {
358
359
  // Filter by schema type if specified
359
360
  if (schemaType) {
360
361
  const type = data['@type'] || '';
361
- if (!type.toLowerCase().includes(schemaType.toLowerCase())) {
362
+ const types = Array.isArray(schemaType) ? schemaType : [schemaType];
363
+ const typeMatch = types.some(t => type.toLowerCase().includes(t.toLowerCase()));
364
+ if (!typeMatch) {
362
365
  return;
363
366
  }
364
367
  }
@@ -378,8 +381,12 @@ export async function handleExtractSchema(args) {
378
381
  const items = document.querySelectorAll('[itemscope]');
379
382
  items.forEach((item) => {
380
383
  const itemType = item.getAttribute('itemtype') || '';
381
- if (schemaType && !itemType.toLowerCase().includes(schemaType.toLowerCase())) {
382
- return;
384
+ if (schemaType) {
385
+ const types = Array.isArray(schemaType) ? schemaType : [schemaType];
386
+ const typeMatch = types.some(t => itemType.toLowerCase().includes(t.toLowerCase()));
387
+ if (!typeMatch) {
388
+ return;
389
+ }
383
390
  }
384
391
  const properties = {};
385
392
  const props = item.querySelectorAll('[itemprop]');
@@ -184,7 +184,7 @@ export async function handleAjaxExtractor(args) {
184
184
  requirePage: true,
185
185
  });
186
186
  const page = getCurrentPage();
187
- const duration = args.duration || 5000;
187
+ const duration = args.duration || 15000;
188
188
  const url = args.url;
189
189
  const requests = [];
190
190
  const requestHandler = (request) => {
@@ -223,7 +223,7 @@ export async function handleFetchXHR(args) {
223
223
  requirePage: true,
224
224
  });
225
225
  const page = getCurrentPage();
226
- const duration = args.duration || 5000;
226
+ const duration = args.duration || 15000;
227
227
  const xhrData = [];
228
228
  const responseHandler = async (response) => {
229
229
  const request = response.request();
@@ -267,8 +267,8 @@ export async function handleNetworkRecorder(args) {
267
267
  requirePage: true,
268
268
  });
269
269
  const page = getCurrentPage();
270
- const duration = args.duration || 10000;
271
- const filterTypes = args.filterTypes || ['all'];
270
+ const duration = args.duration || 20000;
271
+ const filterTypes = args.filterTypes || ['video', 'xhr', 'fetch', 'media'];
272
272
  const networkActivity = [];
273
273
  const requestHandler = (request) => {
274
274
  const resourceType = request.resourceType();
@@ -317,13 +317,16 @@ export async function handleApiFinder(args) {
317
317
  requirePage: true,
318
318
  });
319
319
  const page = getCurrentPage();
320
- const apis = await page.evaluate(() => {
320
+ const deepScan = args.deepScan !== false;
321
+ const apis = await page.evaluate(({ deepScan }) => {
321
322
  const results = [];
322
323
  const scripts = Array.from(document.querySelectorAll('script'));
323
324
  const apiPatterns = [
324
325
  /https?:\/\/[^"'\s]+\/api\/[^"'\s]*/gi,
325
326
  /https?:\/\/api\.[^"'\s]+/gi,
326
327
  /\/api\/v?\d*\/[^"'\s]*/gi,
328
+ /graphql/gi,
329
+ /rest\/v?\d*/gi,
327
330
  ];
328
331
  scripts.forEach(script => {
329
332
  const content = script.textContent || '';
@@ -337,8 +340,21 @@ export async function handleApiFinder(args) {
337
340
  }
338
341
  });
339
342
  });
343
+ // Deep scan: also check HTML content for API references
344
+ if (deepScan) {
345
+ const htmlContent = document.body.innerHTML;
346
+ apiPatterns.forEach(pattern => {
347
+ const matches = htmlContent.match(pattern);
348
+ if (matches) {
349
+ matches.forEach(match => results.push({
350
+ url: match,
351
+ source: 'html_content',
352
+ }));
353
+ }
354
+ });
355
+ }
340
356
  return [...new Set(results.map(r => r.url))].map(url => ({ url, source: 'script' }));
341
- });
357
+ }, { deepScan });
342
358
  return {
343
359
  content: [{
344
360
  type: 'text',
@@ -942,7 +942,7 @@ export const TOOLS = [
942
942
  properties: {
943
943
  url: { type: 'string' },
944
944
  analyzeNetworkRequests: { type: 'boolean', default: true },
945
- scanDuration: { type: 'number', default: 5000 },
945
+ scanDuration: { type: 'number', default: 10000 },
946
946
  },
947
947
  },
948
948
  },
@@ -1024,7 +1024,7 @@ export const TOOLS = [
1024
1024
  inputSchema: {
1025
1025
  type: 'object',
1026
1026
  properties: {
1027
- duration: { type: 'number', default: 5000 },
1027
+ duration: { type: 'number', default: 15000 },
1028
1028
  url: { type: 'string' },
1029
1029
  },
1030
1030
  },
@@ -1035,7 +1035,7 @@ export const TOOLS = [
1035
1035
  inputSchema: {
1036
1036
  type: 'object',
1037
1037
  properties: {
1038
- duration: { type: 'number', default: 5000 },
1038
+ duration: { type: 'number', default: 15000 },
1039
1039
  },
1040
1040
  },
1041
1041
  },
@@ -1045,8 +1045,8 @@ export const TOOLS = [
1045
1045
  inputSchema: {
1046
1046
  type: 'object',
1047
1047
  properties: {
1048
- duration: { type: 'number', default: 10000 },
1049
- filterTypes: { type: 'array', items: { type: 'string' }, default: ['all'] },
1048
+ duration: { type: 'number', default: 20000 },
1049
+ filterTypes: { type: 'array', items: { type: 'string' }, default: ['video', 'xhr', 'fetch', 'media'] },
1050
1050
  },
1051
1051
  },
1052
1052
  },
@@ -1055,7 +1055,9 @@ export const TOOLS = [
1055
1055
  description: 'Discover API endpoints on page',
1056
1056
  inputSchema: {
1057
1057
  type: 'object',
1058
- properties: {},
1058
+ properties: {
1059
+ deepScan: { type: 'boolean', default: true },
1060
+ },
1059
1061
  },
1060
1062
  },
1061
1063
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser-mcp-server",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "MCP server for brave-real-browser",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",