feat: MCP Browser v3.0 - 42 tools with stealth mode, multi-tab, PDF, cookies, storage, network logs, device emulation

This commit is contained in:
2026-03-27 11:58:52 -03:00
parent c1d716bb84
commit 13f7392555
48 changed files with 1269 additions and 714 deletions
+16 -48
View File
@@ -1,56 +1,24 @@
const browser = require('../browser');
module.exports = async ({ url }) => {
if (!url) {
throw new Error('URL é obrigatória');
}
module.exports = async ({ url, waitUntil = 'domcontentloaded' }) => {
if (!url) throw new Error('URL é obrigatória');
await browser.start();
const p = await browser.ensurePage();
const currentUrl = p.url();
if (currentUrl && currentUrl !== 'about:blank') {
if (currentUrl.includes(new URL(url).hostname)) {
await p.goto(url, {
waitUntil: 'domcontentloaded',
timeout: 30000
});
await p.waitForTimeout(1500);
return {
success: true,
url,
title: await p.title(),
tab: 'reused'
};
}
const newPage = await browser.newTab();
await newPage.goto(url, {
waitUntil: 'domcontentloaded',
timeout: 30000
});
await newPage.waitForTimeout(1500);
return {
success: true,
url,
title: await newPage.title(),
tab: 'new'
};
try {
const targetUrl = new URL(url);
if (currentUrl.includes(targetUrl.hostname)) {
const result = await browser.goto(url, { waitUntil });
return { success: true, ...result, tab: 'reused' };
}
} catch (e) {}
await browser.newTab(url);
const newPage = browser.page;
return { success: true, url, title: await newPage.title(), tab: 'new' };
}
await p.goto(url, {
waitUntil: 'domcontentloaded',
timeout: 30000
});
await p.waitForTimeout(1500);
return {
success: true,
url,
title: await p.title(),
tab: 'existing'
};
const result = await browser.goto(url, { waitUntil });
return { success: true, ...result, tab: 'existing' };
};