diff --git a/README.md b/README.md index d3d3cf4..8746721 100644 --- a/README.md +++ b/README.md @@ -140,8 +140,9 @@ The Browserbase MCP server accepts the following command-line flags: | -------------------------- | --------------------------------------------------------------------------- | | `--proxies` | Enable Browserbase proxies for the session | | `--advancedStealth` | Enable Browserbase Advanced Stealth (Only for Scale Plan Users) | +| `--keepAlive` | Enable Browserbase Keep Alive Session | | `--contextId ` | Specify a Browserbase Context ID to use | -| `--persist [boolean]` | Whether to persist the Browserbase context (default: true) | +| `--persist` | Whether to persist the Browserbase context (default: true) | | `--port ` | Port to listen on for HTTP/SHTTP transport | | `--host ` | Host to bind server to (default: localhost, use 0.0.0.0 for all interfaces) | | `--cookies [json]` | JSON array of cookies to inject into the browser | diff --git a/config.d.ts b/config.d.ts index bbd4bbf..3a3ffa1 100644 --- a/config.d.ts +++ b/config.d.ts @@ -23,6 +23,12 @@ export type Config = { * @default false */ advancedStealth?: boolean; + /** + * Whether or not to keep the Browserbase session alive + * + * @default false + */ + keepAlive?: boolean; /** * Potential Browserbase Context to use * Would be a context ID diff --git a/package.json b/package.json index 7cb9856..614f3b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@browserbasehq/mcp-server-browserbase", - "version": "2.0.0", + "version": "2.0.1", "description": "MCP server for AI web browser automation using Browserbase and Stagehand", "license": "Apache-2.0", "author": "Browserbase, Inc. (https://www.browserbase.com/)", diff --git a/src/index.ts b/src/index.ts index e321e16..76c8f29 100644 --- a/src/index.ts +++ b/src/index.ts @@ -48,6 +48,10 @@ export const configSchema = z .describe( "Use advanced stealth mode. Only available to Browserbase Scale Plan users", ), + keepAlive: z + .boolean() + .optional() + .describe("Whether or not to keep the Browserbase session alive"), context: z .object({ contextId: z diff --git a/src/stagehandStore.ts b/src/stagehandStore.ts index e65b6c7..84dc1a6 100644 --- a/src/stagehandStore.ts +++ b/src/stagehandStore.ts @@ -36,6 +36,7 @@ export const createStagehandInstance = async ( browserbaseSessionCreateParams: { projectId, proxies: config.proxies, + keepAlive: config.keepAlive ?? false, browserSettings: { viewport: { width: config.viewPort?.browserWidth ?? 1024,