@roxybrowser/openapi 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,352 +1,352 @@
1
- # RoxyBrowser MCP Server
2
-
3
- [English](README.md) | [中文](README_CN.md)
4
-
5
- A Model Context Protocol (MCP) server for [RoxyBrowser](https://www.roxybrowser.com/) that provides AI assistants with the ability to manage browser instances and obtain Chrome DevTools Protocol (CDP) WebSocket endpoints for automation.
6
-
7
- ## Features
8
-
9
- - 🚀 **Browser Management**: Open and close RoxyBrowser instances programmatically
10
- - 🔗 **CDP Integration**: Get WebSocket endpoints for Chrome DevTools Protocol automation
11
- - 🤖 **AI-Friendly**: Seamlessly integrates with AI assistants through MCP
12
- - 🎯 **Playwright Ready**: Works with [RoxyBrowser Playwright MCP](https://github.com/roxybrowserlabs/roxybrowser-playwright-mcp) (RoxyBrowser's customized Playwright MCP)
13
- - 📊 **Workspace Support**: Manage browsers across different workspaces and projects
14
- - 🛠️ **Browser Creation**: Create browsers (single or batch) with full configuration
15
- - 🌐 **Proxy Management**: List, create, detect, and manage proxy configurations
16
- - 👤 **Account Management**: Manage platform accounts and credentials in workspaces
17
- - 🔧 **Advanced Configuration**: Fingerprints, cache clear, random fingerprint, and more
18
- - 🏥 **Health Check**: Server and workspace connectivity diagnostics
19
-
20
- ## Quick Start
21
-
22
- ### Prerequisites
23
-
24
- 1. **RoxyBrowser** installed and running
25
- 2. **RoxyBrowser API** enabled in settings:
26
- - Open RoxyBrowser → API
27
- - Set "API Status" to "Enable"
28
- - Copy your API Key
29
- - Note the API port (default: 50000)
30
-
31
- ### MCP Client Configuration
32
-
33
- Add both RoxyBrowser OpenAPI and RoxyBrowser Playwright MCP to your MCP client configuration:
34
-
35
- **Claude Desktop / VS Code / Cursor:**
36
- ```json
37
- {
38
- "mcpServers": {
39
- "roxybrowser-openapi": {
40
- "command": "npx",
41
- "args": ["@roxybrowser/openapi@latest"],
42
- "env": {
43
- "ROXY_API_KEY": "YOUR API KEY",
44
- "ROXY_API_HOST": "http://127.0.0.1:50000"
45
- }
46
- },
47
- "roxybrowser-playwright-mcp": {
48
- "command": "npx",
49
- "args": ["@roxybrowser/playwright-mcp@latest"]
50
- }
51
- }
52
- }
53
- ```
54
-
55
- **Note:** Replace `YOUR API KEY` and `YOUR API HOST` with your actual RoxyBrowser credentials.
56
-
57
- ## Usage
58
-
59
- This package supports three ways to run: **CLI**, **in-process (programmatic)**, and **as a library** for custom integration.
60
-
61
- ### 1. CLI (direct start)
62
-
63
- Start the MCP server from the command line. Ideal for MCP clients that spawn the server as a subprocess.
64
-
65
- ```bash
66
- # After npm install -g @roxybrowser/openapi
67
- roxy-browser-mcp
68
-
69
- # Or with npx (no global install)
70
- npx @roxybrowser/openapi
71
-
72
- # After cloning and building
73
- npm run build && node lib/index.js
74
- ```
75
-
76
- CLI options (config: **CLI args > environment variables > defaults**):
77
-
78
- - `-V, --version` — Show version
79
- - `-h, --help` — Show usage
80
- - `-H, --api-host <url>` — RoxyBrowser API base URL (default: `http://127.0.0.1:50000`)
81
- - `-k, --api-key <key>` — API key (required unless set via env)
82
- - `-t, --timeout <ms>` — Request timeout in milliseconds (default: `30000`)
83
-
84
- Environment variables (used when an option is not passed): `ROXY_API_HOST`, `ROXY_API_KEY`, `ROXY_TIMEOUT`.
85
-
86
- Examples:
87
-
88
- ```bash
89
- roxy-browser-mcp --api-key "your-key"
90
- roxy-browser-mcp -k "your-key" -H http://127.0.0.1:50000
91
- ROXY_API_KEY=your-key roxy-browser-mcp
92
- ```
93
-
94
- ### 2. In-process (programmatic start)
95
-
96
- Run the MCP server inside your own Node process (same process, stdio transport). Useful when you want to start the server from code instead of a separate CLI process.
97
-
98
- ```ts
99
- import { runServer } from '@roxybrowser/openapi'
100
-
101
- // Starts MCP server on stdio; runs until process exits
102
- await runServer()
103
- ```
104
-
105
- Or use the server class for more control:
106
-
107
- ```ts
108
- import { RoxyBrowserMCPServer } from '@roxybrowser/openapi'
109
-
110
- const server = new RoxyBrowserMCPServer()
111
- await server.run()
112
- ```
113
-
114
- Set env vars (`ROXY_API_KEY`, `ROXY_API_HOST`) before calling `runServer()`; config is read at process start and cannot be changed at runtime.
115
-
116
- ### 3. Library (secondary development)
117
-
118
- Use the exported tools and API helpers in your own app: call RoxyBrowser APIs without running the MCP server.
119
-
120
- ```ts
121
- import {
122
- listBrowsers,
123
- openBrowser,
124
- createBrowser,
125
- listWorkspaces,
126
- healthCheck,
127
- } from '@roxybrowser/openapi'
128
-
129
- // Set ROXY_API_KEY and ROXY_API_HOST (env) before any request; config is fixed at process start
130
- // Use tool handlers directly (same as MCP tool calls)
131
- const listResult = await listBrowsers.handle({ workspaceId: 1 })
132
- const openResult = await openBrowser.handle({
133
- workspaceId: 1,
134
- dirIds: ['browser-dir-id'],
135
- })
136
- const createResult = await createBrowser.handle({
137
- workspaceId: 1,
138
- windowName: 'My Browser',
139
- })
140
- ```
141
-
142
- Each tool exports:
143
-
144
- - `.name` — Tool name (e.g. `roxy_list_browsers`)
145
- - `.schema` — MCP tool schema (`name`, `description`, `inputSchema`)
146
- - `.handle(args)` — Async handler; pass the same arguments as the MCP tool
147
-
148
- You can also use the low-level `request()` helper and types:
149
-
150
- ```ts
151
- import { request, resolveConfig } from '@roxybrowser/openapi'
152
- import type { RoxyClientConfig, BrowserListItem, Workspace } from '@roxybrowser/openapi'
153
-
154
- const res = await request('/browser/list_v3?workspaceId=1', { method: 'GET' })
155
- ```
156
-
157
- This allows you to build custom UIs, scripts, or other MCP servers that reuse RoxyBrowser logic.
158
-
159
- ## Available Tools
160
-
161
- ### Workspace
162
- - `roxy_list_workspaces` - List all available workspaces and their projects
163
-
164
- ### Browser
165
- - `roxy_list_browsers` - List browsers in a workspace/project with filtering
166
- - `roxy_create_browser` - Create a browser with full configuration
167
- - `roxy_batch_create_browsers` - Create multiple browsers in batch
168
- - `roxy_open_browsers` - Open browsers and get CDP WebSocket endpoints for automation
169
- - `roxy_update_browser` - Update existing browser configuration
170
- - `roxy_close_browsers` - Close running browsers (does NOT free quota)
171
- - `roxy_delete_browsers` - Delete browser profiles permanently (frees quota)
172
- - `roxy_get_browser_detail` - Get detailed browser information and configuration
173
- - `roxy_get_connection_info` - Get CDP endpoints and PIDs for opened browsers
174
- - `roxy_clear_local_cache` - Clear local browser cache
175
- - `roxy_clear_server_cache` - Clear server-side browser cache
176
- - `roxy_random_fingerprint` - Randomize browser fingerprint
177
- - `roxy_list_labels` - Get browser labels/tags for organization
178
-
179
- ### Proxy
180
- - `roxy_list_proxies` - List proxy configurations in a workspace
181
- - `roxy_store_proxies` - Get list of proxies you've purchased (store)
182
- - `roxy_create_proxy` - Create a proxy configuration
183
- - `roxy_batch_create_proxies` - Create multiple proxies in batch
184
- - `roxy_detect_proxy` - Detect/test proxy availability
185
- - `roxy_modify_proxy` - Modify existing proxy configuration
186
- - `roxy_delete_proxies` - Delete proxy configurations
187
-
188
- ### Account
189
- - `roxy_list_accounts` - List platform accounts and credentials in a workspace
190
- - `roxy_create_account` - Create a platform account
191
- - `roxy_batch_create_accounts` - Create multiple accounts in batch
192
- - `roxy_modify_account` - Modify existing account
193
- - `roxy_delete_accounts` - Delete accounts
194
-
195
- ### Utilities
196
- - `roxy_health_check` - Server health check and workspace/browser connectivity diagnostics
197
-
198
- ## Complete Workflow Examples
199
-
200
- ### Example 1: Quick Browser Automation Setup
201
-
202
- ```
203
- 1. AI: "Create a browser in workspace 1 with name 'Test Browser'"
204
- → Uses roxy_create_browser
205
- → Returns browser ID ready for use
206
-
207
- 2. AI: "Open the browser I just created"
208
- → Uses roxy_open_browsers with the returned ID
209
- → Returns CDP WebSocket URL like: ws://127.0.0.1:52314/devtools/browser/xxx
210
-
211
- 3. AI: "Navigate to gmail.com, login, and send emails"
212
- → Uses RoxyBrowser Playwright MCP tools (browser_navigate, browser_type, browser_click, etc.)
213
- → RoxyBrowser Playwright MCP connects to the opened browser via CDP endpoint
214
-
215
- 4. AI: "Close the browser when done"
216
- → Uses roxy_close_browsers
217
- ```
218
-
219
- ### Example 2: Browser with Proxy
220
-
221
- ```
222
- 1. AI: "Detect my proxy before creating browsers"
223
- → Uses roxy_detect_proxy
224
- → Confirms proxy is available
225
-
226
- 2. AI: "Create a browser with SOCKS5 proxy and 1920x1080 in workspace 2"
227
- → Uses roxy_create_browser with proxy configuration
228
- → Returns configured browser ID
229
-
230
- 3. AI: "Open the browser and start automation"
231
- → Uses roxy_open_browsers → gets CDP endpoint
232
- → RoxyBrowser Playwright MCP connects and begins automation
233
- ```
234
-
235
- ## Integration with Playwright MCP
236
-
237
- RoxyBrowser MCP is designed to work seamlessly with [RoxyBrowser Playwright MCP](https://github.com/roxybrowserlabs/roxybrowser-playwright-mcp), our customized Playwright MCP server built specifically for RoxyBrowser compatibility.
238
-
239
- **RoxyBrowser Playwright MCP** is based on [Microsoft's Playwright MCP](https://github.com/microsoft/playwright-mcp) with enhancements for RoxyBrowser's fingerprint browser features.
240
-
241
- ### Workflow
242
-
243
- 1. Use RoxyBrowser OpenAPI MCP to create and open browsers
244
- 2. Get CDP WebSocket endpoints from opened browsers
245
- 3. Use RoxyBrowser Playwright MCP to automate browser tasks with full Playwright capabilities
246
-
247
- Both servers work together seamlessly when configured in your MCP client (see configuration above).
248
-
249
- ## Development
250
-
251
- ```bash
252
- # Development mode with auto-rebuild
253
- npm run dev
254
-
255
- # Build for production
256
- npm run build
257
-
258
- # Build and run the test suite
259
- npm test
260
-
261
- # Launch MCP Inspector against the local stdio server
262
- ROXY_API_KEY=your-key npm run inspect
263
- ```
264
-
265
- ### Test Strategy
266
-
267
- The repository now includes a lightweight test setup based on Node's built-in test runner, so no extra test framework is required.
268
-
269
- - `test/utils.test.mjs`: config resolution and HTTP request wrapper behavior
270
- - `test/tools.test.mjs`: tool handler formatting and health-check output
271
- - `test/server.test.mjs`: in-memory MCP integration using the official SDK client and transport
272
-
273
- `npm test` builds `lib/` first, then runs the tests against the built artifacts. This keeps the test path close to what gets published.
274
-
275
- ### MCP Inspector
276
-
277
- Use the official MCP Inspector to debug tool discovery and tool calls locally:
278
-
279
- ```bash
280
- # Web UI
281
- ROXY_API_KEY=your-key npm run inspect
282
-
283
- # CLI mode
284
- ROXY_API_KEY=your-key npm run inspect:cli -- --method tools/list
285
- ```
286
-
287
- Set `ROXY_API_HOST` as needed before launching Inspector.
288
-
289
- ## API Reference
290
-
291
- ### Configuration
292
-
293
- Config is resolved in this order: **CLI arguments > environment variables > defaults**.
294
-
295
- | Source | Options / Variables | Description |
296
- |--------|----------------------|-------------|
297
- | CLI | `-H, --api-host`, `-k, --api-key`, `-t, --timeout` | Pass when starting the server |
298
- | Env | `ROXY_API_HOST`, `ROXY_API_KEY`, `ROXY_TIMEOUT` | Used when CLI option not passed |
299
- | Defaults | `apiHost: http://127.0.0.1:50000`, `timeout: 30000` | Built-in defaults |
300
-
301
- Config is read from env only; use `resolveConfig()` to read current effective config (env + defaults).
302
-
303
- ## Troubleshooting
304
-
305
- ### Connection Issues
306
-
307
- **Error: "Failed to connect to RoxyBrowser API"**
308
-
309
- Check:
310
- 1. RoxyBrowser is running
311
- 2. API is enabled: RoxyBrowser → API → API Status = Enable
312
- 3. Correct API key: Copy from RoxyBrowser → API → API Key
313
- 4. Correct port: Check RoxyBrowser → API → Port Settings (default: 50000)
314
- 5. No firewall blocking http://127.0.0.1:50000
315
-
316
- ### Authentication Issues
317
-
318
- **Error: "Configuration Error: API key is required"**
319
-
320
- Set the environment variable:
321
- ```bash
322
- export ROXY_API_KEY="your_actual_api_key_from_roxybrowser"
323
- ```
324
-
325
- ### Browser Opening Issues
326
-
327
- **Error: "Insufficient profiles quota" (Code 101 or 409)**
328
-
329
- Solutions:
330
- - Purchase more profiles in RoxyBrowser Billing Center
331
- - **Delete** unused browser profiles using `roxy_delete_browsers` (closing alone does NOT free quota)
332
- - Upgrade your subscription plan
333
- - Check current quota usage in workspace settings
334
-
335
- **Some browsers fail to open:**
336
-
337
- - Check that the browser profiles exist and are not corrupted
338
- - Ensure sufficient system resources (RAM, CPU)
339
- - Verify the dirIds are valid (use `roxy_list_browsers` first)
340
- - Run `roxy_health_check` for connectivity and health diagnostics
341
-
342
- ## License
343
-
344
- MIT License - see LICENSE file for details.
345
-
346
- ## Contributing
347
-
348
- 1. Fork the repository
349
- 2. Create a feature branch
350
- 3. Make your changes
351
- 4. Add tests if applicable
352
- 5. Submit a pull request
1
+ # RoxyBrowser MCP Server
2
+
3
+ [English](README.md) | [中文](README_CN.md)
4
+
5
+ A Model Context Protocol (MCP) server for [RoxyBrowser](https://www.roxybrowser.com/) that provides AI assistants with the ability to manage browser instances and obtain Chrome DevTools Protocol (CDP) WebSocket endpoints for automation.
6
+
7
+ ## Features
8
+
9
+ - 🚀 **Browser Management**: Open and close RoxyBrowser instances programmatically
10
+ - 🔗 **CDP Integration**: Get WebSocket endpoints for Chrome DevTools Protocol automation
11
+ - 🤖 **AI-Friendly**: Seamlessly integrates with AI assistants through MCP
12
+ - 🎯 **Playwright Ready**: Works with [RoxyBrowser Playwright MCP](https://github.com/roxybrowserlabs/roxybrowser-playwright-mcp) (RoxyBrowser's customized Playwright MCP)
13
+ - 📊 **Workspace Support**: Manage browsers across different workspaces and projects
14
+ - 🛠️ **Browser Creation**: Create browsers (single or batch) with full configuration
15
+ - 🌐 **Proxy Management**: List, create, detect, and manage proxy configurations
16
+ - 👤 **Account Management**: Manage platform accounts and credentials in workspaces
17
+ - 🔧 **Advanced Configuration**: Fingerprints, cache clear, random fingerprint, and more
18
+ - 🏥 **Health Check**: Server and workspace connectivity diagnostics
19
+
20
+ ## Quick Start
21
+
22
+ ### Prerequisites
23
+
24
+ 1. **RoxyBrowser** installed and running
25
+ 2. **RoxyBrowser API** enabled in settings:
26
+ - Open RoxyBrowser → API
27
+ - Set "API Status" to "Enable"
28
+ - Copy your API Key
29
+ - Note the API port (default: 50000)
30
+
31
+ ### MCP Client Configuration
32
+
33
+ Add both RoxyBrowser OpenAPI and RoxyBrowser Playwright MCP to your MCP client configuration:
34
+
35
+ **Claude Desktop / VS Code / Cursor:**
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "roxybrowser-openapi": {
40
+ "command": "npx",
41
+ "args": ["@roxybrowser/openapi@latest"],
42
+ "env": {
43
+ "ROXY_API_KEY": "YOUR API KEY",
44
+ "ROXY_API_HOST": "http://127.0.0.1:50000"
45
+ }
46
+ },
47
+ "roxybrowser-playwright-mcp": {
48
+ "command": "npx",
49
+ "args": ["@roxybrowser/playwright-mcp@latest"]
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ **Note:** Replace `YOUR API KEY` and `YOUR API HOST` with your actual RoxyBrowser credentials.
56
+
57
+ ## Usage
58
+
59
+ This package supports three ways to run: **CLI**, **in-process (programmatic)**, and **as a library** for custom integration.
60
+
61
+ ### 1. CLI (direct start)
62
+
63
+ Start the MCP server from the command line. Ideal for MCP clients that spawn the server as a subprocess.
64
+
65
+ ```bash
66
+ # After npm install -g @roxybrowser/openapi
67
+ roxy-browser-mcp
68
+
69
+ # Or with npx (no global install)
70
+ npx @roxybrowser/openapi
71
+
72
+ # After cloning and building
73
+ npm run build && node lib/index.js
74
+ ```
75
+
76
+ CLI options (config: **CLI args > environment variables > defaults**):
77
+
78
+ - `-V, --version` — Show version
79
+ - `-h, --help` — Show usage
80
+ - `-H, --api-host <url>` — RoxyBrowser API base URL (default: `http://127.0.0.1:50000`)
81
+ - `-k, --api-key <key>` — API key (required unless set via env)
82
+ - `-t, --timeout <ms>` — Request timeout in milliseconds (default: `30000`)
83
+
84
+ Environment variables (used when an option is not passed): `ROXY_API_HOST`, `ROXY_API_KEY`, `ROXY_TIMEOUT`.
85
+
86
+ Examples:
87
+
88
+ ```bash
89
+ roxy-browser-mcp --api-key "your-key"
90
+ roxy-browser-mcp -k "your-key" -H http://127.0.0.1:50000
91
+ ROXY_API_KEY=your-key roxy-browser-mcp
92
+ ```
93
+
94
+ ### 2. In-process (programmatic start)
95
+
96
+ Run the MCP server inside your own Node process (same process, stdio transport). Useful when you want to start the server from code instead of a separate CLI process.
97
+
98
+ ```ts
99
+ import { runServer } from '@roxybrowser/openapi'
100
+
101
+ // Starts MCP server on stdio; runs until process exits
102
+ await runServer()
103
+ ```
104
+
105
+ Or use the server class for more control:
106
+
107
+ ```ts
108
+ import { RoxyBrowserMCPServer } from '@roxybrowser/openapi'
109
+
110
+ const server = new RoxyBrowserMCPServer()
111
+ await server.run()
112
+ ```
113
+
114
+ Set env vars (`ROXY_API_KEY`, `ROXY_API_HOST`) before calling `runServer()`; config is read at process start and cannot be changed at runtime.
115
+
116
+ ### 3. Library (secondary development)
117
+
118
+ Use the exported tools and API helpers in your own app: call RoxyBrowser APIs without running the MCP server.
119
+
120
+ ```ts
121
+ import {
122
+ listBrowsers,
123
+ openBrowser,
124
+ createBrowser,
125
+ listWorkspaces,
126
+ healthCheck,
127
+ } from '@roxybrowser/openapi'
128
+
129
+ // Set ROXY_API_KEY and ROXY_API_HOST (env) before any request; config is fixed at process start
130
+ // Use tool handlers directly (same as MCP tool calls)
131
+ const listResult = await listBrowsers.handle({ workspaceId: 1 })
132
+ const openResult = await openBrowser.handle({
133
+ workspaceId: 1,
134
+ dirIds: ['browser-dir-id'],
135
+ })
136
+ const createResult = await createBrowser.handle({
137
+ workspaceId: 1,
138
+ windowName: 'My Browser',
139
+ })
140
+ ```
141
+
142
+ Each tool exports:
143
+
144
+ - `.name` — Tool name (e.g. `roxy_list_browsers`)
145
+ - `.schema` — MCP tool schema (`name`, `description`, `inputSchema`)
146
+ - `.handle(args)` — Async handler; pass the same arguments as the MCP tool
147
+
148
+ You can also use the low-level `request()` helper and types:
149
+
150
+ ```ts
151
+ import { request, resolveConfig } from '@roxybrowser/openapi'
152
+ import type { RoxyClientConfig, BrowserListItem, Workspace } from '@roxybrowser/openapi'
153
+
154
+ const res = await request('/browser/list_v3?workspaceId=1', { method: 'GET' })
155
+ ```
156
+
157
+ This allows you to build custom UIs, scripts, or other MCP servers that reuse RoxyBrowser logic.
158
+
159
+ ## Available Tools
160
+
161
+ ### Workspace
162
+ - `roxy_list_workspaces` - List all available workspaces and their projects
163
+
164
+ ### Browser
165
+ - `roxy_list_browsers` - List browsers in a workspace/project with filtering
166
+ - `roxy_create_browser` - Create a browser with full configuration
167
+ - `roxy_batch_create_browsers` - Create multiple browsers in batch
168
+ - `roxy_open_browsers` - Open browsers and get CDP WebSocket endpoints for automation
169
+ - `roxy_update_browser` - Update existing browser configuration
170
+ - `roxy_close_browsers` - Close running browsers (does NOT free quota)
171
+ - `roxy_delete_browsers` - Delete browser profiles permanently (frees quota)
172
+ - `roxy_get_browser_detail` - Get detailed browser information and configuration
173
+ - `roxy_get_connection_info` - Get CDP endpoints and PIDs for opened browsers
174
+ - `roxy_clear_local_cache` - Clear local browser cache
175
+ - `roxy_clear_server_cache` - Clear server-side browser cache
176
+ - `roxy_random_fingerprint` - Randomize browser fingerprint
177
+ - `roxy_list_labels` - Get browser labels/tags for organization
178
+
179
+ ### Proxy
180
+ - `roxy_list_proxies` - List proxy configurations in a workspace
181
+ - `roxy_store_proxies` - Get list of proxies you've purchased (store)
182
+ - `roxy_create_proxy` - Create a proxy configuration
183
+ - `roxy_batch_create_proxies` - Create multiple proxies in batch
184
+ - `roxy_detect_proxy` - Detect/test proxy availability
185
+ - `roxy_modify_proxy` - Modify existing proxy configuration
186
+ - `roxy_delete_proxies` - Delete proxy configurations
187
+
188
+ ### Account
189
+ - `roxy_list_accounts` - List platform accounts and credentials in a workspace
190
+ - `roxy_create_account` - Create a platform account
191
+ - `roxy_batch_create_accounts` - Create multiple accounts in batch
192
+ - `roxy_modify_account` - Modify existing account
193
+ - `roxy_delete_accounts` - Delete accounts
194
+
195
+ ### Utilities
196
+ - `roxy_health_check` - Server health check and workspace/browser connectivity diagnostics
197
+
198
+ ## Complete Workflow Examples
199
+
200
+ ### Example 1: Quick Browser Automation Setup
201
+
202
+ ```
203
+ 1. AI: "Create a browser in workspace 1 with name 'Test Browser'"
204
+ → Uses roxy_create_browser
205
+ → Returns browser ID ready for use
206
+
207
+ 2. AI: "Open the browser I just created"
208
+ → Uses roxy_open_browsers with the returned ID
209
+ → Returns CDP WebSocket URL like: ws://127.0.0.1:52314/devtools/browser/xxx
210
+
211
+ 3. AI: "Navigate to gmail.com, login, and send emails"
212
+ → Uses RoxyBrowser Playwright MCP tools (browser_navigate, browser_type, browser_click, etc.)
213
+ → RoxyBrowser Playwright MCP connects to the opened browser via CDP endpoint
214
+
215
+ 4. AI: "Close the browser when done"
216
+ → Uses roxy_close_browsers
217
+ ```
218
+
219
+ ### Example 2: Browser with Proxy
220
+
221
+ ```
222
+ 1. AI: "Detect my proxy before creating browsers"
223
+ → Uses roxy_detect_proxy
224
+ → Confirms proxy is available
225
+
226
+ 2. AI: "Create a browser with SOCKS5 proxy and 1920x1080 in workspace 2"
227
+ → Uses roxy_create_browser with proxy configuration
228
+ → Returns configured browser ID
229
+
230
+ 3. AI: "Open the browser and start automation"
231
+ → Uses roxy_open_browsers → gets CDP endpoint
232
+ → RoxyBrowser Playwright MCP connects and begins automation
233
+ ```
234
+
235
+ ## Integration with Playwright MCP
236
+
237
+ RoxyBrowser MCP is designed to work seamlessly with [RoxyBrowser Playwright MCP](https://github.com/roxybrowserlabs/roxybrowser-playwright-mcp), our customized Playwright MCP server built specifically for RoxyBrowser compatibility.
238
+
239
+ **RoxyBrowser Playwright MCP** is based on [Microsoft's Playwright MCP](https://github.com/microsoft/playwright-mcp) with enhancements for RoxyBrowser's fingerprint browser features.
240
+
241
+ ### Workflow
242
+
243
+ 1. Use RoxyBrowser OpenAPI MCP to create and open browsers
244
+ 2. Get CDP WebSocket endpoints from opened browsers
245
+ 3. Use RoxyBrowser Playwright MCP to automate browser tasks with full Playwright capabilities
246
+
247
+ Both servers work together seamlessly when configured in your MCP client (see configuration above).
248
+
249
+ ## Development
250
+
251
+ ```bash
252
+ # Development mode with auto-rebuild
253
+ npm run dev
254
+
255
+ # Build for production
256
+ npm run build
257
+
258
+ # Build and run the test suite
259
+ npm test
260
+
261
+ # Launch MCP Inspector against the local stdio server
262
+ ROXY_API_KEY=your-key npm run inspect
263
+ ```
264
+
265
+ ### Test Strategy
266
+
267
+ The repository now includes a lightweight test setup based on Node's built-in test runner, so no extra test framework is required.
268
+
269
+ - `test/utils.test.mjs`: config resolution and HTTP request wrapper behavior
270
+ - `test/tools.test.mjs`: tool handler formatting and health-check output
271
+ - `test/server.test.mjs`: in-memory MCP integration using the official SDK client and transport
272
+
273
+ `npm test` builds `lib/` first, then runs the tests against the built artifacts. This keeps the test path close to what gets published.
274
+
275
+ ### MCP Inspector
276
+
277
+ Use the official MCP Inspector to debug tool discovery and tool calls locally:
278
+
279
+ ```bash
280
+ # Web UI
281
+ ROXY_API_KEY=your-key npm run inspect
282
+
283
+ # CLI mode
284
+ ROXY_API_KEY=your-key npm run inspect:cli -- --method tools/list
285
+ ```
286
+
287
+ Set `ROXY_API_HOST` as needed before launching Inspector.
288
+
289
+ ## API Reference
290
+
291
+ ### Configuration
292
+
293
+ Config is resolved in this order: **CLI arguments > environment variables > defaults**.
294
+
295
+ | Source | Options / Variables | Description |
296
+ |--------|----------------------|-------------|
297
+ | CLI | `-H, --api-host`, `-k, --api-key`, `-t, --timeout` | Pass when starting the server |
298
+ | Env | `ROXY_API_HOST`, `ROXY_API_KEY`, `ROXY_TIMEOUT` | Used when CLI option not passed |
299
+ | Defaults | `apiHost: http://127.0.0.1:50000`, `timeout: 30000` | Built-in defaults |
300
+
301
+ Config is read from env only; use `resolveConfig()` to read current effective config (env + defaults).
302
+
303
+ ## Troubleshooting
304
+
305
+ ### Connection Issues
306
+
307
+ **Error: "Failed to connect to RoxyBrowser API"**
308
+
309
+ Check:
310
+ 1. RoxyBrowser is running
311
+ 2. API is enabled: RoxyBrowser → API → API Status = Enable
312
+ 3. Correct API key: Copy from RoxyBrowser → API → API Key
313
+ 4. Correct port: Check RoxyBrowser → API → Port Settings (default: 50000)
314
+ 5. No firewall blocking http://127.0.0.1:50000
315
+
316
+ ### Authentication Issues
317
+
318
+ **Error: "Configuration Error: API key is required"**
319
+
320
+ Set the environment variable:
321
+ ```bash
322
+ export ROXY_API_KEY="your_actual_api_key_from_roxybrowser"
323
+ ```
324
+
325
+ ### Browser Opening Issues
326
+
327
+ **Error: "Insufficient profiles quota" (Code 101 or 409)**
328
+
329
+ Solutions:
330
+ - Purchase more profiles in RoxyBrowser Billing Center
331
+ - **Delete** unused browser profiles using `roxy_delete_browsers` (closing alone does NOT free quota)
332
+ - Upgrade your subscription plan
333
+ - Check current quota usage in workspace settings
334
+
335
+ **Some browsers fail to open:**
336
+
337
+ - Check that the browser profiles exist and are not corrupted
338
+ - Ensure sufficient system resources (RAM, CPU)
339
+ - Verify the dirIds are valid (use `roxy_list_browsers` first)
340
+ - Run `roxy_health_check` for connectivity and health diagnostics
341
+
342
+ ## License
343
+
344
+ MIT License - see LICENSE file for details.
345
+
346
+ ## Contributing
347
+
348
+ 1. Fork the repository
349
+ 2. Create a feature branch
350
+ 3. Make your changes
351
+ 4. Add tests if applicable
352
+ 5. Submit a pull request