From c60a0bc3474a9d3af6f3252f03e1567e665393b9 Mon Sep 17 00:00:00 2001 From: Jonas Scholz Date: Sun, 12 Oct 2025 23:36:25 -0700 Subject: [PATCH 1/3] add docker support --- .dockerignore | 40 ++++++++++++++++++++++ Dockerfile | 27 +++++++++++++++ README.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 4 +-- pnpm-lock.yaml | 12 +++---- server.json | 32 ++++++++++++++++++ 6 files changed, 196 insertions(+), 9 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8ccf8b5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,40 @@ +# Dependencies +node_modules/ + +# Build output +dist/ + +# Tests +tests/ +evals/ + +# Git +.git/ +.gitignore + +# Documentation +*.md +!README.md +assets/ + +# CI/CD +.github/ + +# IDE +.vscode/ +.idea/ + +# Logs +*.log +npm-debug.log* + +# Environment +.env +.env.local + +# Misc +.DS_Store +*.swp +*.swo +*~ + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..68c937f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM node:22-alpine AS builder + +RUN corepack enable + +WORKDIR /app + +COPY package.json pnpm-lock.yaml ./ +RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ + pnpm install --frozen-lockfile --ignore-scripts + +COPY . . +RUN pnpm run build && \ + pnpm prune --prod --ignore-scripts + +FROM gcr.io/distroless/nodejs22-debian12 + +LABEL io.modelcontextprotocol.server.name="io.github.browserbase/mcp-server-browserbase" + +WORKDIR /app + +COPY --from=builder /app/package.json ./ +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/cli.js ./cli.js +COPY --from=builder /app/index.js ./index.js + +CMD ["cli.js"] \ No newline at end of file diff --git a/README.md b/README.md index edb573b..16c5925 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,8 @@ That's it! Reload your MCP client and Claude will be able to use Browserbase. ### To run 100% local: +#### Option 1: Direct installation + ```bash # Clone the Repo git clone https://github.com/browserbase/mcp-server-browserbase.git @@ -108,10 +110,23 @@ cd mcp-server-browserbase npm install && npm run build ``` +#### Option 2: Docker + +```bash +# Clone the Repo +git clone https://github.com/browserbase/mcp-server-browserbase.git +cd mcp-server-browserbase + +# Build the Docker image +docker build -t mcp-browserbase . +``` + Then in your MCP Config JSON run the server. To run locally we can use STDIO or self-host SHTTP. ### STDIO: +#### Using Direct Installation + To your MCP Config JSON file add the following: ```json @@ -130,6 +145,37 @@ To your MCP Config JSON file add the following: } ``` +#### Using Docker + +To your MCP Config JSON file add the following: + +```json +{ + "mcpServers": { + "browserbase": { + "command": "docker", + "args": [ + "run", + "--rm", + "-i", + "-e", + "BROWSERBASE_API_KEY", + "-e", + "BROWSERBASE_PROJECT_ID", + "-e", + "GEMINI_API_KEY", + "mcp-browserbase" + ], + "env": { + "BROWSERBASE_API_KEY": "", + "BROWSERBASE_PROJECT_ID": "", + "GEMINI_API_KEY": "" + } + } + } +} +``` + Then reload your MCP client and you should be good to go! ## Configuration @@ -156,7 +202,49 @@ These flags can be passed directly to the CLI or configured in your MCP configur ### NOTE: -Currently, these flags can only be used with the local server (npx @browserbasehq/mcp-server-browserbase). +Currently, these flags can only be used with the local server (npx @browserbasehq/mcp-server-browserbase or Docker). + +### Using Configuration Flags with Docker + +When using Docker, you can pass configuration flags as additional arguments after the image name. Here's an example with the `--proxies` flag: + +```json +{ + "mcpServers": { + "browserbase": { + "command": "docker", + "args": [ + "run", + "--rm", + "-i", + "-e", + "BROWSERBASE_API_KEY", + "-e", + "BROWSERBASE_PROJECT_ID", + "-e", + "GEMINI_API_KEY", + "mcp-browserbase", + "--proxies" + ], + "env": { + "BROWSERBASE_API_KEY": "", + "BROWSERBASE_PROJECT_ID": "", + "GEMINI_API_KEY": "" + } + } + } +} +``` + +You can also run the Docker container directly from the command line: + +```bash +docker run --rm -i \ + -e BROWSERBASE_API_KEY=your_api_key \ + -e BROWSERBASE_PROJECT_ID=your_project_id \ + -e GEMINI_API_KEY=your_gemini_key \ + mcp-browserbase --proxies +``` ## Configuration Examples diff --git a/package.json b/package.json index c25598d..da08fe2 100644 --- a/package.json +++ b/package.json @@ -49,22 +49,22 @@ "@browserbasehq/stagehand": "^2.5.0", "@mcp-ui/server": "^5.10.0", "@modelcontextprotocol/sdk": "^1.13.1", - "@smithery/cli": "^1.2.15", "commander": "^14.0.0", "dotenv": "^16.4.6", "mcpvals": "^0.0.3", - "playwright-core": "^1.53.2", "zod": "^3.25.67" }, "devDependencies": { "@changesets/cli": "^2.29.6", "@eslint/js": "^9.29.0", + "@smithery/cli": "^1.2.15", "chalk": "^5.3.0", "eslint": "^9.29.0", "eslint-plugin-react": "^7.37.5", "globals": "^16.2.0", "husky": "^9.1.7", "lint-staged": "^16.1.2", + "playwright-core": "^1.53.2", "prettier": "^3.6.1", "shx": "^0.3.4", "tsx": "^4.20.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0eedfc7..70ba7cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,9 +19,6 @@ importers: "@modelcontextprotocol/sdk": specifier: ^1.13.1 version: 1.15.1 - "@smithery/cli": - specifier: ^1.2.15 - version: 1.2.15(react@19.1.0)(ws@8.18.3(bufferutil@4.0.9))(zod@3.25.76) commander: specifier: ^14.0.0 version: 14.0.0 @@ -31,9 +28,6 @@ importers: mcpvals: specifier: ^0.0.3 version: 0.0.3(react@19.1.0) - playwright-core: - specifier: ^1.53.2 - version: 1.54.1 zod: specifier: ^3.25.67 version: 3.25.76 @@ -44,6 +38,9 @@ importers: "@eslint/js": specifier: ^9.29.0 version: 9.31.0 + "@smithery/cli": + specifier: ^1.2.15 + version: 1.2.15(react@19.1.0)(ws@8.18.3(bufferutil@4.0.9))(zod@3.25.76) chalk: specifier: ^5.3.0 version: 5.4.1 @@ -62,6 +59,9 @@ importers: lint-staged: specifier: ^16.1.2 version: 16.1.2 + playwright-core: + specifier: ^1.53.2 + version: 1.54.1 prettier: specifier: ^3.6.1 version: 3.6.2 diff --git a/server.json b/server.json index bf5b2c2..11a773c 100644 --- a/server.json +++ b/server.json @@ -40,6 +40,38 @@ "name": "GEMINI_API_KEY" } ] + }, + { + "registry_type": "oci", + "identifier": "browserbasehq/mcp-server-browserbase", + "version": "2.1.1", + "runtime_hint": "docker", + "environment_variables": [ + { + "description": "Your Browserbase API key", + "is_required": true, + "format": "string", + "is_secret": true, + "name": "BROWSERBASE_API_KEY" + }, + { + "description": "Your Browserbase Project ID", + "is_required": true, + "format": "string", + "is_secret": false, + "name": "BROWSERBASE_PROJECT_ID" + }, + { + "description": "Your Gemini API key (default model)", + "is_required": true, + "format": "string", + "is_secret": true, + "name": "GEMINI_API_KEY" + } + ], + "transport": { + "type": "stdio" + } } ] } From 02d88e54397f8d3cff3f5152927669d7148aaaf2 Mon Sep 17 00:00:00 2001 From: Jonas Scholz Date: Mon, 13 Oct 2025 10:26:41 -0700 Subject: [PATCH 2/3] fix version Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- server.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.json b/server.json index 11a773c..e881db7 100644 --- a/server.json +++ b/server.json @@ -44,7 +44,7 @@ { "registry_type": "oci", "identifier": "browserbasehq/mcp-server-browserbase", - "version": "2.1.1", + "version": "2.1.2", "runtime_hint": "docker", "environment_variables": [ { From ea8bd033e6ff72d0418105a0f3cbad7423525f08 Mon Sep 17 00:00:00 2001 From: Kylejeong2 Date: Mon, 13 Oct 2025 13:59:58 -0700 Subject: [PATCH 3/3] changesets --- CHANGELOG.md | 6 ++++++ package.json | 2 +- server.json | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2430253..c0f5bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @browserbasehq/mcp-server-browserbase +## 2.1.3 + +### Patch Changes + +- Adding docker deployment support + ## 2.1.2 ### Patch Changes diff --git a/package.json b/package.json index da08fe2..e0b2cea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@browserbasehq/mcp-server-browserbase", - "version": "2.1.2", + "version": "2.1.3", "description": "MCP server for AI web browser automation using Browserbase and Stagehand", "mcpName": "io.github.browserbase/mcp-server-browserbase", "license": "Apache-2.0", diff --git a/server.json b/server.json index e881db7..a7b7aa9 100644 --- a/server.json +++ b/server.json @@ -7,7 +7,7 @@ "url": "https://github.com/browserbase/mcp-server-browserbase", "source": "github" }, - "version": "2.1.1", + "version": "2.1.3", "packages": [ { "registry_type": "npm", @@ -44,7 +44,7 @@ { "registry_type": "oci", "identifier": "browserbasehq/mcp-server-browserbase", - "version": "2.1.2", + "version": "2.1.3", "runtime_hint": "docker", "environment_variables": [ {