1
- # ➡️ browser-use mcp server
1
+ # browser-use-mcp-server
2
+
3
+ <div align =" center " >
2
4
3
5
[ ![ Twitter URL] ( https://img.shields.io/twitter/url/https/twitter.com/cobrowser.svg?style=social&label=Follow%20%40cobrowser )] ( https://x.com/cobrowser )
4
6
[ ![ PyPI version] ( https://badge.fury.io/py/browser-use-mcp-server.svg )] ( https://pypi.org/project/browser-use-mcp-server/ )
5
7
6
- [ browser-use] ( https://github.com/browser-use/browser-use ) MCP Server with SSE +
7
- stdio transport
8
-
9
- ### Requirements
10
-
11
- - [ uv] ( https://github.com/astral-sh/uv )
12
- - [ mcp-proxy] ( https://github.com/sparfenyuk/mcp-proxy ) (for stdio)
8
+ ** An MCP server that enables AI agents to control web browsers using [ browser-use] ( https://github.com/browser-use/browser-use ) .**
13
9
14
- ```
15
- # 1. Install uv
16
- curl -LsSf https://astral.sh/uv/install.sh | sh
17
- # 2. Install mcp-proxy pypi package via uv
18
- uv tool install mcp-proxy
19
- ```
10
+ </div >
20
11
21
- ### Quickstart
12
+ ## Prerequisites
22
13
23
- Starting in SSE mode:
14
+ - [ uv] ( https://github.com/astral-sh/uv ) - Fast Python package manager
15
+ - [ Playwright] ( https://playwright.dev/ ) - Browser automation
16
+ - [ mcp-proxy] ( https://github.com/sparfenyuk/mcp-proxy ) - Required for stdio mode
24
17
25
18
``` bash
26
- uv sync
27
- uv pip install playwright
28
- uv run playwright install --with-deps --no-shell chromium
29
- uv run server --port 8000
30
- ```
31
-
32
- With stdio mode:
33
-
34
- ``` bash
35
- # Run with stdio mode and specify a proxy port
36
- uv run server --stdio --proxy-port 8001
37
-
38
- # Or just stdio mode (random proxy port)
39
- uv run server --stdio
19
+ # Install prerequisites
20
+ curl -LsSf https://astral.sh/uv/install.sh | sh
21
+ uv tool install mcp-proxy
40
22
```
41
23
42
- - the .env requires the following:
24
+ ## Environment
43
25
26
+ Create a ` .env ` file:
44
27
```
45
- OPENAI_API_KEY=[ your api key]
46
- CHROME_PATH=[only change this if you have a custom chrome build]
47
- PATIENT=false # Set to true if you want api calls to wait for tasks to complete (default is false)
28
+ OPENAI_API_KEY=your- api- key
29
+ CHROME_PATH=optional/path/to/ chrome
30
+ PATIENT=false # Set to true if API calls should wait for task completion
48
31
```
49
32
50
- When building the docker image, you can use Docker secrets for VNC password:
33
+ ## Installation
51
34
52
35
``` bash
53
- # With Docker secrets (recommended for production)
54
- echo " your-secure-password" > vnc_password.txt
55
- docker run -v $( pwd) /vnc_password.txt:/run/secrets/vnc_password your-image-name
56
-
57
- # Or during development with the default password
58
- docker build .
59
- ```
60
-
61
- ### Local Development and Testing
62
-
63
- To develop and test the package locally:
64
-
65
- 1 . Build a distributable wheel:
66
-
67
- ``` bash
68
- # From the project root directory
69
- uv build
36
+ # Install dependencies
37
+ uv sync
38
+ uv pip install playwright
39
+ uv run playwright install --with-deps --no-shell chromium
70
40
```
71
41
72
- 2 . Install it as a global tool using the built wheel:
42
+ ## Usage
73
43
74
- ``` bash
75
- uv tool install dist/browser_use_mcp_server-* .whl
76
- ```
77
-
78
- 3 . Run the tool from any directory:
44
+ ### SSE Mode
79
45
80
46
``` bash
81
- # Set your OpenAI API key for the current session
82
- export OPENAI_API_KEY=your-api-key-here
83
-
84
- # Or provide it inline for a one-time run
85
- OPENAI_API_KEY=your-api-key-here browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
47
+ # Run directly from source
48
+ uv run server --port 8000
86
49
```
87
50
88
- 4 . After making changes, rebuild and reinstall:
51
+ ### stdio Mode
89
52
90
53
``` bash
54
+ # 1. Build and install globally
91
55
uv build
92
- uv tool uninstall browser-use-mcp-server
56
+ uv tool uninstall browser-use-mcp-server 2> /dev/null || true
93
57
uv tool install dist/browser_use_mcp_server-* .whl
94
- ```
95
-
96
- ### Tools
97
-
98
- - [x] SSE transport
99
- - [x] stdio transport (via mcp-proxy)
100
- - [x] browser_use - Initiates browser tasks with URL and action
101
- - [x] browser_get_result - Retrieves results of async browser tasks
102
- - [x] VNC server - stream the dockerized browser to your client
103
-
104
- ### VNC
105
-
106
- the dockerfile has a vnc server with a default password of browser-use. connect
107
- to it:
108
58
59
+ # 2. Run with stdio transport
60
+ browser-use-mcp-server run server --stdio --proxy-port 9000
109
61
```
110
- docker build -t browser-use-mcp-server .
111
- docker run --rm -p8000:8000 -p5900:5900 browser-use-mcp-server
112
- git clone https://github.com/novnc/noVNC
113
- cd noVNC
114
- ./utils/novnc_proxy --vnc localhost:5900
115
- ```
116
-
117
- <p align =" center " >
118
- <img width =" 428 " alt =" Screenshot 2025-03-24 at 12 03 15 PM " src =" https://github.com/user-attachments/assets/45bc5bee-418d-4182-94f5-db84b4fc0b3a " />
119
- <br >
120
- <img width =" 428 " alt =" Screenshot 2025-03-24 at 12 11 42 PM " src =" https://github.com/user-attachments/assets/7db53f41-fc00-4e48-8892-f7108096f9c4 " />
121
- </p >
122
-
123
- ### Supported Clients
124
62
125
- - cursor.ai
126
- - claude desktop
127
- - claude code
128
- - windsurf ([ windsurf] ( https://codeium.com/windsurf ) doesn't support SSE, only
129
- stdio)
63
+ ## Client Configuration
130
64
131
- #### SSE Mode
132
-
133
- After running the server in SSE mode, add http://localhost:8000/sse to your
134
- client UI, or in a mcp.json file:
65
+ ### SSE Mode
135
66
136
67
``` json
137
68
{
@@ -143,29 +74,14 @@ client UI, or in a mcp.json file:
143
74
}
144
75
```
145
76
146
- #### stdio Mode
147
-
148
- When running in stdio mode, the server will automatically start both the SSE
149
- server and mcp-proxy. The proxy handles the conversion between stdio and SSE
150
- protocols. No additional configuration is needed - just start your client and it
151
- will communicate with the server through stdin/stdout.
152
-
153
- For Windsurf integration, add this to your config:
77
+ ### stdio Mode
154
78
155
79
``` json
156
80
{
157
81
"mcpServers" : {
158
82
"browser-server" : {
159
83
"command" : " browser-use-mcp-server" ,
160
- "args" : [
161
- " run" ,
162
- " server" ,
163
- " --port" ,
164
- " 8000" ,
165
- " --stdio" ,
166
- " --proxy-port" ,
167
- " 9000"
168
- ],
84
+ "args" : [" run" , " server" , " --stdio" , " --proxy-port" , " 9000" ],
169
85
"env" : {
170
86
"OPENAI_API_KEY" : " your-api-key"
171
87
}
@@ -174,35 +90,103 @@ For Windsurf integration, add this to your config:
174
90
}
175
91
```
176
92
177
- ### Client Configuration Paths
93
+ ### Config Locations
178
94
179
- #### Cursor
95
+ | Client | Configuration Path |
96
+ | --------| -------------------|
97
+ | Cursor | ` ./.cursor/mcp.json ` |
98
+ | Windsurf | ` ~/.codeium/windsurf/mcp_config.json ` |
99
+ | Claude (Mac) | ` ~/Library/Application Support/Claude/claude_desktop_config.json ` |
100
+ | Claude (Windows) | ` %APPDATA%\Claude\claude_desktop_config.json ` |
180
101
181
- - ` ./.cursor/mcp.json `
102
+ ## Features
182
103
183
- #### Windsurf
104
+ - [x] ** Browser Automation** : Control browsers through AI agents
105
+ - [x] ** Dual Transport** : Support for both SSE and stdio protocols
106
+ - [x] ** VNC Streaming** : Watch browser automation in real-time
107
+ - [x] ** Async Tasks** : Execute browser operations asynchronously
184
108
185
- - ` ~/.codeium/windsurf/mcp_config.json `
109
+ ## Local Development
186
110
187
- #### Claude
111
+ To develop and test the package locally:
188
112
189
- - ` ~/Library/Application Support/Claude/claude_desktop_config.json `
190
- - ` %APPDATA%\Claude\claude_desktop_config.json `
113
+ 1 . Build a distributable wheel:
114
+ ``` bash
115
+ # From the project root directory
116
+ uv build
117
+ ```
118
+
119
+ 2 . Install it as a global tool:
120
+ ``` bash
121
+ uv tool uninstall browser-use-mcp-server 2> /dev/null || true
122
+ uv tool install dist/browser_use_mcp_server-* .whl
123
+ ```
124
+
125
+ 3 . Run from any directory:
126
+ ``` bash
127
+ # Set your OpenAI API key for the current session
128
+ export OPENAI_API_KEY=your-api-key-here
129
+
130
+ # Or provide it inline for a one-time run
131
+ OPENAI_API_KEY=your-api-key-here browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
132
+ ```
191
133
192
- ### Example Usage
134
+ 4 . After making changes, rebuild and reinstall:
135
+ ``` bash
136
+ uv build
137
+ uv tool uninstall browser-use-mcp-server
138
+ uv tool install dist/browser_use_mcp_server-* .whl
139
+ ```
193
140
194
- Try asking your LLM the following:
141
+ ## Docker
195
142
196
- ` open https://news.ycombinator.com and return the top ranked article `
143
+ ``` bash
144
+ # Run with default VNC password
145
+ docker build -t browser-use-mcp-server .
146
+ docker run --rm -p8000:8000 -p5900:5900 browser-use-mcp-server
147
+
148
+ # Use custom VNC password
149
+ echo " your-password" > vnc_password.txt
150
+ docker run --rm -p8000:8000 -p5900:5900 \
151
+ -v $( pwd) /vnc_password.txt:/run/secrets/vnc_password \
152
+ browser-use-mcp-server
153
+ ```
154
+
155
+ ### VNC Viewer
156
+
157
+ ``` bash
158
+ # Browser-based viewer
159
+ git clone https://github.com/novnc/noVNC
160
+ cd noVNC
161
+ ./utils/novnc_proxy --vnc localhost:5900
162
+ ```
163
+
164
+ Default password: ` browser-use `
165
+
166
+ <div align =" center " >
167
+ <img width =" 428 " alt =" VNC Screenshot " src =" https://github.com/user-attachments/assets/45bc5bee-418d-4182-94f5-db84b4fc0b3a " />
168
+ <br ><br >
169
+ <img width =" 428 " alt =" VNC Screenshot " src =" https://github.com/user-attachments/assets/7db53f41-fc00-4e48-8892-f7108096f9c4 " />
170
+ </div >
171
+
172
+ ## Example
173
+
174
+ Try asking your AI:
175
+
176
+ ```
177
+ open https://news.ycombinator.com and return the top ranked article
178
+ ```
197
179
198
- ### Help
180
+ ## Support
199
181
200
- for issues or interest reach out @ https://cobrowser.xyz
182
+ For issues or inquiries: [ cobrowser.xyz ] ( https://cobrowser.xyz )
201
183
202
- # Stars
184
+ ## Star History
203
185
204
- <picture >
205
- <source media =" (prefers-color-scheme: dark) " srcset =" https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date&theme=dark " />
206
- <source media =" (prefers-color-scheme: light) " srcset =" https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date " />
207
- <img alt =" Star History Chart " src =" https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date " />
208
- </picture >
186
+ <div align =" center " >
187
+ <picture >
188
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date&theme=dark" />
189
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date" />
190
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date" />
191
+ </picture >
192
+ </div >
0 commit comments