brave-real-browser-mcp-server 2.8.5 → 2.8.6

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.
@@ -47,18 +47,23 @@ export async function handleOCREngine(args) {
47
47
  bbox: word.bbox
48
48
  }));
49
49
  return {
50
- success: true,
51
- text,
52
- confidence,
53
- words,
54
- lines: result.data.lines.length,
55
- language
50
+ content: [
51
+ {
52
+ type: "text",
53
+ text: `OCR Results:\n- Extracted Text: ${text}\n- Confidence: ${confidence.toFixed(2)}%\n- Words Found: ${words.length}\n- Lines: ${result.data.lines.length}\n- Language: ${language}\n\nWords Detail:\n${words.map((w) => ` "${w.text}" (confidence: ${w.confidence.toFixed(2)}%)`).join('\n')}`
54
+ }
55
+ ]
56
56
  };
57
57
  }
58
58
  catch (error) {
59
59
  return {
60
- success: false,
61
- error: error.message
60
+ content: [
61
+ {
62
+ type: "text",
63
+ text: `OCR Engine Error: ${error.message}`
64
+ }
65
+ ],
66
+ isError: true
62
67
  };
63
68
  }
64
69
  }
@@ -106,17 +111,23 @@ export async function handleAudioCaptchaSolver(args) {
106
111
  }
107
112
  }
108
113
  return {
109
- success: true,
110
- audioUrl: audioSource,
111
- downloaded,
112
- downloadPath: downloaded ? downloadPath : null,
113
- note: 'Audio captcha solving requires external speech-to-text API (Google Speech, AWS Transcribe, etc.)'
114
+ content: [
115
+ {
116
+ type: "text",
117
+ text: `Audio Captcha Analysis:\n- Audio URL: ${audioSource}\n- Downloaded: ${downloaded ? 'Yes' : 'No'}${downloaded ? `\n- Download Path: ${downloadPath}` : ''}\n\nNote: Audio captcha solving requires external speech-to-text API (Google Speech, AWS Transcribe, etc.)`
118
+ }
119
+ ]
114
120
  };
115
121
  }
116
122
  catch (error) {
117
123
  return {
118
- success: false,
119
- error: error.message
124
+ content: [
125
+ {
126
+ type: "text",
127
+ text: `Audio Captcha Solver Error: ${error.message}`
128
+ }
129
+ ],
130
+ isError: true
120
131
  };
121
132
  }
122
133
  }
@@ -208,16 +219,38 @@ export async function handlePuzzleCaptchaHandler(args) {
208
219
  result.solveError = solveError.message;
209
220
  }
210
221
  }
222
+ let summary = `Puzzle Captcha Analysis:\n- Puzzle Found: ${result.puzzleFound ? 'Yes' : 'No'}\n- Slider Found: ${result.sliderFound ? 'Yes' : 'No'}`;
223
+ if (result.puzzle) {
224
+ summary += `\n\nPuzzle Details:\n- Dimensions: ${result.puzzle.width}x${result.puzzle.height}\n- Position: (${result.puzzle.left}, ${result.puzzle.top})\n- Visible: ${result.puzzle.visible ? 'Yes' : 'No'}`;
225
+ }
226
+ if (result.puzzlePiece) {
227
+ summary += `\n\nPuzzle Piece:\n- Dimensions: ${result.puzzlePiece.width}x${result.puzzlePiece.height}\n- Position: (${result.puzzlePiece.left}, ${result.puzzlePiece.top})`;
228
+ }
229
+ if (result.slider) {
230
+ summary += `\n\nSlider Details:\n- Dimensions: ${result.slider.width}x${result.slider.height}\n- Position: (${result.slider.left}, ${result.slider.top})\n- Visible: ${result.slider.visible ? 'Yes' : 'No'}\n- Tag: ${result.slider.tagName}`;
231
+ }
232
+ if (result.attemptedSolve) {
233
+ summary += `\n\nSolve Attempt:\n- Method: ${result.method}\n- Status: ${result.solveError ? 'Failed' : 'Completed'}${result.solveError ? `\n- Error: ${result.solveError}` : ''}`;
234
+ }
235
+ summary += `\n\nNote: Advanced puzzle solving requires computer vision libraries (OpenCV, TensorFlow)`;
211
236
  return {
212
- success: true,
213
- ...result,
214
- note: 'Advanced puzzle solving requires computer vision libraries (OpenCV, TensorFlow)'
237
+ content: [
238
+ {
239
+ type: "text",
240
+ text: summary
241
+ }
242
+ ]
215
243
  };
