real-browser-mcp-server 1.1.6 → 1.1.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/README.md +4 -8
- package/package.json +1 -1
- package/src/ai/action-parser.js +1 -6
- package/src/index.js +3 -3
- package/src/mcp/handlers.js +0 -91
- package/src/shared/tools.js +1 -43
package/README.md
CHANGED
|
@@ -139,9 +139,9 @@ Configure the server in your `opencode.jsonc` or standard MCP settings configura
|
|
|
139
139
|
|
|
140
140
|
---
|
|
141
141
|
|
|
142
|
-
## 🌐 Complete MCP Tool Reference (
|
|
142
|
+
## 🌐 Complete MCP Tool Reference (23 Tools)
|
|
143
143
|
|
|
144
|
-
The server exposes
|
|
144
|
+
The server exposes 23 highly optimized tools categorized into functional units:
|
|
145
145
|
|
|
146
146
|
### 🌐 Browser & Session
|
|
147
147
|
| Tool Name | Description | Parameters |
|
|
@@ -185,11 +185,7 @@ The server exposes 25 highly optimized tools categorized into functional units:
|
|
|
185
185
|
| `wait` | Smart delay with AI prediction or static timeout. | `duration` (number) |
|
|
186
186
|
| `progress_tracker` | Track running automation progress with AI-estimated remaining times. | `step` (string), `percentage` (number) |
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
| Tool Name | Description | Parameters |
|
|
190
|
-
|:---|:---|:---|
|
|
191
|
-
| `screenshot` | Capture viewport, full page, or a specific element. Returns the image to the AI agent (base64) and can save to a file. | `fullPage` (boolean), `selector` (string), `format` (png/jpeg), `path` (string) |
|
|
192
|
-
| `save_as_pdf` | Save the current page as a PDF via Chromium print-to-PDF (headless mode only). | `path` (string), `format` (string), `landscape` (boolean) |
|
|
188
|
+
|
|
193
189
|
|
|
194
190
|
### 👁️ AI Vision (Eyes)
|
|
195
191
|
| Tool Name | Description | Parameters |
|
|
@@ -305,7 +301,7 @@ Run these scripts from the project root directory:
|
|
|
305
301
|
| `npm run dev` | Alias to start the MCP server. |
|
|
306
302
|
| `npm run mcp` | Start the MCP server. |
|
|
307
303
|
| `npm run mcp:verbose` | Start the MCP server with verbose logging on `stderr`. |
|
|
308
|
-
| `npm run list` | Clean list of all
|
|
304
|
+
| `npm run list` | Clean list of all 23 tools with emojis and categories. |
|
|
309
305
|
| `npm run build` | Validate workspace structure and confirm library status. |
|
|
310
306
|
| `npm test` | Execute the full test suite (CJS & ESM). |
|
|
311
307
|
| `npm run cjs_test` | Run CommonJS test scripts. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "real-browser-mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "MCP Server for Real Browser - Patchright (undetected Playwright fork) with 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",
|
package/src/ai/action-parser.js
CHANGED
|
@@ -108,12 +108,7 @@ class ActionParser {
|
|
|
108
108
|
type: 'submit',
|
|
109
109
|
extract: (match) => ({ target: match[1].trim() || 'form' })
|
|
110
110
|
},
|
|
111
|
-
|
|
112
|
-
{
|
|
113
|
-
pattern: /^(take|capture)\s+(?:a\s+)?screenshot/i,
|
|
114
|
-
type: 'screenshot',
|
|
115
|
-
extract: () => ({})
|
|
116
|
-
},
|
|
111
|
+
|
|
117
112
|
// Go back/forward patterns
|
|
118
113
|
{
|
|
119
114
|
pattern: /^go\s+(back|forward)/i,
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Real Browser
|
|
3
|
+
* Real Browser MCP Server
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
6
|
* node src/index.js - Start MCP Server (default)
|
|
@@ -28,7 +28,7 @@ const colors = {
|
|
|
28
28
|
*/
|
|
29
29
|
function showHelp() {
|
|
30
30
|
console.log(`
|
|
31
|
-
${colors.bright}${colors.cyan}🦁 Real Browser
|
|
31
|
+
${colors.bright}${colors.cyan}🦁 Real Browser MCP Server${colors.reset}
|
|
32
32
|
|
|
33
33
|
${colors.bright}USAGE:${colors.reset}
|
|
34
34
|
node src/index.js [options]
|
|
@@ -99,7 +99,7 @@ async function main() {
|
|
|
99
99
|
|
|
100
100
|
console.error('');
|
|
101
101
|
console.error(`${colors.bright}${colors.cyan}╔════════════════════════════════════════════════════════════╗${colors.reset}`);
|
|
102
|
-
console.error(`${colors.bright}${colors.cyan}║${colors.reset} ${colors.bright}${colors.magenta}🦁 Real Browser
|
|
102
|
+
console.error(`${colors.bright}${colors.cyan}║${colors.reset} ${colors.bright}${colors.magenta}🦁 Real Browser MCP Server${colors.reset} ${colors.cyan}║${colors.reset}`);
|
|
103
103
|
console.error(`${colors.bright}${colors.cyan}║${colors.reset} ${colors.dim}MCP (AI Agents) Server running on STDIO${colors.reset} ${colors.cyan}║${colors.reset}`);
|
|
104
104
|
console.error(`${colors.bright}${colors.cyan}╚════════════════════════════════════════════════════════════╝${colors.reset}`);
|
|
105
105
|
console.error('');
|
package/src/mcp/handlers.js
CHANGED
|
@@ -4946,98 +4946,7 @@ const handlers = {
|
|
|
4946
4946
|
};
|
|
4947
4947
|
},
|
|
4948
4948
|
|
|
4949
|
-
// 23. Screenshot - capture viewport / full page / element (returns image to AI)
|
|
4950
|
-
async screenshot(params = {}) {
|
|
4951
|
-
const { page } = requireBrowser();
|
|
4952
|
-
const {
|
|
4953
|
-
fullPage = false,
|
|
4954
|
-
selector,
|
|
4955
|
-
format = 'png',
|
|
4956
|
-
quality,
|
|
4957
|
-
path: savePath,
|
|
4958
|
-
returnBase64 = true,
|
|
4959
|
-
omitBackground = false
|
|
4960
|
-
} = params;
|
|
4961
|
-
|
|
4962
|
-
notifyProgress('screenshot', 'started',
|
|
4963
|
-
`Capturing ${selector ? 'element' : (fullPage ? 'full page' : 'viewport')} screenshot`);
|
|
4964
|
-
|
|
4965
|
-
const opts = { type: format, fullPage: selector ? false : fullPage };
|
|
4966
|
-
if (format === 'jpeg' && typeof quality === 'number') opts.quality = quality;
|
|
4967
|
-
if (format === 'png' && omitBackground) opts.omitBackground = true;
|
|
4968
|
-
|
|
4969
|
-
let buffer;
|
|
4970
|
-
if (selector) {
|
|
4971
|
-
const element = await page.$(selector);
|
|
4972
|
-
if (!element) {
|
|
4973
|
-
notifyProgress('screenshot', 'error', `Element not found: ${selector}`);
|
|
4974
|
-
return { success: false, error: `Element not found: ${selector}` };
|
|
4975
|
-
}
|
|
4976
|
-
buffer = await element.screenshot(opts);
|
|
4977
|
-
} else {
|
|
4978
|
-
buffer = await page.screenshot(opts);
|
|
4979
|
-
}
|
|
4980
|
-
|
|
4981
|
-
let savedTo = null;
|
|
4982
|
-
if (savePath) {
|
|
4983
|
-
const dir = path.dirname(savePath);
|
|
4984
|
-
if (dir && !fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
4985
|
-
fs.writeFileSync(savePath, buffer);
|
|
4986
|
-
savedTo = savePath;
|
|
4987
|
-
}
|
|
4988
|
-
|
|
4989
|
-
notifyProgress('screenshot', 'completed',
|
|
4990
|
-
`Screenshot captured (${buffer.length} bytes)${savedTo ? ' → ' + savedTo : ''}`);
|
|
4991
4949
|
|
|
4992
|
-
const meta = { success: true, format, bytes: buffer.length, savedTo, url: page.url() };
|
|
4993
|
-
|
|
4994
|
-
if (returnBase64) {
|
|
4995
|
-
const base64 = Buffer.from(buffer).toString('base64');
|
|
4996
|
-
// mcpContent is returned directly to the AI agent (image + text summary)
|
|
4997
|
-
meta.mcpContent = [
|
|
4998
|
-
{ type: 'image', data: base64, mimeType: format === 'jpeg' ? 'image/jpeg' : 'image/png' },
|
|
4999
|
-
{ type: 'text', text: JSON.stringify({ success: true, format, bytes: buffer.length, savedTo, url: page.url() }, null, 2) }
|
|
5000
|
-
];
|
|
5001
|
-
}
|
|
5002
|
-
|
|
5003
|
-
return meta;
|
|
5004
|
-
},
|
|
5005
|
-
|
|
5006
|
-
// 24. Save as PDF - Chromium print-to-PDF (headless mode only)
|
|
5007
|
-
async save_as_pdf(params = {}) {
|
|
5008
|
-
const { page } = requireBrowser();
|
|
5009
|
-
const {
|
|
5010
|
-
path: savePath = './downloads/page.pdf',
|
|
5011
|
-
format = 'A4',
|
|
5012
|
-
landscape = false,
|
|
5013
|
-
printBackground = true
|
|
5014
|
-
} = params;
|
|
5015
|
-
|
|
5016
|
-
notifyProgress('save_as_pdf', 'started', `Saving page as PDF: ${savePath}`);
|
|
5017
|
-
|
|
5018
|
-
const dir = path.dirname(savePath);
|
|
5019
|
-
if (dir && !fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
5020
|
-
|
|
5021
|
-
try {
|
|
5022
|
-
await page.pdf({ path: savePath, format, landscape, printBackground });
|
|
5023
|
-
} catch (e) {
|
|
5024
|
-
notifyProgress('save_as_pdf', 'error', e.message);
|
|
5025
|
-
return {
|
|
5026
|
-
success: false,
|
|
5027
|
-
error: `PDF generation failed (page.pdf() works only in headless mode): ${e.message}`
|
|
5028
|
-
};
|
|
5029
|
-
}
|
|
5030
|
-
|
|
5031
|
-
const stats = fs.existsSync(savePath) ? fs.statSync(savePath) : null;
|
|
5032
|
-
notifyProgress('save_as_pdf', 'completed', `PDF saved: ${savePath}`);
|
|
5033
|
-
|
|
5034
|
-
return {
|
|
5035
|
-
success: true,
|
|
5036
|
-
savedTo: savePath,
|
|
5037
|
-
bytes: stats ? stats.size : null,
|
|
5038
|
-
url: page.url()
|
|
5039
|
-
};
|
|
5040
|
-
},
|
|
5041
4950
|
|
|
5042
4951
|
// 25. See Page (AI Vision — "eyes": screenshot + visual map of interactive elements)
|
|
5043
4952
|
async see_page(params = {}) {
|
package/src/shared/tools.js
CHANGED
|
@@ -559,48 +559,6 @@ const TOOLS = [
|
|
|
559
559
|
}
|
|
560
560
|
},
|
|
561
561
|
|
|
562
|
-
// 23. Screenshot
|
|
563
|
-
{
|
|
564
|
-
name: 'screenshot',
|
|
565
|
-
emoji: '📸',
|
|
566
|
-
description: 'Capture a screenshot of the viewport, the full scrollable page, or a specific element. Returns the image directly to the AI agent (base64) and can optionally save it to a file. EFFICIENCY RULE: PREFER a single FULL-PAGE screenshot (set fullPage: true) so the entire page is captured in one shot, then complete ALL related work for that page from this single capture (read, click, type, extract). Take a SECOND screenshot ONLY IF the work genuinely cannot be finished from the first one, OR after the page actually changes (navigation, modal/popup, or new dynamic content loads). Do NOT take repeated screenshots of the SAME unchanged page.',
|
|
567
|
-
descriptionHindi: 'स्क्रीनशॉट लेना — viewport, पूरा पेज, या किसी element का। Image सीधे AI को मिलती है + file में save हो सकती है। नियम: पहले पूरे पेज का full-page (लॉन्ग) स्क्रीनशॉट लें (fullPage: true) ताकि पूरा पेज एक ही बार में दिख जाए, फिर उसी एक image से उस पेज का सारा काम (पढ़ना, क्लिक, टाइप, data निकालना) एक साथ complete करें। दूसरा स्क्रीनशॉट सिर्फ़ तभी लें जब पहले वाले से काम पूरा न हो पाए, या पेज सच में बदल जाए (navigation, modal/popup, या नया dynamic content)। बिना बदलाव के उसी पेज का बार-बार स्क्रीनशॉट न लें।',
|
|
568
|
-
category: 'capture',
|
|
569
|
-
requiresBrowser: true,
|
|
570
|
-
requiresPage: true,
|
|
571
|
-
inputSchema: {
|
|
572
|
-
type: 'object',
|
|
573
|
-
properties: {
|
|
574
|
-
fullPage: { type: 'boolean', default: false, description: 'Capture the full scrollable page' },
|
|
575
|
-
selector: { type: 'string', description: 'CSS selector to screenshot a specific element only' },
|
|
576
|
-
format: { type: 'string', enum: ['png', 'jpeg'], default: 'png' },
|
|
577
|
-
quality: { type: 'number', description: 'JPEG quality 0-100 (jpeg only)' },
|
|
578
|
-
path: { type: 'string', description: 'Optional file path to save the screenshot' },
|
|
579
|
-
returnBase64: { type: 'boolean', default: true, description: 'Return image to AI as base64 (MCP image content)' },
|
|
580
|
-
omitBackground: { type: 'boolean', default: false, description: 'Transparent background (png only)' }
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
},
|
|
584
|
-
|
|
585
|
-
// 24. Save as PDF
|
|
586
|
-
{
|
|
587
|
-
name: 'save_as_pdf',
|
|
588
|
-
emoji: '📑',
|
|
589
|
-
description: 'Save the current page as a PDF file using Chromium print-to-PDF. Note: works only in headless mode.',
|
|
590
|
-
descriptionHindi: 'पेज को PDF में सेव करना (Chromium print-to-PDF)। ध्यान: सिर्फ़ headless mode में काम करता है।',
|
|
591
|
-
category: 'capture',
|
|
592
|
-
requiresBrowser: true,
|
|
593
|
-
requiresPage: true,
|
|
594
|
-
inputSchema: {
|
|
595
|
-
type: 'object',
|
|
596
|
-
properties: {
|
|
597
|
-
path: { type: 'string', default: './downloads/page.pdf', description: 'File path to save the PDF' },
|
|
598
|
-
format: { type: 'string', default: 'A4', description: 'Paper format: A4, Letter, Legal, etc.' },
|
|
599
|
-
landscape: { type: 'boolean', default: false },
|
|
600
|
-
printBackground: { type: 'boolean', default: true, description: 'Include background graphics' }
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
},
|
|
604
562
|
|
|
605
563
|
// 25. See Page (AI Vision — "eyes")
|
|
606
564
|
{
|
|
@@ -633,7 +591,7 @@ const CATEGORIES = {
|
|
|
633
591
|
extraction: { name: 'Extraction', emoji: '📄', description: 'Content extraction and scraping' },
|
|
634
592
|
network: { name: 'Network', emoji: '📡', description: 'Network operations' },
|
|
635
593
|
analysis: { name: 'Analysis', emoji: '🧠', description: 'Page analysis' },
|
|
636
|
-
|
|
594
|
+
|
|
637
595
|
vision: { name: 'Vision', emoji: '👁️', description: 'AI visual perception (sees pages like human eyes)' },
|
|
638
596
|
utility: { name: 'Utility', emoji: '🛠️', description: 'Utility tools' }
|
|
639
597
|
};
|