import PuppeteerBrowser from '@/class/browser.class';
// Singleton instance of the browser
let browserInstance: PuppeteerBrowser;
/**
* Gets the singleton instance of the browser
*/
export function getBrowser(): PuppeteerBrowser {
if (!browserInstance) {
browserInstance = new PuppeteerBrowser();
}
return browserInstance;
}
/**
* Initialize the browser
* @param headless Whether to run in headless mode
*/
export async function initBrowser(headless: boolean = true): Promise<void> {
const browser = getBrowser();
await browser.init(headless);
}
/**
* Close the browser instance
*/
export async function closeBrowser(): Promise<void> {
if (browserInstance) {
await browserInstance.close();
browserInstance = undefined as any;
}
}
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/gpaul-faldin/MCP_puppeteer_extra'
If you have feedback or need assistance with the MCP directory API, please join our Discord server