@roxybrowser/openapi 1.0.1

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 ADDED
@@ -0,0 +1,374 @@
1
+ # RoxyBrowser MCP Server
2
+
3
+ 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.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **Browser Management**: Open and close RoxyBrowser instances programmatically
8
+ - 🔗 **CDP Integration**: Get WebSocket endpoints for Chrome DevTools Protocol automation
9
+ - 🤖 **AI-Friendly**: Seamlessly integrates with AI assistants through MCP
10
+ - 🎯 **Playwright Ready**: Works perfectly with [@playwright/mcp](https://github.com/microsoft/playwright-mcp)
11
+ - 📊 **Workspace Support**: Manage browsers across different workspaces and projects
12
+ - 🛠️ **Browser Creation**: Create browsers with layered complexity (Simple, Standard, Advanced, Template-based)
13
+ - 🌐 **Proxy Management**: Built-in proxy validation, testing, and configuration tools
14
+ - 📋 **Template System**: Predefined configurations for Gmail, Facebook, E-commerce, and more
15
+ - 🔧 **Advanced Configuration**: Full control over fingerprints, proxies, and browser settings
16
+
17
+ ## Quick Start
18
+
19
+ ### Prerequisites
20
+
21
+ 1. **RoxyBrowser** installed and running
22
+ 2. **RoxyBrowser API** enabled in settings:
23
+ - Open RoxyBrowser → API → API配置
24
+ - Set "启用状态" to "启用" (Enable)
25
+ - Copy your API Key
26
+ - Note the API port (default: 50000)
27
+
28
+ ### Installation
29
+
30
+ ```bash
31
+ # Clone or download the roxy-browser-mcp project
32
+ cd roxy-browser-mcp
33
+
34
+ # Install dependencies
35
+ npm install
36
+
37
+ # Build the TypeScript project
38
+ npm run build
39
+ ```
40
+
41
+ ### Configuration
42
+
43
+ Set up your environment variables:
44
+
45
+ ```bash
46
+ # Required: Your RoxyBrowser API Key
47
+ export ROXY_API_KEY="your_api_key_here"
48
+
49
+ # Optional: API host (default: http://127.0.0.1:50000)
50
+ export ROXY_API_HOST="http://127.0.0.1:50000"
51
+
52
+ # Optional: Request timeout in milliseconds (default: 30000)
53
+ export ROXY_TIMEOUT="30000"
54
+ ```
55
+
56
+ ### MCP Client Configuration
57
+
58
+ Add the server to your MCP client configuration:
59
+
60
+ **Claude Desktop / VS Code / Cursor:**
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "roxy-browser": {
65
+ "command": "node",
66
+ "args": ["/path/to/roxy-browser-mcp/lib/index.js"],
67
+ "env": {
68
+ "ROXY_API_KEY": "your_api_key_here",
69
+ "ROXY_API_HOST": "http://127.0.0.1:50000"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## Usage
77
+
78
+ ### Available Tools
79
+
80
+ #### Browser Management Tools
81
+
82
+ ##### 1. `roxy_list_workspaces`
83
+ Get all available workspaces and their projects.
84
+
85
+ **Parameters:**
86
+ - `pageIndex` (optional): Page number for pagination (default: 1)
87
+ - `pageSize` (optional): Items per page (default: 15)
88
+
89
+ **Example:**
90
+ ```
91
+ AI: "List all RoxyBrowser workspaces"
92
+ ```
93
+
94
+ ##### 2. `roxy_list_browsers`
95
+ Get browsers in a specific workspace/project.
96
+
97
+ **Parameters:**
98
+ - `workspaceId` (required): Workspace ID
99
+ - `projectIds` (optional): Comma-separated project IDs
100
+ - `windowName` (optional): Filter by browser window name
101
+ - `pageIndex` (optional): Page number (default: 1)
102
+ - `pageSize` (optional): Items per page (default: 15)
103
+
104
+ **Example:**
105
+ ```
106
+ AI: "List browsers in workspace 1 project 5"
107
+ ```
108
+
109
+ ##### 3. `roxy_open_browsers` ⭐
110
+ Open multiple browsers and get their CDP WebSocket endpoints.
111
+
112
+ **Parameters:**
113
+ - `workspaceId` (required): Workspace ID
114
+ - `dirIds` (required): Array of browser directory IDs
115
+ - `args` (optional): Browser startup arguments
116
+
117
+ **Example:**
118
+ ```
119
+ AI: "Open 5 browsers from workspace 1 with IDs: abc123, def456, ghi789, jkl012, mno345"
120
+ ```
121
+
122
+ **Returns:**
123
+ - CDP WebSocket URLs for each browser
124
+ - HTTP endpoints
125
+ - Process IDs
126
+ - Ready-to-use playwright-mcp commands
127
+
128
+ ##### 4. `roxy_close_browsers`
129
+ Close multiple browsers by their directory IDs.
130
+
131
+ **Parameters:**
132
+ - `dirIds` (required): Array of browser directory IDs to close
133
+
134
+ **Example:**
135
+ ```
136
+ AI: "Close browsers with IDs: abc123, def456, ghi789"
137
+ ```
138
+
139
+ #### Browser Creation Tools 🆕
140
+
141
+ ##### 5. `roxy_create_browser_simple`
142
+ Create a browser with simple configuration - perfect for quick setup.
143
+
144
+ **Parameters:**
145
+ - `workspaceId` (required): Workspace ID
146
+ - `windowName` (optional): Browser window name
147
+ - `projectId` (optional): Project ID
148
+ - `proxyHost` (optional): Proxy server host
149
+ - `proxyPort` (optional): Proxy server port
150
+ - `proxyUserName` (optional): Proxy username
151
+ - `proxyPassword` (optional): Proxy password
152
+ - `proxyType` (optional): HTTP, HTTPS, or SOCKS5
153
+
154
+ **Example:**
155
+ ```
156
+ AI: "Create a simple browser in workspace 1 with proxy 192.168.1.100:8080"
157
+ ```
158
+
159
+ ##### 6. `roxy_create_browser_standard`
160
+ Create a browser with standard configuration - covers most use cases.
161
+
162
+ **Parameters:**
163
+ - `workspaceId` (required): Workspace ID
164
+ - `windowName` (optional): Browser window name
165
+ - `projectId` (optional): Project ID
166
+ - `os` (optional): Windows, macOS, Linux, IOS, Android
167
+ - `osVersion` (optional): OS version
168
+ - `coreVersion` (optional): Browser core version
169
+ - `proxyInfo` (optional): Complete proxy configuration object
170
+ - `openWidth` (optional): Window width
171
+ - `openHeight` (optional): Window height
172
+ - `language` (optional): Browser language
173
+ - `timeZone` (optional): Browser timezone
174
+ - `defaultOpenUrl` (optional): URLs to open by default
175
+
176
+ **Example:**
177
+ ```
178
+ AI: "Create a standard Windows 11 browser with 1920x1080 resolution and SOCKS5 proxy"
179
+ ```
180
+
181
+ ##### 7. `roxy_create_browser_advanced`
182
+ Create a browser with complete configuration control - for expert users.
183
+
184
+ **Parameters:**
185
+ - All standard parameters plus:
186
+ - `userAgent` (optional): Custom user agent
187
+ - `searchEngine` (optional): Default search engine
188
+ - `labelIds` (optional): Label IDs to assign
189
+ - `proxyInfo` (optional): Full proxy configuration
190
+ - `fingerInfo` (optional): Complete fingerprint configuration
191
+ - `windowPlatformList` (optional): Platform account information
192
+
193
+ **Example:**
194
+ ```
195
+ AI: "Create an advanced browser with custom fingerprint settings and multiple platform accounts"
196
+ ```
197
+
198
+ ##### 8. `roxy_create_browser_from_template` ⭐
199
+ Create browsers using predefined templates - ideal for batch creation.
200
+
201
+ **Parameters:**
202
+ - `workspaceId` (required): Workspace ID
203
+ - `templateName` (required): gmail, facebook, ecommerce, social_media, general, or custom
204
+ - `count` (optional): Number of browsers to create (default: 1, max: 50)
205
+ - `namePrefix` (optional): Prefix for browser names
206
+ - `projectId` (optional): Project ID
207
+ - `proxyList` (optional): List of proxy configurations
208
+ - `customConfig` (optional): Override template defaults
209
+
210
+ **Example:**
211
+ ```
212
+ AI: "Create 10 Gmail browsers with different proxies using the gmail template"
213
+ ```
214
+
215
+ ##### 9. `roxy_list_browser_templates`
216
+ List available browser templates with descriptions.
217
+
218
+ **Example:**
219
+ ```
220
+ AI: "What browser templates are available?"
221
+ ```
222
+
223
+ #### Proxy Management Tools 🆕
224
+
225
+ ##### 10. `roxy_validate_proxy_config`
226
+ Validate proxy configuration before using it.
227
+
228
+ **Parameters:**
229
+ - `proxyInfo` (required): Proxy configuration to validate
230
+
231
+ **Example:**
232
+ ```
233
+ AI: "Validate this proxy configuration before creating browsers"
234
+ ```
235
+
236
+ ## Complete Workflow Examples
237
+
238
+ ### Example 1: Quick Gmail Automation Setup
239
+
240
+ ```
241
+ 1. AI: "Create 5 Gmail browsers using the gmail template in workspace 1"
242
+ → Uses roxy_create_browser_from_template
243
+ → Returns browser IDs ready for use
244
+
245
+ 2. AI: "Open all the Gmail browsers I just created"
246
+ → Uses roxy_open_browsers with the returned IDs
247
+ → Returns CDP WebSocket URLs like: ws://127.0.0.1:52314/devtools/browser/xxx
248
+
249
+ 3. AI: "Connect to the first browser and automate Gmail"
250
+ → Uses playwright-mcp with --cdp-endpoint flag
251
+ → npx @playwright/mcp@latest --cdp-endpoint "ws://127.0.0.1:52314/devtools/browser/xxx"
252
+
253
+ 4. AI: "Navigate to gmail.com, login, and send emails"
254
+ → Uses playwright-mcp tools: browser_navigate, browser_type, browser_click, etc.
255
+
256
+ 5. AI: "Close all browsers when done"
257
+ → Uses roxy_close_browsers
258
+ ```
259
+
260
+ ### Example 2: E-commerce with Proxy Setup
261
+
262
+ ```
263
+ 1. AI: "Validate my proxy configuration before creating browsers"
264
+ → Uses roxy_validate_proxy_config
265
+ → Confirms proxy settings are correct
266
+
267
+ 2. AI: "Create a standard e-commerce browser with SOCKS5 proxy in workspace 2"
268
+ → Uses roxy_create_browser_standard with proxy configuration
269
+ → Returns configured browser ID
270
+
271
+ 3. AI: "Open the e-commerce browser and start automation"
272
+ → Uses roxy_open_browsers → playwright-mcp integration
273
+ → Begin automated shopping tasks
274
+ ```
275
+
276
+ ### Example 3: Batch Social Media Management
277
+
278
+ ```
279
+ 1. AI: "List available browser templates"
280
+ → Uses roxy_list_browser_templates
281
+ → Shows social_media, facebook, etc.
282
+
283
+ 2. AI: "Create 20 social media browsers with different proxies"
284
+ → Uses roxy_create_browser_from_template with proxy list
285
+ → Batch creates browsers with distributed proxies
286
+
287
+ 3. AI: "Open first 5 browsers for Instagram automation"
288
+ → Uses roxy_open_browsers with selected IDs
289
+ → Ready for social media automation
290
+ ```
291
+
292
+ ## Integration with Playwright MCP
293
+
294
+ RoxyBrowser MCP is designed to work seamlessly with [@playwright/mcp](https://github.com/microsoft/playwright-mcp):
295
+
296
+ ```bash
297
+ # 1. Use RoxyBrowser MCP to open browsers and get WebSocket URLs
298
+ # 2. Start playwright-mcp with the WebSocket endpoint:
299
+
300
+ npx @playwright/mcp@latest --cdp-endpoint "ws://127.0.0.1:52314/devtools/browser/xxx"
301
+ ```
302
+
303
+ ## Development
304
+
305
+ ```bash
306
+ # Development mode with auto-rebuild
307
+ npm run dev
308
+
309
+ # Build for production
310
+ npm run build
311
+
312
+ # Clean build artifacts
313
+ npm run clean
314
+ ```
315
+
316
+ ## Troubleshooting
317
+
318
+ ### Connection Issues
319
+
320
+ **Error: "Failed to connect to RoxyBrowser API"**
321
+
322
+ Check:
323
+ 1. RoxyBrowser is running
324
+ 2. API is enabled: RoxyBrowser → API → API配置 → 启用状态 = 启用
325
+ 3. Correct API key: Copy from RoxyBrowser → API → API配置 → API Key
326
+ 4. Correct port: Check RoxyBrowser → API → API配置 → 端口 (default: 50000)
327
+ 5. No firewall blocking localhost:50000
328
+
329
+ ### Authentication Issues
330
+
331
+ **Error: "Configuration Error: API key is required"**
332
+
333
+ Set the environment variable:
334
+ ```bash
335
+ export ROXY_API_KEY="your_actual_api_key_from_roxybrowser"
336
+ ```
337
+
338
+ ### Browser Opening Issues
339
+
340
+ **Some browsers fail to open:**
341
+
342
+ - Check that the browser profiles exist and are not corrupted
343
+ - Ensure sufficient system resources (RAM, CPU)
344
+ - Verify the dirIds are valid (use `roxy_list_browsers` first)
345
+
346
+ ## API Reference
347
+
348
+ ### Environment Variables
349
+
350
+ | Variable | Required | Default | Description |
351
+ |----------|----------|---------|-------------|
352
+ | `ROXY_API_KEY` | ✅ Yes | - | API key from RoxyBrowser settings |
353
+ | `ROXY_API_HOST` | No | `http://127.0.0.1:50000` | RoxyBrowser API endpoint |
354
+ | `ROXY_TIMEOUT` | No | `30000` | Request timeout in milliseconds |
355
+
356
+ ### Error Codes
357
+
358
+ | Code | Meaning | Action |
359
+ |------|---------|---------|
360
+ | 0 | Success | - |
361
+ | 408 | Timeout | Check network connection |
362
+ | 500 | Server Error | Check RoxyBrowser logs |
363
+
364
+ ## License
365
+
366
+ MIT License - see LICENSE file for details.
367
+
368
+ ## Contributing
369
+
370
+ 1. Fork the repository
371
+ 2. Create a feature branch
372
+ 3. Make your changes
373
+ 4. Add tests if applicable
374
+ 5. Submit a pull request
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Browser Creator Service
3
+ *
4
+ * Handles browser creation with different complexity levels and configuration building
5
+ */
6
+ import { BrowserCreateConfig, BrowserCreateSimpleParams, BrowserCreateStandardParams, BrowserCreateAdvancedParams, BrowserCreateTemplateParams, ProxyInfo } from '../types.js';
7
+ export declare class BrowserCreator {
8
+ /**
9
+ * Convert simple parameters to full browser configuration
10
+ */
11
+ static buildSimpleConfig(params: BrowserCreateSimpleParams): BrowserCreateConfig;
12
+ /**
13
+ * Convert standard parameters to full browser configuration
14
+ */
15
+ static buildStandardConfig(params: BrowserCreateStandardParams): BrowserCreateConfig;
16
+ /**
17
+ * Advanced configuration - pass through as-is
18
+ */
19
+ static buildAdvancedConfig(params: BrowserCreateAdvancedParams): BrowserCreateConfig;
20
+ /**
21
+ * Generate unique browser name
22
+ */
23
+ static generateBrowserName(prefix?: string, index?: number): string;
24
+ /**
25
+ * Assign proxies from a list to multiple browser configurations
26
+ */
27
+ static assignProxiesToConfigs(configs: BrowserCreateConfig[], proxyList: ProxyInfo[]): BrowserCreateConfig[];
28
+ /**
29
+ * Validate browser configuration
30
+ */
31
+ static validateConfig(config: BrowserCreateConfig): {
32
+ valid: boolean;
33
+ errors: string[];
34
+ };
35
+ /**
36
+ * Get valid OS versions for a given operating system
37
+ */
38
+ private static getValidOSVersions;
39
+ /**
40
+ * Apply smart defaults to configuration
41
+ */
42
+ static applyDefaults(config: BrowserCreateConfig): BrowserCreateConfig;
43
+ /**
44
+ * Create multiple browser configuration objects from template parameters
45
+ */
46
+ static buildConfigsFromTemplate(params: BrowserCreateTemplateParams, templateConfig: Partial<BrowserCreateConfig>): BrowserCreateConfig[];
47
+ /**
48
+ * Batch validate multiple configurations
49
+ */
50
+ static validateConfigs(configs: BrowserCreateConfig[]): {
51
+ valid: boolean;
52
+ errors: Array<{
53
+ index: number;
54
+ errors: string[];
55
+ }>;
56
+ };
57
+ }
58
+ //# sourceMappingURL=browser-creator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-creator.d.ts","sourceRoot":"","sources":["../../src/browser/browser-creator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAG3B,SAAS,EAMV,MAAM,aAAa,CAAC;AAErB,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,yBAAyB,GAAG,mBAAmB;IA2BhF;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,GAAG,mBAAmB;IAsCpF;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,GAAG,mBAAmB;IAIpF;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAanE;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAC3B,OAAO,EAAE,mBAAmB,EAAE,EAC9B,SAAS,EAAE,SAAS,EAAE,GACrB,mBAAmB,EAAE;IAWxB;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IA+BxF;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAqBjC;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB;IAkFtE;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAC7B,MAAM,EAAE,2BAA2B,EACnC,cAAc,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAC3C,mBAAmB,EAAE;IA0BxB;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG;QACtD,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC;KACpD;CAeF"}