open-browser
Open a browser profile with custom fingerprint settings through the AdsPower LocalAPI MCP Server, enabling automated browser management and configuration.
Instructions
Open the browser, both environment and profile mean browser
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serialNumber | No | The serial number of the browser to open | |
| userId | No | The browser id of the browser to open | |
| ipTab | No | The ip tab of the browser, 0 is not use ip tab, 1 is use ip tab, default is 0 | |
| launchArgs | No | The launch args of the browser, use chrome launch args, eg: ["--blink-settings=imagesEnabled=false","--disable-notifications"], or vista url, eg: ["https://www.adspower.net"] | |
| clearCacheAfterClosing | No | The clear cache after closing of the browser, 0 is not clear cache after closing, 1 is clear cache after closing, default is 0 | |
| cdpMask | No | The cdp mask of the browser, 0 is not use cdp mask, 1 is use cdp mask, default is 0 |
Implementation Reference
- src/handlers/browser.ts:15-47 (handler)The core handler function for the 'open-browser' tool. It constructs API parameters and makes a GET request to the local API endpoint to start/open the browser, returning connection details like ws.puppeteer or throwing an error on failure.async openBrowser({ serialNumber, userId, ipTab, launchArgs, clearCacheAfterClosing, cdpMask }: OpenBrowserParams) { const params = new URLSearchParams(); if (serialNumber) { params.set('serial_number', serialNumber); } if (userId) { params.set('user_id', userId); } if (ipTab) { params.set('open_tabs', ipTab); } if (launchArgs) { params.set('launch_args', launchArgs); } if (clearCacheAfterClosing) { params.set('clear_cache_after_closing', clearCacheAfterClosing); } if (cdpMask) { params.set('cdp_mask', cdpMask); } params.set('open_tabs', '0'); const response = await axios.get(`${LOCAL_API_BASE}${API_ENDPOINTS.START_BROWSER}`, { params }); if (response.data.code === 0) { return `Browser opened successfully with: ${Object.entries(response.data.data).map(([key, value]) => { if (value && typeof value === 'object') { return Object.entries(value).map(([key, value]) => `ws.${key}: ${value}`).join('\n'); } return `${key}: ${value}`; }).join('\n')}`; } throw new Error(`Failed to open browser: ${response.data.msg}`); },
- src/utils/toolRegister.ts:11-12 (registration)Registers the 'open-browser' tool with the MCP server, providing name, description, input schema, and the wrapped handler function.server.tool('open-browser', 'Open the browser, both environment and profile mean browser', schemas.openBrowserSchema.shape, wrapHandler(browserHandlers.openBrowser));
- src/types/schemas.ts:99-106 (schema)Zod schema defining the input parameters for the 'open-browser' tool, including optional fields like serialNumber, userId, launchArgs, etc.openBrowserSchema: z.object({ serialNumber: z.string().optional().describe('The serial number of the browser to open'), userId: z.string().optional().describe('The browser id of the browser to open'), ipTab: z.enum(['0', '1']).optional().describe('The ip tab of the browser, 0 is not use ip tab, 1 is use ip tab, default is 0'), launchArgs: z.string().optional().describe(`The launch args of the browser, use chrome launch args, eg: ${JSON.stringify(["--blink-settings=imagesEnabled=false", "--disable-notifications"])}, or vista url, eg: ${JSON.stringify(["https://www.adspower.net"])}`), clearCacheAfterClosing: z.enum(['0', '1']).optional().describe('The clear cache after closing of the browser, 0 is not clear cache after closing, 1 is clear cache after closing, default is 0'), cdpMask: z.enum(['0', '1']).optional().describe('The cdp mask of the browser, 0 is not use cdp mask, 1 is use cdp mask, default is 0'), }).strict(),