1
1
# Playwright Browserbase MCP Server
2
2
3
+ ![ cover] ( ../assets/browserbase-mcp.png )
4
+
3
5
A Model Context Protocol server that uses Playwright and Browserbase
4
6
to provide browser automation tools.
5
7
8
+ <div >
9
+ <a href =" https://www.loom.com/share/d285d6093b2843e98908c65592031218 " >
10
+ <img style =" max-width :600px ;" src =" https://cdn.loom.com/sessions/thumbnails/d285d6093b2843e98908c65592031218-1ab1288912ffd40c-full-play.gif " >
11
+ </a >
12
+ </div >
13
+
6
14
## How to setup in MCP json
7
15
8
- ### Local Dev
16
+ You can either use our Server hosted on NPM or run it completely locally by cloning this repo.
17
+
18
+ #### To run on NPM (Recommended)
19
+
20
+ Go into your MCP Config JSON and add the Browserbase Server:
21
+
22
+ ``` json
23
+ {
24
+ "mcpServers" : {
25
+ "browserbase" : {
26
+ "command" : " npx" ,
27
+ "args" : [" @browserbasehq/mcp-server-browserbase" ],
28
+ "env" : {
29
+ "BROWSERBASE_API_KEY" : " " ,
30
+ "BROWSERBASE_PROJECT_ID" : " "
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ Thats it! Reload your MCP client and Claude will be able to use Browserbase.
38
+
39
+ #### To run 100% local:
40
+
41
+ ``` bash
42
+ # Clone the Repo
43
+ git clone https://github.com/browserbase/mcp-server-browserbase.git
44
+
45
+ # Install the dependencies in the proper directory and build the project
46
+ cd browserbase
47
+ npm install && npm run build
48
+
49
+ ```
9
50
10
- To run locally we can use STDIO or self-host over SSE.
51
+ Then in your MCP Config JSON run the server. To run locally we can use STDIO or self-host over SSE.
11
52
12
53
### STDIO:
13
54
14
55
To your MCP Config JSON file add the following:
15
56
16
57
``` json
17
- {
18
- "mcpServers" : {
19
- "playwright" : {
20
- "command" : " node" ,
21
- "args" : [" /path/to/mcp-server-browserbase/browserbase/cli.js" ],
22
- "env" : {
23
- "BROWSERBASE_API_KEY" : " " ,
24
- "BROWSERBASE_PROJECT_ID" : " "
58
+ {
59
+ "mcpServers" : {
60
+ "browserbase" : {
61
+ "command" : " node" ,
62
+ "args" : [" /path/to/mcp-server-browserbase/browserbase/cli.js" ],
63
+ "env" : {
64
+ "BROWSERBASE_API_KEY" : " " ,
65
+ "BROWSERBASE_PROJECT_ID" : " "
66
+ }
67
+ }
25
68
}
26
- }
27
- }
28
- }
69
+ }
29
70
```
30
71
31
72
### SSE:
@@ -73,6 +114,8 @@ The Browserbase MCP server accepts the following command-line flags:
73
114
74
115
These flags can be passed directly to the CLI or configured in your MCP configuration file.
75
116
117
+ ### NOTE:
118
+
76
119
Currently, these flags can only be used with the local server (npx @browserbasehq/mcp-server-browserbase ).
77
120
78
121
____
@@ -83,12 +126,12 @@ ____
83
126
84
127
Here are our docs on [ Proxies] ( https://docs.browserbase.com/features/proxies ) .
85
128
86
- To use proxies in STDIO, set the --proxies flag in your MCP Config
129
+ To use proxies in STDIO, set the --proxies flag in your MCP Config:
87
130
88
131
``` json
89
132
{
90
133
"mcpServers" : {
91
- "playwright " : {
134
+ "browserbase " : {
92
135
"command" : " npx" ,
93
136
"args" : [" @browserbasehq/mcp-server-browserbase" , " --proxies" ],
94
137
"env" : {
@@ -105,12 +148,12 @@ To use proxies in STDIO, set the --proxies flag in your MCP Config
105
148
106
149
Here are our docs on [ Contexts] ( https://docs.browserbase.com/features/contexts )
107
150
108
- To use proxies in STDIO, set the --proxies flag in your MCP Config
151
+ To use contexts in STDIO, set the --contextId flag in your MCP Config:
109
152
110
153
``` json
111
154
{
112
155
"mcpServers" : {
113
- "playwright " : {
156
+ "browserbase " : {
114
157
"command" : " npx" ,
115
158
"args" : [" @browserbasehq/mcp-server-browserbase" , " --contextId" , " <YOUR_CONTEXT_ID>" ],
116
159
"env" : {
@@ -134,13 +177,13 @@ To use proxies in STDIO, set the --proxies flag in your MCP Config. Your cookies
134
177
``` json
135
178
{
136
179
"mcpServers" : {
137
- "playwright" : {
180
+ " browserbase " {
138
181
"command" : " npx" ,
139
182
"args" : [
140
- " @browserbasehq/mcp-server-browserbase" , " cookies" ,
141
- " {
142
- COOKIES JSON IN TYPE OF PLAYWRIGHT COOKIES
143
- }"
183
+ " @browserbasehq/mcp-server-browserbase" , " -- cookies" ,
184
+ ' {
185
+ "cookies" : json,
186
+ }'
144
187
],
145
188
"env" : {
146
189
"BROWSERBASE_API_KEY" : " " ,
@@ -160,12 +203,12 @@ Here's how to use it for custom browser sizing. We recommend to stick with 16:9
160
203
``` json
161
204
{
162
205
"mcpServers" : {
163
- "playwright " : {
206
+ "browserbase " : {
164
207
"command" : " npx" ,
165
208
"args" : [
166
209
" @browserbasehq/mcp-server-browserbase" ,
167
- "--browserHeight" : 1080 ,
168
- "--browserWidth" : 1920 ,
210
+ " --browserHeight 1080" ,
211
+ " --browserWidth 1920" ,
169
212
],
170
213
"env" : {
171
214
"BROWSERBASE_API_KEY" : " " ,
@@ -243,9 +286,9 @@ These tools are useful for:
243
286
- Debugging cookie-related issues
244
287
- Manipulating cookie attributes (expiration, security flags, etc.)
245
288
246
- ## TODO
289
+ ## TODO/Roadmap
247
290
248
291
* Implement true ` ref ` -based interaction logic for click, type, drag, hover, select_option.
249
292
* Implement element-specific screenshots using ` ref ` .
250
- * Add more standard Playwright MCP tools (tabs, navigation, etc.).
293
+ * Add more standard MCP tools (tabs, navigation, etc.).
251
294
* Add tests.
0 commit comments