@roxybrowser/openapi 1.0.8 → 1.0.10-beta.0

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,13 +1,7 @@
1
- # RoxyBrowser MCP Server [Beta]
1
+ # RoxyBrowser MCP Server
2
2
 
3
3
  [English](README.md) | [中文](README_CN.md)
4
4
 
5
- > **⚠️ BETA VERSION NOTICE**
6
- >
7
- > This project is currently in **beta testing and active development**. While we strive for stability, please exercise caution when using this tool in production environments or with critical assets. We recommend closely monitoring software and browser operations when using it with MCP clients to avoid unnecessary losses.
8
- >
9
- >For more details, please refer to: [RoxyBrowser Now Supports MCP — AI Can Finally Do the Work for You](https://roxybrowser.com/blog/roxybrowser-mcp-integration)
10
-
11
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.
12
6
 
13
7
  ## Features
@@ -15,7 +9,7 @@ A Model Context Protocol (MCP) server for [RoxyBrowser](https://www.roxybrowser.
15
9
  - 🚀 **Browser Management**: Open and close RoxyBrowser instances programmatically
16
10
  - 🔗 **CDP Integration**: Get WebSocket endpoints for Chrome DevTools Protocol automation
17
11
  - 🤖 **AI-Friendly**: Seamlessly integrates with AI assistants through MCP
18
- - 🎯 **Playwright Ready**: Works with [PlayRoxy MCP](https://github.com/roxybrowserlabs/playroxy-mcp) (RoxyBrowser's customized Playwright MCP)
12
+ - 🎯 **Playwright Ready**: Works with [RoxyBrowser Playwright MCP](https://github.com/roxybrowserlabs/roxybrowser-playwright-mcp) (RoxyBrowser's customized Playwright MCP)
19
13
  - 📊 **Workspace Support**: Manage browsers across different workspaces and projects
20
14
  - 🛠️ **Browser Creation**: Create browsers (single or batch) with full configuration
21
15
  - 🌐 **Proxy Management**: List, create, detect, and manage proxy configurations
@@ -36,7 +30,7 @@ A Model Context Protocol (MCP) server for [RoxyBrowser](https://www.roxybrowser.
36
30
 
37
31
  ### MCP Client Configuration
38
32
 
39
- Add both RoxyBrowser OpenAPI and PlayRoxy MCP to your MCP client configuration:
33
+ Add both RoxyBrowser OpenAPI and RoxyBrowser Playwright MCP to your MCP client configuration:
40
34
 
41
35
  **Claude Desktop / VS Code / Cursor:**
42
36
  ```json
@@ -60,6 +54,108 @@ Add both RoxyBrowser OpenAPI and PlayRoxy MCP to your MCP client configuration:
60
54
 
61
55
  **Note:** Replace `YOUR API KEY` and `YOUR API HOST` with your actual RoxyBrowser credentials.
62
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
+
63
159
  ## Available Tools
64
160
 
65
161
  ### Workspace
@@ -113,8 +209,8 @@ Add both RoxyBrowser OpenAPI and PlayRoxy MCP to your MCP client configuration:
113
209
  → Returns CDP WebSocket URL like: ws://127.0.0.1:52314/devtools/browser/xxx
114
210
 
115
211
  3. AI: "Navigate to gmail.com, login, and send emails"
116
- → Uses PlayRoxy MCP tools (browser_navigate, browser_type, browser_click, etc.)
117
- PlayRoxy MCP connects to the opened browser via CDP endpoint
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
118
214
 
119
215
  4. AI: "Close the browser when done"
120
216
  → Uses roxy_close_browsers
@@ -133,20 +229,20 @@ Add both RoxyBrowser OpenAPI and PlayRoxy MCP to your MCP client configuration:
133
229
 
134
230
  3. AI: "Open the browser and start automation"
135
231
  → Uses roxy_open_browsers → gets CDP endpoint
136
- PlayRoxy MCP connects and begins automation
232
+ RoxyBrowser Playwright MCP connects and begins automation
137
233
  ```
138
234
 
139
235
  ## Integration with Playwright MCP
140
236
 
141
- RoxyBrowser MCP is designed to work seamlessly with [PlayRoxy MCP](https://github.com/roxybrowserlabs/playroxy-mcp), our customized Playwright MCP server built specifically for RoxyBrowser compatibility.
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.
142
238
 
143
- **PlayRoxy MCP** is based on [Microsoft's Playwright MCP](https://github.com/microsoft/playwright-mcp) with enhancements for RoxyBrowser's fingerprint browser features.
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.
144
240
 
145
241
  ### Workflow
146
242
 
147
243
  1. Use RoxyBrowser OpenAPI MCP to create and open browsers
148
244
  2. Get CDP WebSocket endpoints from opened browsers
149
- 3. Use PlayRoxy MCP to automate browser tasks with full Playwright capabilities
245
+ 3. Use RoxyBrowser Playwright MCP to automate browser tasks with full Playwright capabilities
150
246
 
151
247
  Both servers work together seamlessly when configured in your MCP client (see configuration above).
152
248
 
@@ -162,13 +258,17 @@ npm run build
162
258
 
163
259
  ## API Reference
164
260
 
165
- ### Environment Variables
261
+ ### Configuration
262
+
263
+ Config is resolved in this order: **CLI arguments > environment variables > defaults**.
264
+
265
+ | Source | Options / Variables | Description |
266
+ |--------|----------------------|-------------|
267
+ | CLI | `-H, --api-host`, `-k, --api-key`, `-t, --timeout` | Pass when starting the server |
268
+ | Env | `ROXY_API_HOST`, `ROXY_API_KEY`, `ROXY_TIMEOUT` | Used when CLI option not passed |
269
+ | Defaults | `apiHost: http://127.0.0.1:50000`, `timeout: 30000` | Built-in defaults |
166
270
 
167
- | Variable | Required | Default | Description |
168
- |----------|----------|---------|-------------|
169
- | `ROXY_API_KEY` | ✅ Yes | - | API key from RoxyBrowser settings |
170
- | `ROXY_API_HOST` | ✅ Yes | `http://127.0.0.1:50000` | RoxyBrowser API endpoint |
171
- | `ROXY_TIMEOUT` | No | `30000` | Request timeout in milliseconds |
271
+ Config is read from env only; use `resolveConfig()` to read current effective config (env + defaults).
172
272
 
173
273
  ## Troubleshooting
174
274
 
package/lib/cli.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry: parse args (Commander), apply config (CLI > env > defaults), then run MCP server.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;GAEG"}
package/lib/cli.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry: parse args (Commander), apply config (CLI > env > defaults), then run MCP server.
4
+ */
5
+ import { Command } from 'commander';
6
+ import { runServer } from './index.js';
7
+ import { ConfigError } from './utils/index.js';
8
+ const PKG_VERSION = '1.0.9';
9
+ const program = new Command();
10
+ program
11
+ .name('roxy-browser-mcp')
12
+ .description('RoxyBrowser MCP Server - Model Context Protocol server for RoxyBrowser automation')
13
+ .version(PKG_VERSION, '-V, --version', 'Show version')
14
+ .option('-H, --api-host <url>', 'RoxyBrowser API base URL', process.env.ROXY_API_HOST ?? 'http://127.0.0.1:50000')
15
+ .option('-k, --api-key <key>', 'API key (or set ROXY_API_KEY)', process.env.ROXY_API_KEY ?? '')
16
+ .option('-t, --timeout <ms>', 'Request timeout in milliseconds', (v) => (v != null && v !== '' ? Number.parseInt(v, 10) : 30_000), process.env.ROXY_TIMEOUT != null ? Number(process.env.ROXY_TIMEOUT) : 30_000)
17
+ .addHelpText('after', `
18
+ Environment (used when option not passed):
19
+ ROXY_API_HOST API base URL (default: http://127.0.0.1:50000)
20
+ ROXY_API_KEY API key (required)
21
+ ROXY_TIMEOUT Timeout in ms (default: 30000)
22
+
23
+ Examples:
24
+ roxy-browser-mcp --api-key "your-key"
25
+ roxy-browser-mcp -k "your-key" -H http://127.0.0.1:50000
26
+ ROXY_API_KEY=your-key roxy-browser-mcp
27
+ `);
28
+ async function main() {
29
+ program.parse();
30
+ const opts = program.opts();
31
+ // Apply CLI args to env so request() sees them (env is the only config source)
32
+ if (opts.apiHost != null && opts.apiHost !== '')
33
+ process.env.ROXY_API_HOST = opts.apiHost;
34
+ if (opts.apiKey != null && opts.apiKey !== '')
35
+ process.env.ROXY_API_KEY = opts.apiKey;
36
+ if (opts.timeout != null)
37
+ process.env.ROXY_TIMEOUT = String(opts.timeout);
38
+ try {
39
+ await runServer();
40
+ }
41
+ catch (error) {
42
+ if (error instanceof ConfigError) {
43
+ console.error(`❌ Configuration Error: ${error.message}`);
44
+ process.exit(1);
45
+ }
46
+ console.error('❌ Unexpected error:', error);
47
+ process.exit(1);
48
+ }
49
+ }
50
+ main();
51
+ //# sourceMappingURL=cli.js.map
package/lib/cli.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],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