Skip to content

[GRO-187] adding keep alive flag to MCP #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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>` | Port to listen on for HTTP/SHTTP transport |
| `--host <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 |
Expand Down
6 changes: 6 additions & 0 deletions config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/)",
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/stagehandStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const createStagehandInstance = async (
browserbaseSessionCreateParams: {
projectId,
proxies: config.proxies,
keepAlive: config.keepAlive ?? false,
browserSettings: {
viewport: {
width: config.viewPort?.browserWidth ?? 1024,
Expand Down