Skip to content

Commit 0a873e9

Browse files
authored
Merge pull request #65 from browserbase/kj/loom
[fix]: loom video + readme updates
2 parents feb4e6e + 334591f commit 0a873e9

File tree

3 files changed

+104
-66
lines changed

3 files changed

+104
-66
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[The Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you’re building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
66

7-
This server provides cloud browser automation capabilities using [Browserbase](https://www.browserbase.com/), [Puppeteer](https://pptr.dev/), and [Stagehand](https://github.com/browserbase/stagehand). This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a cloud browser environment.
7+
This server provides cloud browser automation capabilities using [Browserbase](https://www.browserbase.com/) and [Stagehand](https://github.com/browserbase/stagehand). This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a cloud browser environment.
88

99
To learn to get started with Browserbase, check out [Browserbase MCP](./browserbase/README.md) or [Stagehand MCP](./stagehand/README.md).
1010

@@ -18,7 +18,6 @@ To learn to get started with Browserbase, check out [Browserbase MCP](./browserb
1818
| Data Extraction | Extract structured data from any webpage |
1919
| Console Monitoring | Track and analyze browser console logs |
2020
| Screenshots | Capture full-page and element screenshots |
21-
| JavaScript | Execute custom JS in the browser context |
2221
| Web Interaction | Navigate, click, and fill forms with ease |
2322

2423
🤘 **Stagehand MCP** - Located in [`stagehand/`](./stagehand/)

browserbase/README.md

Lines changed: 101 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,70 @@
11
# Playwright Browserbase MCP Server
22

3-
A Model Context Protocol server that uses Playwright and Browserbase
4-
to provide browser automation tools.
3+
![cover](../assets/browserbase-mcp.png)
4+
5+
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you’re building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
6+
7+
<div>
8+
<a href="https://www.loom.com/share/d285d6093b2843e98908c65592031218">
9+
<img style="max-width:600px;" src="https://cdn.loom.com/sessions/thumbnails/d285d6093b2843e98908c65592031218-1ab1288912ffd40c-full-play.gif">
10+
a>
11+
div>
512

613
## How to setup in MCP json
714

8-
### Local Dev
15+
You can either use our Server hosted on NPM or run it completely locally by cloning this repo.
16+
17+
### To run on NPM (Recommended)
18+
19+
Go into your MCP Config JSON and add the Browserbase Server:
20+
21+
```json
22+
{
23+
"mcpServers": {
24+
"browserbase": {
25+
"command": "npx",
26+
"args" : ["@browserbasehq/mcp-server-browserbase"],
27+
"env": {
28+
"BROWSERBASE_API_KEY": "",
29+
"BROWSERBASE_PROJECT_ID": ""
30+
}
31+
}
32+
}
33+
}
34+
```
35+
36+
Thats it! Reload your MCP client and Claude will be able to use Browserbase.
37+
38+
### To run 100% local:
939

10-
To run locally we can use STDIO or self-host over SSE.
40+
```bash
41+
# Clone the Repo
42+
git clone https://github.com/browserbase/mcp-server-browserbase.git
43+
44+
# Install the dependencies in the proper directory and build the project
45+
cd browserbase
46+
npm install && npm run build
47+
48+
```
49+
50+
Then in your MCP Config JSON run the server. To run locally we can use STDIO or self-host over SSE.
1151

1252
### STDIO:
1353

1454
To your MCP Config JSON file add the following:
1555

1656
```json
1757
{
18-
"mcpServers": {
19-
"playwright": {
58+
"mcpServers": {
59+
"browserbase": {
2060
"command" : "node",
2161
"args" : ["/path/to/mcp-server-browserbase/browserbase/cli.js"],
2262
"env": {
23-
"BROWSERBASE_API_KEY": "",
24-
"BROWSERBASE_PROJECT_ID": ""
63+
"BROWSERBASE_API_KEY": "",
64+
"BROWSERBASE_PROJECT_ID": ""
65+
}
2566
}
26-
}
27-
}
67+
}
2868
}
2969
```
3070

@@ -73,6 +113,8 @@ The Browserbase MCP server accepts the following command-line flags:
73113

74114
These flags can be passed directly to the CLI or configured in your MCP configuration file.
75115

116+
### NOTE:
117+
76118
Currently, these flags can only be used with the local server (npx @browserbasehq/mcp-server-browserbase).
77119

78120
____
@@ -83,44 +125,42 @@ ____
83125

84126
Here are our docs on [Proxies](https://docs.browserbase.com/features/proxies).
85127

86-
To use proxies in STDIO, set the --proxies flag in your MCP Config
128+
To use proxies in STDIO, set the --proxies flag in your MCP Config:
87129

88130
```json
89-
{
90-
"mcpServers": {
91-
"playwright": {
92-
"command" : "npx",
93-
"args" : ["@browserbasehq/mcp-server-browserbase", "--proxies"],
94-
"env": {
95-
"BROWSERBASE_API_KEY": "",
96-
"BROWSERBASE_PROJECT_ID": ""
97-
}
131+
{
132+
"mcpServers": {
133+
"browserbase": {
134+
"command" : "npx",
135+
"args" : ["@browserbasehq/mcp-server-browserbase", "--proxies"],
136+
"env": {
137+
"BROWSERBASE_API_KEY": "",
138+
"BROWSERBASE_PROJECT_ID": ""
98139
}
99140
}
100141
}
101-
142+
}
102143
```
103144

104145
### Contexts
105146

106147
Here are our docs on [Contexts](https://docs.browserbase.com/features/contexts)
107148

108-
To use proxies in STDIO, set the --proxies flag in your MCP Config
149+
To use contexts in STDIO, set the --contextId flag in your MCP Config:
109150

110151
```json
111-
{
112-
"mcpServers": {
113-
"playwright": {
114-
"command" : "npx",
115-
"args" : ["@browserbasehq/mcp-server-browserbase", "--contextId", ""],
116-
"env": {
117-
"BROWSERBASE_API_KEY": "",
118-
"BROWSERBASE_PROJECT_ID": ""
119-
}
152+
{
153+
"mcpServers": {
154+
"browserbase": {
155+
"command" : "npx",
156+
"args" : ["@browserbasehq/mcp-server-browserbase", "--contextId", ""],
157+
"env": {
158+
"BROWSERBASE_API_KEY": "",
159+
"BROWSERBASE_PROJECT_ID": ""
120160
}
121161
}
122162
}
123-
163+
}
124164
```
125165

126166
### Cookie Injection
@@ -132,23 +172,23 @@ You can flag cookies into the MCP by adding the cookies.json to your MCP Config.
132172
To use proxies in STDIO, set the --proxies flag in your MCP Config. Your cookies JSON must be in the type of [Playwright Cookies](https://playwright.dev/docs/api/class-browsercontext#browser-context-cookies)
133173

134174
```json
135-
{
136-
"mcpServers": {
137-
"playwright": {
138-
"command" : "npx",
139-
"args" : [
140-
"@browserbasehq/mcp-server-browserbase", "cookies",
141-
"{
142-
COOKIES JSON IN TYPE OF PLAYWRIGHT COOKIES
143-
}"
144-
],
145-
"env": {
146-
"BROWSERBASE_API_KEY": "",
147-
"BROWSERBASE_PROJECT_ID": ""
148-
}
175+
{
176+
"mcpServers": {
177+
"browserbase" {
178+
"command" : "npx",
179+
"args" : [
180+
"@browserbasehq/mcp-server-browserbase", "--cookies",
181+
'{
182+
"cookies": json,
183+
}'
184+
],
185+
"env": {
186+
"BROWSERBASE_API_KEY": "",
187+
"BROWSERBASE_PROJECT_ID": ""
149188
}
150189
}
151190
}
191+
}
152192
```
153193

154194
### Browser Viewport Sizing
@@ -158,22 +198,22 @@ The default viewport sizing for a browser session is 1024 x 768. You can adjust
158198
Here's how to use it for custom browser sizing. We recommend to stick with 16:9 aspect ratios (ie: 1920 x 1080, 1280, 720, 1024 x 768)
159199

160200
```json
161-
{
162-
"mcpServers": {
163-
"playwright": {
164-
"command" : "npx",
165-
"args" : [
166-
"@browserbasehq/mcp-server-browserbase",
167-
"--browserHeight" : 1080,
168-
"--browserWidth" : 1920,
169-
],
170-
"env": {
171-
"BROWSERBASE_API_KEY": "",
172-
"BROWSERBASE_PROJECT_ID": ""
173-
}
201+
{
202+
"mcpServers": {
203+
"browserbase": {
204+
"command" : "npx",
205+
"args" : [
206+
"@browserbasehq/mcp-server-browserbase",
207+
"--browserHeight 1080",
208+
"--browserWidth 1920",
209+
],
210+
"env": {
211+
"BROWSERBASE_API_KEY": "",
212+
"BROWSERBASE_PROJECT_ID": ""
174213
}
175214
}
176215
}
216+
}
177217
```
178218

179219
## Structure
@@ -243,9 +283,9 @@ These tools are useful for:
243283
- Debugging cookie-related issues
244284
- Manipulating cookie attributes (expiration, security flags, etc.)
245285

246-
## TODO
286+
## TODO/Roadmap
247287

248288
* Implement true `ref`-based interaction logic for click, type, drag, hover, select_option.
249289
* Implement element-specific screenshots using `ref`.
250-
* Add more standard Playwright MCP tools (tabs, navigation, etc.).
290+
* Add more standard MCP tools (tabs, navigation, etc.).
251291
* Add tests.

browserbase/src/tools/common.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
export {}; // Ensure file is treated as a module
1212

1313
import { z } from 'zod';
14-
import type { Tool, ToolSchema, ToolContext, ToolResult } from "./tool.js"; // Assuming ToolContext is needed if handle uses context
14+
import type { Tool, ToolSchema, ToolResult } from "./tool.js"; // Assuming ToolContext is needed if handle uses context
1515
import type { Context } from '../context.js'; // Import main Context for handle
1616
import type { ToolActionResult } from '../context.js'; // Import ToolActionResult
1717

1818
// Assuming createSuccessResult/createErrorResult exist in toolUtils.js
19-
import { createSuccessResult, createErrorResult } from './toolUtils.js';
20-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
19+
// import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2120

2221
// --- Tool: Wait ---
2322
const WaitInputSchema = z.object({

0 commit comments

Comments
 (0)