@roxybrowser/openapi 1.0.9 → 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 +112 -6
- package/lib/cli.d.ts +6 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +51 -0
- package/lib/cli.js.map +1 -0
- package/lib/index.d.ts +515 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +18 -31
- package/lib/index.js.map +1 -1
- package/lib/utils/index.d.ts +21 -14
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +42 -16
- package/lib/utils/index.js.map +1 -1
- package/package.json +15 -5
package/README.md
CHANGED
|
@@ -54,6 +54,108 @@ Add both RoxyBrowser OpenAPI and RoxyBrowser Playwright MCP to your MCP client c
|
|
|
54
54
|
|
|
55
55
|
**Note:** Replace `YOUR API KEY` and `YOUR API HOST` with your actual RoxyBrowser credentials.
|
|
56
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
|
+
|
|
57
159
|
## Available Tools
|
|
58
160
|
|
|
59
161
|
### Workspace
|
|
@@ -156,13 +258,17 @@ npm run build
|
|
|
156
258
|
|
|
157
259
|
## API Reference
|
|
158
260
|
|
|
159
|
-
###
|
|
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 |
|
|
160
270
|
|
|
161
|
-
|
|
162
|
-
|----------|----------|---------|-------------|
|
|
163
|
-
| `ROXY_API_KEY` | ✅ Yes | - | API key from RoxyBrowser settings |
|
|
164
|
-
| `ROXY_API_HOST` | ✅ Yes | `http://127.0.0.1:50000` | RoxyBrowser API endpoint |
|
|
165
|
-
| `ROXY_TIMEOUT` | No | `30000` | Request timeout in milliseconds |
|
|
271
|
+
Config is read from env only; use `resolveConfig()` to read current effective config (env + defaults).
|
|
166
272
|
|
|
167
273
|
## Troubleshooting
|
|
168
274
|
|
package/lib/cli.d.ts
ADDED
package/lib/cli.d.ts.map
ADDED
|
@@ -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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OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,KAAK,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAA;IACzF,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAA;IACrF,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI;QAAE,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAEzE,IAAI,CAAC;QACH,MAAM,SAAS,EAAE,CAAA;IACnB,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,OAAO,CAAC,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;YACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAA;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,8 +2,520 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* RoxyBrowser MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Model Context Protocol server for RoxyBrowser automation
|
|
6
|
-
*
|
|
5
|
+
* Model Context Protocol server for RoxyBrowser automation.
|
|
6
|
+
* Supports: CLI startup, programmatic (in-process) startup, and library usage for secondary development.
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
8
|
+
export declare const TOOLS: ({
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
browsers: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
items: {
|
|
18
|
+
type: string;
|
|
19
|
+
properties: {
|
|
20
|
+
workspaceId: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
windowName: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
coreVersion: {
|
|
29
|
+
type: string;
|
|
30
|
+
enum: string[];
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
os: {
|
|
34
|
+
type: string;
|
|
35
|
+
enum: string[];
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
osVersion: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
userAgent: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
cookie: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
items: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
searchEngine: {
|
|
54
|
+
type: string;
|
|
55
|
+
enum: string[];
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
labelIds: {
|
|
59
|
+
type: string;
|
|
60
|
+
items: {
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
defaultOpenUrl: {
|
|
66
|
+
type: string;
|
|
67
|
+
items: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
windowRemark: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
projectId: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
windowPlatformList: {
|
|
81
|
+
type: string;
|
|
82
|
+
items: {
|
|
83
|
+
type: string;
|
|
84
|
+
properties: {
|
|
85
|
+
id: {
|
|
86
|
+
type: string;
|
|
87
|
+
description: string;
|
|
88
|
+
};
|
|
89
|
+
platformUrl: {
|
|
90
|
+
type: string;
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
platformUserName: {
|
|
94
|
+
type: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
platformPassword: {
|
|
98
|
+
type: string;
|
|
99
|
+
description: string;
|
|
100
|
+
};
|
|
101
|
+
platformEfa: {
|
|
102
|
+
type: string;
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
platformRemarks: {
|
|
106
|
+
type: string;
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
proxyInfo: {
|
|
114
|
+
type: string;
|
|
115
|
+
description: string;
|
|
116
|
+
properties: {
|
|
117
|
+
moduleId: {
|
|
118
|
+
type: string;
|
|
119
|
+
description: string;
|
|
120
|
+
};
|
|
121
|
+
proxyMethod: {
|
|
122
|
+
type: string;
|
|
123
|
+
enum: string[];
|
|
124
|
+
};
|
|
125
|
+
proxyCategory: {
|
|
126
|
+
type: string;
|
|
127
|
+
enum: string[];
|
|
128
|
+
};
|
|
129
|
+
ipType: {
|
|
130
|
+
type: string;
|
|
131
|
+
enum: string[];
|
|
132
|
+
};
|
|
133
|
+
protocol: {
|
|
134
|
+
type: string;
|
|
135
|
+
enum: string[];
|
|
136
|
+
};
|
|
137
|
+
host: {
|
|
138
|
+
type: string;
|
|
139
|
+
};
|
|
140
|
+
port: {
|
|
141
|
+
type: string;
|
|
142
|
+
};
|
|
143
|
+
proxyUserName: {
|
|
144
|
+
type: string;
|
|
145
|
+
};
|
|
146
|
+
proxyPassword: {
|
|
147
|
+
type: string;
|
|
148
|
+
};
|
|
149
|
+
refreshUrl: {
|
|
150
|
+
type: string;
|
|
151
|
+
};
|
|
152
|
+
checkChannel: {
|
|
153
|
+
type: string;
|
|
154
|
+
enum: string[];
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
fingerInfo: {
|
|
159
|
+
type: string;
|
|
160
|
+
description: string;
|
|
161
|
+
properties: {
|
|
162
|
+
isLanguageBaseIp: {
|
|
163
|
+
type: string;
|
|
164
|
+
description: string;
|
|
165
|
+
};
|
|
166
|
+
language: {
|
|
167
|
+
type: string;
|
|
168
|
+
description: string;
|
|
169
|
+
};
|
|
170
|
+
isDisplayLanguageBaseIp: {
|
|
171
|
+
type: string;
|
|
172
|
+
description: string;
|
|
173
|
+
};
|
|
174
|
+
displayLanguage: {
|
|
175
|
+
type: string;
|
|
176
|
+
description: string;
|
|
177
|
+
};
|
|
178
|
+
isTimeZone: {
|
|
179
|
+
type: string;
|
|
180
|
+
description: string;
|
|
181
|
+
};
|
|
182
|
+
timeZone: {
|
|
183
|
+
type: string;
|
|
184
|
+
description: string;
|
|
185
|
+
};
|
|
186
|
+
position: {
|
|
187
|
+
type: string;
|
|
188
|
+
enum: number[];
|
|
189
|
+
description: string;
|
|
190
|
+
};
|
|
191
|
+
isPositionBaseIp: {
|
|
192
|
+
type: string;
|
|
193
|
+
description: string;
|
|
194
|
+
};
|
|
195
|
+
longitude: {
|
|
196
|
+
type: string;
|
|
197
|
+
description: string;
|
|
198
|
+
};
|
|
199
|
+
latitude: {
|
|
200
|
+
type: string;
|
|
201
|
+
description: string;
|
|
202
|
+
};
|
|
203
|
+
precisionPos: {
|
|
204
|
+
type: string;
|
|
205
|
+
description: string;
|
|
206
|
+
};
|
|
207
|
+
forbidAudio: {
|
|
208
|
+
type: string;
|
|
209
|
+
description: string;
|
|
210
|
+
};
|
|
211
|
+
forbidImage: {
|
|
212
|
+
type: string;
|
|
213
|
+
description: string;
|
|
214
|
+
};
|
|
215
|
+
forbidMedia: {
|
|
216
|
+
type: string;
|
|
217
|
+
description: string;
|
|
218
|
+
};
|
|
219
|
+
openWidth: {
|
|
220
|
+
type: string;
|
|
221
|
+
description: string;
|
|
222
|
+
};
|
|
223
|
+
openHeight: {
|
|
224
|
+
type: string;
|
|
225
|
+
description: string;
|
|
226
|
+
};
|
|
227
|
+
openBookmarks: {
|
|
228
|
+
type: string;
|
|
229
|
+
description: string;
|
|
230
|
+
};
|
|
231
|
+
positionSwitch: {
|
|
232
|
+
type: string;
|
|
233
|
+
description: string;
|
|
234
|
+
};
|
|
235
|
+
windowRatioPosition: {
|
|
236
|
+
type: string;
|
|
237
|
+
description: string;
|
|
238
|
+
};
|
|
239
|
+
isDisplayName: {
|
|
240
|
+
type: string;
|
|
241
|
+
description: string;
|
|
242
|
+
};
|
|
243
|
+
syncBookmark: {
|
|
244
|
+
type: string;
|
|
245
|
+
description: string;
|
|
246
|
+
};
|
|
247
|
+
syncHistory: {
|
|
248
|
+
type: string;
|
|
249
|
+
description: string;
|
|
250
|
+
};
|
|
251
|
+
syncTab: {
|
|
252
|
+
type: string;
|
|
253
|
+
description: string;
|
|
254
|
+
};
|
|
255
|
+
syncCookie: {
|
|
256
|
+
type: string;
|
|
257
|
+
description: string;
|
|
258
|
+
};
|
|
259
|
+
syncExtensions: {
|
|
260
|
+
type: string;
|
|
261
|
+
description: string;
|
|
262
|
+
};
|
|
263
|
+
syncPassword: {
|
|
264
|
+
type: string;
|
|
265
|
+
description: string;
|
|
266
|
+
};
|
|
267
|
+
syncIndexedDb: {
|
|
268
|
+
type: string;
|
|
269
|
+
description: string;
|
|
270
|
+
};
|
|
271
|
+
syncLocalStorage: {
|
|
272
|
+
type: string;
|
|
273
|
+
description: string;
|
|
274
|
+
};
|
|
275
|
+
clearCacheFile: {
|
|
276
|
+
type: string;
|
|
277
|
+
description: string;
|
|
278
|
+
};
|
|
279
|
+
clearCookie: {
|
|
280
|
+
type: string;
|
|
281
|
+
description: string;
|
|
282
|
+
};
|
|
283
|
+
clearLocalStorage: {
|
|
284
|
+
type: string;
|
|
285
|
+
description: string;
|
|
286
|
+
};
|
|
287
|
+
randomFingerprint: {
|
|
288
|
+
type: string;
|
|
289
|
+
description: string;
|
|
290
|
+
};
|
|
291
|
+
forbidSavePassword: {
|
|
292
|
+
type: string;
|
|
293
|
+
description: string;
|
|
294
|
+
};
|
|
295
|
+
stopOpenNet: {
|
|
296
|
+
type: string;
|
|
297
|
+
description: string;
|
|
298
|
+
};
|
|
299
|
+
stopOpenIP: {
|
|
300
|
+
type: string;
|
|
301
|
+
description: string;
|
|
302
|
+
};
|
|
303
|
+
stopOpenPosition: {
|
|
304
|
+
type: string;
|
|
305
|
+
description: string;
|
|
306
|
+
};
|
|
307
|
+
openWorkbench: {
|
|
308
|
+
type: string;
|
|
309
|
+
enum: number[];
|
|
310
|
+
description: string;
|
|
311
|
+
};
|
|
312
|
+
resolutionType: {
|
|
313
|
+
type: string;
|
|
314
|
+
description: string;
|
|
315
|
+
};
|
|
316
|
+
resolutionX: {
|
|
317
|
+
type: string;
|
|
318
|
+
description: string;
|
|
319
|
+
};
|
|
320
|
+
resolutionY: {
|
|
321
|
+
type: string;
|
|
322
|
+
description: string;
|
|
323
|
+
};
|
|
324
|
+
fontType: {
|
|
325
|
+
type: string;
|
|
326
|
+
description: string;
|
|
327
|
+
};
|
|
328
|
+
webRTC: {
|
|
329
|
+
type: string;
|
|
330
|
+
enum: number[];
|
|
331
|
+
description: string;
|
|
332
|
+
};
|
|
333
|
+
webGL: {
|
|
334
|
+
type: string;
|
|
335
|
+
description: string;
|
|
336
|
+
};
|
|
337
|
+
webGLInfo: {
|
|
338
|
+
type: string;
|
|
339
|
+
description: string;
|
|
340
|
+
};
|
|
341
|
+
webGLManufacturer: {
|
|
342
|
+
type: string;
|
|
343
|
+
description: string;
|
|
344
|
+
};
|
|
345
|
+
webGLRender: {
|
|
346
|
+
type: string;
|
|
347
|
+
description: string;
|
|
348
|
+
};
|
|
349
|
+
webGpu: {
|
|
350
|
+
type: string;
|
|
351
|
+
enum: string[];
|
|
352
|
+
description: string;
|
|
353
|
+
};
|
|
354
|
+
canvas: {
|
|
355
|
+
type: string;
|
|
356
|
+
description: string;
|
|
357
|
+
};
|
|
358
|
+
audioContext: {
|
|
359
|
+
type: string;
|
|
360
|
+
description: string;
|
|
361
|
+
};
|
|
362
|
+
speechVoices: {
|
|
363
|
+
type: string;
|
|
364
|
+
description: string;
|
|
365
|
+
};
|
|
366
|
+
doNotTrack: {
|
|
367
|
+
type: string;
|
|
368
|
+
description: string;
|
|
369
|
+
};
|
|
370
|
+
clientRects: {
|
|
371
|
+
type: string;
|
|
372
|
+
description: string;
|
|
373
|
+
};
|
|
374
|
+
deviceInfo: {
|
|
375
|
+
type: string;
|
|
376
|
+
description: string;
|
|
377
|
+
};
|
|
378
|
+
deviceNameSwitch: {
|
|
379
|
+
type: string;
|
|
380
|
+
description: string;
|
|
381
|
+
};
|
|
382
|
+
macInfo: {
|
|
383
|
+
type: string;
|
|
384
|
+
description: string;
|
|
385
|
+
};
|
|
386
|
+
hardwareConcurrent: {
|
|
387
|
+
type: string;
|
|
388
|
+
description: string;
|
|
389
|
+
};
|
|
390
|
+
deviceMemory: {
|
|
391
|
+
type: string;
|
|
392
|
+
description: string;
|
|
393
|
+
};
|
|
394
|
+
disableSsl: {
|
|
395
|
+
type: string;
|
|
396
|
+
description: string;
|
|
397
|
+
};
|
|
398
|
+
disableSslList: {
|
|
399
|
+
type: string;
|
|
400
|
+
items: {
|
|
401
|
+
type: string;
|
|
402
|
+
};
|
|
403
|
+
description: string;
|
|
404
|
+
};
|
|
405
|
+
portScanProtect: {
|
|
406
|
+
type: string;
|
|
407
|
+
description: string;
|
|
408
|
+
};
|
|
409
|
+
portScanList: {
|
|
410
|
+
type: string;
|
|
411
|
+
description: string;
|
|
412
|
+
};
|
|
413
|
+
useGpu: {
|
|
414
|
+
type: string;
|
|
415
|
+
description: string;
|
|
416
|
+
};
|
|
417
|
+
sandboxPermission: {
|
|
418
|
+
type: string;
|
|
419
|
+
description: string;
|
|
420
|
+
};
|
|
421
|
+
startupParam: {
|
|
422
|
+
type: string;
|
|
423
|
+
description: string;
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
required: string[];
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
required: string[];
|
|
433
|
+
};
|
|
434
|
+
} | {
|
|
435
|
+
name: string;
|
|
436
|
+
description: string;
|
|
437
|
+
inputSchema: {
|
|
438
|
+
type: string;
|
|
439
|
+
properties: {
|
|
440
|
+
workspaceId: {
|
|
441
|
+
type: string;
|
|
442
|
+
description: string;
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
required: string[];
|
|
446
|
+
};
|
|
447
|
+
} | {
|
|
448
|
+
name: string;
|
|
449
|
+
description: string;
|
|
450
|
+
inputSchema: {
|
|
451
|
+
type: string;
|
|
452
|
+
properties: {
|
|
453
|
+
dirIds: {
|
|
454
|
+
type: string;
|
|
455
|
+
items: {
|
|
456
|
+
type: string;
|
|
457
|
+
};
|
|
458
|
+
description: string;
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
} | {
|
|
463
|
+
name: string;
|
|
464
|
+
description: string;
|
|
465
|
+
inputSchema: {
|
|
466
|
+
type: string;
|
|
467
|
+
properties: {
|
|
468
|
+
pageIndex: {
|
|
469
|
+
type: string;
|
|
470
|
+
description: string;
|
|
471
|
+
default: number;
|
|
472
|
+
};
|
|
473
|
+
pageSize: {
|
|
474
|
+
type: string;
|
|
475
|
+
description: string;
|
|
476
|
+
default: number;
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
} | {
|
|
481
|
+
name: string;
|
|
482
|
+
description: string;
|
|
483
|
+
inputSchema: {
|
|
484
|
+
type: string;
|
|
485
|
+
properties: {
|
|
486
|
+
includeWorkspaceCheck: {
|
|
487
|
+
type: string;
|
|
488
|
+
description: string;
|
|
489
|
+
default: boolean;
|
|
490
|
+
};
|
|
491
|
+
includeBrowserCheck: {
|
|
492
|
+
type: string;
|
|
493
|
+
description: string;
|
|
494
|
+
default: boolean;
|
|
495
|
+
};
|
|
496
|
+
verbose: {
|
|
497
|
+
type: string;
|
|
498
|
+
description: string;
|
|
499
|
+
default: boolean;
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
})[];
|
|
504
|
+
export declare class RoxyBrowserMCPServer {
|
|
505
|
+
private server;
|
|
506
|
+
constructor();
|
|
507
|
+
private setupHandlers;
|
|
508
|
+
run(): Promise<void>;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Create and run MCP server with stdio transport (for in-process usage).
|
|
512
|
+
* Use when embedding the server in your own Node process.
|
|
513
|
+
*/
|
|
514
|
+
export declare function runServer(): Promise<void>;
|
|
515
|
+
export { listBrowsers, batchCreateBrowsers, createBrowser, openBrowser, updateBrowser, closeBrowsers, deleteBrowsers, getBrowserDetail, clearLocalCache, clearServerCache, randomFingerprint, listLabels, getConnectionInfo, } from './modules/browser.js';
|
|
516
|
+
export { proxyList, proxyStore, createProxy, batchCreateProxies, detectProxy, modifyProxy, deleteProxies, } from './modules/proxy.js';
|
|
517
|
+
export { listAccounts, createAccount, batchCreateAccounts, modifyAccount, deleteAccounts, } from './modules/account.js';
|
|
518
|
+
export { listWorkspaces, healthCheck } from './modules/other.js';
|
|
519
|
+
export { request, resolveConfig, DEFAULT_CONFIG } from './utils/index.js';
|
|
520
|
+
export type * from './types.js';
|
|
9
521
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAeH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACzE,mBAAmB,YAAY,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* RoxyBrowser MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Model Context Protocol server for RoxyBrowser automation
|
|
6
|
-
*
|
|
5
|
+
* Model Context Protocol server for RoxyBrowser automation.
|
|
6
|
+
* Supports: CLI startup, programmatic (in-process) startup, and library usage for secondary development.
|
|
7
7
|
*/
|
|
8
8
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
9
9
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
@@ -12,9 +12,8 @@ import { batchCreateAccounts, createAccount, deleteAccounts, listAccounts, modif
|
|
|
12
12
|
import { batchCreateBrowsers, clearLocalCache, clearServerCache, closeBrowsers, createBrowser, deleteBrowsers, getBrowserDetail, getConnectionInfo, listBrowsers, listLabels, openBrowser, randomFingerprint, updateBrowser } from './modules/browser.js';
|
|
13
13
|
import { healthCheck, listWorkspaces } from './modules/other.js';
|
|
14
14
|
import { batchCreateProxies, createProxy, deleteProxies, detectProxy, modifyProxy, proxyList, proxyStore } from './modules/proxy.js';
|
|
15
|
-
import { ConfigError } from './types.js';
|
|
16
15
|
// ========== Tool Definitions ==========
|
|
17
|
-
const TOOLS = [
|
|
16
|
+
export const TOOLS = [
|
|
18
17
|
listBrowsers.schema,
|
|
19
18
|
batchCreateBrowsers.schema,
|
|
20
19
|
createBrowser.schema,
|
|
@@ -45,7 +44,7 @@ const TOOLS = [
|
|
|
45
44
|
healthCheck.schema,
|
|
46
45
|
];
|
|
47
46
|
// ========== MCP Server ==========
|
|
48
|
-
class RoxyBrowserMCPServer {
|
|
47
|
+
export class RoxyBrowserMCPServer {
|
|
49
48
|
server;
|
|
50
49
|
constructor() {
|
|
51
50
|
this.server = new Server({
|
|
@@ -57,9 +56,6 @@ class RoxyBrowserMCPServer {
|
|
|
57
56
|
},
|
|
58
57
|
});
|
|
59
58
|
this.setupHandlers();
|
|
60
|
-
// Initialize RoxyBrowser client
|
|
61
|
-
// const config = getConfig()
|
|
62
|
-
// this.roxyClient = new RoxyClient(config)
|
|
63
59
|
}
|
|
64
60
|
setupHandlers() {
|
|
65
61
|
// List available tools
|
|
@@ -153,28 +149,19 @@ class RoxyBrowserMCPServer {
|
|
|
153
149
|
console.error('✅ RoxyBrowser MCP Server is running');
|
|
154
150
|
}
|
|
155
151
|
}
|
|
156
|
-
// ==========
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
console.error(`❌ Configuration Error: ${error.message}`);
|
|
165
|
-
process.exit(1);
|
|
166
|
-
}
|
|
167
|
-
console.error('❌ Unexpected error:', error);
|
|
168
|
-
process.exit(1);
|
|
169
|
-
}
|
|
152
|
+
// ========== Programmatic API ==========
|
|
153
|
+
/**
|
|
154
|
+
* Create and run MCP server with stdio transport (for in-process usage).
|
|
155
|
+
* Use when embedding the server in your own Node process.
|
|
156
|
+
*/
|
|
157
|
+
export async function runServer() {
|
|
158
|
+
const server = new RoxyBrowserMCPServer();
|
|
159
|
+
await server.run();
|
|
170
160
|
}
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
console.error('Fatal error:', error);
|
|
178
|
-
process.exit(1);
|
|
179
|
-
});
|
|
161
|
+
// ========== Library exports for secondary development ==========
|
|
162
|
+
export { listBrowsers, batchCreateBrowsers, createBrowser, openBrowser, updateBrowser, closeBrowsers, deleteBrowsers, getBrowserDetail, clearLocalCache, clearServerCache, randomFingerprint, listLabels, getConnectionInfo, } from './modules/browser.js';
|
|
163
|
+
export { proxyList, proxyStore, createProxy, batchCreateProxies, detectProxy, modifyProxy, deleteProxies, } from './modules/proxy.js';
|
|
164
|
+
export { listAccounts, createAccount, batchCreateAccounts, modifyAccount, deleteAccounts, } from './modules/account.js';
|
|
165
|
+
export { listWorkspaces, healthCheck } from './modules/other.js';
|
|
166
|
+
export { request, resolveConfig, DEFAULT_CONFIG } from './utils/index.js';
|
|
180
167
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACtH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzP,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpI,yCAAyC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,YAAY,CAAC,MAAM;IACnB,mBAAmB,CAAC,MAAM;IAC1B,aAAa,CAAC,MAAM;IACpB,WAAW,CAAC,MAAM;IAClB,aAAa,CAA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WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,cAAc,GACf,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Configuration and HTTP client for RoxyBrowser API.
|
|
3
|
+
*
|
|
4
|
+
* Config is fixed at process start: environment variables (ROXY_API_HOST, ROXY_API_KEY, ROXY_TIMEOUT) + defaults.
|
|
5
|
+
* CLI writes parsed args into process.env before starting the server, so CLI args take effect the same way.
|
|
6
|
+
*/
|
|
7
|
+
import { ConfigError } from '../types.js';
|
|
8
|
+
export { ConfigError };
|
|
4
9
|
export interface RoxyClientConfig {
|
|
5
|
-
/**
|
|
6
|
-
* RoxyBrowser API host (default: http://127.0.0.1:50000)
|
|
7
|
-
*/
|
|
10
|
+
/** RoxyBrowser API base URL */
|
|
8
11
|
apiHost: string;
|
|
9
|
-
/**
|
|
10
|
-
* RoxyBrowser API key
|
|
11
|
-
*/
|
|
12
|
+
/** API key (required for requests) */
|
|
12
13
|
apiKey: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
timeout?: number;
|
|
14
|
+
/** Request timeout in milliseconds */
|
|
15
|
+
timeout: number;
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
/** Default values when env is not set */
|
|
18
|
+
export declare const DEFAULT_CONFIG: {
|
|
19
|
+
readonly apiHost: "http://127.0.0.1:50000";
|
|
20
|
+
readonly timeout: 30000;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Resolve config from env + defaults (read-only; no runtime override).
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveConfig(): RoxyClientConfig;
|
|
19
26
|
export declare function request<T = any>(endpoint: string, options?: RequestInit): Promise<{
|
|
20
27
|
code: number;
|
|
21
28
|
msg: string;
|
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,yCAAyC;AACzC,eAAO,MAAM,cAAc;;;CAGjB,CAAA;AAQV;;GAEG;AACH,wBAAgB,aAAa,IAAI,gBAAgB,CAahD;AAcD,wBAAsB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC;IAC3F,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,CAAC,CAAA;CACT,CAAC,CAmCD"}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,22 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Configuration and HTTP client for RoxyBrowser API.
|
|
3
|
+
*
|
|
4
|
+
* Config is fixed at process start: environment variables (ROXY_API_HOST, ROXY_API_KEY, ROXY_TIMEOUT) + defaults.
|
|
5
|
+
* CLI writes parsed args into process.env before starting the server, so CLI args take effect the same way.
|
|
6
|
+
*/
|
|
7
|
+
import { ConfigError } from '../types.js';
|
|
8
|
+
export { ConfigError };
|
|
9
|
+
/** Default values when env is not set */
|
|
10
|
+
export const DEFAULT_CONFIG = {
|
|
11
|
+
apiHost: 'http://127.0.0.1:50000',
|
|
12
|
+
timeout: 30_000,
|
|
13
|
+
};
|
|
14
|
+
const ENV_KEYS = {
|
|
15
|
+
apiHost: 'ROXY_API_HOST',
|
|
16
|
+
apiKey: 'ROXY_API_KEY',
|
|
17
|
+
timeout: 'ROXY_TIMEOUT',
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolve config from env + defaults (read-only; no runtime override).
|
|
21
|
+
*/
|
|
22
|
+
export function resolveConfig() {
|
|
23
|
+
const envHost = process.env[ENV_KEYS.apiHost];
|
|
24
|
+
const envKey = process.env[ENV_KEYS.apiKey];
|
|
25
|
+
const envTimeout = process.env[ENV_KEYS.timeout];
|
|
26
|
+
return {
|
|
27
|
+
apiHost: envHost ?? DEFAULT_CONFIG.apiHost,
|
|
28
|
+
apiKey: envKey ?? '',
|
|
29
|
+
timeout: envTimeout != null && envTimeout !== ''
|
|
30
|
+
? Number.parseInt(envTimeout, 10)
|
|
31
|
+
: DEFAULT_CONFIG.timeout,
|
|
32
|
+
};
|
|
6
33
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
+ 'Get your API key from RoxyBrowser: API -> API配置 -> API Key');
|
|
34
|
+
/** Internal: config with apiKey validation (used by request()). */
|
|
35
|
+
function requireConfig() {
|
|
36
|
+
const config = resolveConfig();
|
|
37
|
+
if (!config.apiKey || config.apiKey.trim() === '') {
|
|
38
|
+
throw new ConfigError('API key is required. Set ROXY_API_KEY or pass --api-key. '
|
|
39
|
+
+ 'Get your key from RoxyBrowser: API → API配置 → API Key');
|
|
14
40
|
}
|
|
15
|
-
return
|
|
41
|
+
return config;
|
|
16
42
|
}
|
|
17
|
-
const config = getConfig();
|
|
18
43
|
export async function request(endpoint, options = {}) {
|
|
19
|
-
const
|
|
44
|
+
const config = requireConfig();
|
|
45
|
+
const url = `${config.apiHost.replace(/\/$/, '')}${endpoint}`;
|
|
20
46
|
const controller = new AbortController();
|
|
21
47
|
const timeoutId = setTimeout(() => controller.abort(), config.timeout);
|
|
22
48
|
try {
|
|
@@ -24,7 +50,7 @@ export async function request(endpoint, options = {}) {
|
|
|
24
50
|
...options,
|
|
25
51
|
headers: {
|
|
26
52
|
'Content-Type': 'application/json',
|
|
27
|
-
'token': config.apiKey,
|
|
53
|
+
'token': config.apiKey,
|
|
28
54
|
...options.headers,
|
|
29
55
|
},
|
|
30
56
|
signal: controller.signal,
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAA;AAWtB,yCAAyC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,wBAAwB;IACjC,OAAO,EAAE,MAAM;CACP,CAAA;AAEV,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,cAAc;CACf,CAAA;AAEV;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC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M,CAAC,MAAM;gBACtB,GAAG,OAAO,CAAC,OAAO;aACnB;YACD,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAA;QAEF,YAAY,CAAC,SAAS,CAAC,CAAA;QAEvB,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAA;YACvE,MAAM,IAAI,KAAK,CACb,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,IAAI,YAAY,EAAE,CAClE,CAAA;QACH,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAEpC,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACb,YAAY,CAAC,SAAS,CAAC,CAAA;QACvB,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roxybrowser/openapi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10-beta.0",
|
|
4
4
|
"description": "MCP server for RoxyBrowser automation - manage browser instances and get CDP endpoints",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"import": "./lib/index.js",
|
|
12
|
+
"default": "./lib/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
6
15
|
"bin": {
|
|
7
|
-
"
|
|
16
|
+
"roxybrowser-openapi-mcp": "lib/cli.js"
|
|
8
17
|
},
|
|
9
18
|
"repository": {
|
|
10
19
|
"type": "git",
|
|
@@ -37,12 +46,13 @@
|
|
|
37
46
|
"author": "RoxyBrowser",
|
|
38
47
|
"license": "MIT",
|
|
39
48
|
"dependencies": {
|
|
40
|
-
"@modelcontextprotocol/sdk": "^1.18.0"
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
50
|
+
"commander": "^14.0.3"
|
|
41
51
|
},
|
|
42
52
|
"devDependencies": {
|
|
43
53
|
"@types/node": "^22.0.0",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
54
|
+
"rimraf": "^6.0.1",
|
|
55
|
+
"typescript": "^5.9.2"
|
|
46
56
|
},
|
|
47
57
|
"engines": {
|
|
48
58
|
"node": ">=18"
|