216
244
  }
217
245
  catch (error) {
218
246
  return {
219
- success: false,
220
- error: error.message
247
+ content: [
248
+ {
249
+ type: "text",
250
+ text: `Puzzle Captcha Handler Error: ${error.message}`
251
+ }
252
+ ],
253
+ isError: true
221
254
  };
222
255
  }
223
256
  }
@@ -240,19 +240,23 @@ export async function handleVideoRecording(args) {
240
240
  }
241
241
  }
242
242
  return {
243
- success: true,
244
- duration,
245
- fps,
246
- frameCount: frames.length,
247
- frames: frames.slice(0, 5), // Show first 5 frames
248
- outputPath,
249
- note: 'For actual video file, use ffmpeg or puppeteer-screen-recorder library to combine frames'
243
+ content: [
244
+ {
245
+ type: "text",
246
+ text: `Video Recording Complete:\n- Duration: ${duration} seconds\n- FPS: ${fps}\n- Frames Captured: ${frames.length}\n- Output Path: ${outputPath}\n- Sample Frames:\n${frames.slice(0, 5).map((f, i) => ` ${i + 1}. ${f}`).join('\n')}\n\nNote: For actual video file, use ffmpeg or puppeteer-screen-recorder library to combine frames`
247
+ }
248
+ ]
250
249
  };
251
250
  }
252
251
  catch (error) {
253
252
  return {
254
- success: false,
255
- error: error.message
253
+ content: [
254
+ {
255
+ type: "text",
256
+ text: `Video Recording Error: ${error.message}`
257
+ }
258
+ ],
259
+ isError: true
256
260
  };
257
261
  }
258
262
  }
@@ -273,10 +277,13 @@ export async function handleVisualComparison(args) {
273
277
  // Check if dimensions match
274
278
  if (img1.width !== img2.width || img1.height !== img2.height) {
275
279
  return {
276
- success: false,
277
- error: 'Image dimensions do not match',
278
- image1: { width: img1.width, height: img1.height },
279
- image2: { width: img2.width, height: img2.height }
280
+ content: [
281
+ {
282
+ type: "text",
283
+ text: `Image dimensions do not match:\n- Image 1: ${img1.width}x${img1.height}\n- Image 2: ${img2.width}x${img2.height}`
284
+ }
285
+ ],
286
+ isError: true
280
287
  };
281
288
  }
282
289
  // Create diff image
@@ -291,27 +298,25 @@ export async function handleVisualComparison(args) {
291
298
  }
292
299
  const totalPixels = img1.width * img1.height;
293
300
  const diffPercentage = (numDiffPixels / totalPixels) * 100;
301
+ const similarity = ((1 - (numDiffPixels / totalPixels)) * 100).toFixed(2);
294
302
  return {
295
- success: true,
296
- identical: numDiffPixels === 0,
297
- differences: {
298
- pixels: numDiffPixels,
299
- percentage: diffPercentage.toFixed(2) + '%',
300
- totalPixels
301
- },
302
- dimensions: {
303
- width: img1.width,
304
- height: img1.height
305
- },
306
- threshold,
307
- diffImagePath: diffOutputPath,
308
- similarity: ((1 - (numDiffPixels / totalPixels)) * 100).toFixed(2) + '%'
303
+ content: [
304
+ {
305
+ type: "text",
306
+ text: `Visual Comparison Results:\n- Identical: ${numDiffPixels === 0 ? 'Yes' : 'No'}\n- Similarity: ${similarity}%\n- Different Pixels: ${numDiffPixels} (${diffPercentage.toFixed(2)}%)\n- Total Pixels: ${totalPixels}\n- Image Dimensions: ${img1.width}x${img1.height}\n- Threshold: ${threshold}${diffOutputPath ? `\n- Diff Image Saved: ${diffOutputPath}` : ''}`
307
+ }
308
+ ]
309
309
  };
310
310
  }
311
311
  catch (error) {
312
312
  return {
313
- success: false,
314
- error: error.message
313
+ content: [
314
+ {
315
+ type: "text",
316
+ text: `Visual Comparison Error: ${error.message}`
317
+ }
318
+ ],
319
+ isError: true
315
320
  };
316
321
  }
317
322
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser-mcp-server",
3
- "version": "2.8.5",
3
+ "version": "2.8.6",
4
4
  "description": "MCP server for brave-real-browser",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",