Skip to content

Commit f841909

Browse files
authored
feat: upgrade stagehand to v3 (#128)
* feat: upgrade stagehand to v3 * pnpm lockfile * changesets * remove playwright fully + update mcpvals version * testing package moved to dev deps * pnpm lockfile * readme changes + remove cookies from options
1 parent b7ec6f6 commit f841909

19 files changed

+1395
-490
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @browserbasehq/mcp-server-browserbase
22

3+
## 2.3.0
4+
5+
### Minor Changes
6+
7+
- upgrade to stagehand v3
8+
39
## 2.2.0
410

511
### Minor Changes

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88

99
This server provides cloud browser automation capabilities using [Browserbase](https://www.browserbase.com/) and [Stagehand](https://github.com/browserbase/stagehand). It enables LLMs to interact with web pages, take screenshots, extract information, and perform automated actions with atomic precision.
1010

11+
## What's New in Stagehand v3
12+
13+
Powered by [Stagehand v3.0](https://github.com/browserbase/stagehand), this MCP server now includes:
14+
15+
- **20-40% Faster Performance**: Speed improvements across all core operations (`act`, `extract`, `observe`) through automatic caching
16+
- **Enhanced Extraction**: Targeted extraction and observation across iframes and shadow roots
17+
- **Improved Schemas**: Streamlined extract schemas for more intuitive data extraction
18+
- **Advanced Selector Support**: CSS selector support with improved element targeting
19+
- **Multi-Browser Support**: Compatible with Playwright, Puppeteer, and Patchright
20+
- **New Primitives**: Built-in `page`, `locator`, `frameLocator`, and `deepLocator` for simplified automation
21+
- **Experimental Features**: Enable cutting-edge capabilities with the `--experimental` flag
22+
23+
For more details, visit the [Stagehand v3 documentation](https://docs.stagehand.dev/).
24+
1125
## Features
1226

1327
| Feature | Description |
@@ -19,6 +33,8 @@ This server provides cloud browser automation capabilities using [Browserbase](h
1933
| Model Flexibility | Supports multiple models (OpenAI, Claude, Gemini, and more) |
2034
| Vision Support | Use annotated screenshots for complex DOMs |
2135
| Session Management | Create, manage, and close browser sessions |
36+
| High Performance | 20-40% faster operations with automatic caching (v3) |
37+
| Advanced Selectors | Enhanced CSS selector support for precise element targeting |
2238

2339
## How to Setup
2440

@@ -190,7 +206,6 @@ The Browserbase MCP server accepts the following command-line flags:
190206
| `--persist` | Whether to persist the Browserbase context (default: true) |
191207
| `--port <port>` | Port to listen on for HTTP/SHTTP transport |
192208
| `--host <host>` | Host to bind server to (default: localhost, use 0.0.0.0 for all interfaces) |
193-
| `--cookies [json]` | JSON array of cookies to inject into the browser |
194209
| `--browserWidth <width>` | Browser viewport width (default: 1024) |
195210
| `--browserHeight <height>` | Browser viewport height (default: 768) |
196211
| `--modelName <model>` | The model to use for Stagehand (default: gemini-2.0-flash) |
@@ -343,6 +358,30 @@ Here's how to use it for custom browser sizing. We recommend to stick with 16:9
343358
}
344359
```
345360

361+
### Experimental Features
362+
363+
Stagehand v3 includes experimental features that can be enabled with the `--experimental` flag. These features provide cutting-edge capabilities that are actively being developed and refined.
364+
365+
To enable experimental features:
366+
367+
```json
368+
{
369+
"mcpServers": {
370+
"browserbase": {
371+
"command": "npx",
372+
"args": ["@browserbasehq/mcp-server-browserbase", "--experimental"],
373+
"env": {
374+
"BROWSERBASE_API_KEY": "",
375+
"BROWSERBASE_PROJECT_ID": "",
376+
"GEMINI_API_KEY": ""
377+
}
378+
}
379+
}
380+
}
381+
```
382+
383+
_Note: Experimental features may change or be removed in future releases. Use them at your own discretion._
384+
346385
### Model Configuration
347386

348387
Stagehand defaults to using Google's Gemini 2.0 Flash model, but you can configure it to use other models like GPT-4o, Claude, or other providers.
@@ -359,7 +398,7 @@ Here's how to configure different models:
359398
"args": [
360399
"@browserbasehq/mcp-server-browserbase",
361400
"--modelName",
362-
"anthropic/claude-3-5-sonnet-latest",
401+
"anthropic/claude-sonnet-4.5",
363402
"--modelApiKey",
364403
"your-anthropic-api-key"
365404
],

config.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { Cookie } from "playwright-core";
21
import type { AvailableModelSchema } from "@browserbasehq/stagehand";
32

43
export type Config = {
@@ -59,11 +58,6 @@ export type Config = {
5958
*/
6059
browserHeight?: number;
6160
};
62-
/**
63-
* Cookies to inject into the Browserbase context
64-
* Format: Array of cookie objects with name, value, domain, and optional path, expires, httpOnly, secure, sameSite
65-
*/
66-
cookies?: Cookie[];
6761
/**
6862
* Server configuration for MCP transport layer
6963
*

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@browserbasehq/mcp-server-browserbase",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "MCP server for AI web browser automation using Browserbase and Stagehand",
55
"mcpName": "io.github.browserbase/mcp-server-browserbase",
66
"license": "Apache-2.0",
@@ -46,12 +46,11 @@
4646
},
4747
"dependencies": {
4848
"@browserbasehq/sdk": "^2.6.0",
49-
"@browserbasehq/stagehand": "^2.5.2",
49+
"@browserbasehq/stagehand": "^3.0.1",
5050
"@mcp-ui/server": "^5.10.0",
5151
"@modelcontextprotocol/sdk": "^1.13.1",
5252
"commander": "^14.0.0",
5353
"dotenv": "^16.4.6",
54-
"mcpvals": "^0.0.3",
5554
"zod": "^3.25.67"
5655
},
5756
"devDependencies": {
@@ -64,7 +63,7 @@
6463
"globals": "^16.2.0",
6564
"husky": "^9.1.7",
6665
"lint-staged": "^16.1.2",
67-
"playwright-core": "^1.53.2",
66+
"mcpvals": "^0.4.0",
6867
"prettier": "^3.6.1",
6968
"shx": "^0.3.4",
7069
"tsx": "^4.20.3",

0 commit comments

Comments
 (0)