@browsa/mcp 0.1.4 → 0.2.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.
Files changed (2) hide show
  1. package/dist/server.js +73 -4
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -23,7 +23,7 @@ var client = new Client({
23
23
  ...BASE_URL ? { baseUrl: BASE_URL } : {}
24
24
  });
25
25
  var server = new Server(
26
- { name: "browsa", version: "0.1.4" },
26
+ { name: "browsa", version: "0.2.0" },
27
27
  { capabilities: { tools: {} } }
28
28
  );
29
29
  var tools = [
@@ -146,6 +146,38 @@ var tools = [
146
146
  name: "list_identities",
147
147
  description: "List persistent browser identities (long-lived cookies/history/fingerprint, billed monthly). Use one in run_task via profile_id to reuse a warmed-up session \u2014 critical for sites that fingerprint cookie age, session continuity, or behavioral history (Akamai, Cloudflare-strict, DataDome).",
148
148
  inputSchema: { type: "object", properties: {} }
149
+ },
150
+ {
151
+ name: "create_schedule",
152
+ description: `Schedule a browser task to run automatically on a fixed interval (min 1 hour). Each run is a normal billed task. Pass llm:"browsa" to run on Browsa's hosted model with no key.`,
153
+ inputSchema: {
154
+ type: "object",
155
+ required: ["task", "interval_seconds"],
156
+ properties: {
157
+ task: { type: "string", description: "Plain-English task instructions (same as run_task)." },
158
+ interval_seconds: { type: "integer", description: "Run interval in seconds. 3600 (1h) \u2013 2592000 (30d).", minimum: 3600, maximum: 2592e3 },
159
+ name: { type: "string", description: "Optional label for the schedule." },
160
+ llm: { type: "string", description: `LLM id (default ${DEFAULT_LLM}); use "browsa" for the hosted model (no key).` },
161
+ llm_api_key: { type: "string", description: 'LLM key (or set BROWSA_LLM_API_KEY). Omit when llm is "browsa".' },
162
+ country: { type: "string", description: "2-letter egress country." },
163
+ max_steps: { type: "integer", description: "Max agent steps per run." },
164
+ initial_url: { type: "string", description: "Optional pre-navigation URL." }
165
+ }
166
+ }
167
+ },
168
+ {
169
+ name: "list_schedules",
170
+ description: "List this workspace's scheduled tasks (id, task, interval, next run, run count). Secrets redacted.",
171
+ inputSchema: { type: "object", properties: {} }
172
+ },
173
+ {
174
+ name: "list_job_files",
175
+ description: "List the output files a task wrote \u2014 extracted data + a session.gif recording. Returns name + size per file.",
176
+ inputSchema: {
177
+ type: "object",
178
+ required: ["job_id"],
179
+ properties: { job_id: { type: "string", description: "The job id from run_task / create_task." } }
180
+ }
149
181
  }
150
182
  ];
151
183
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
@@ -169,15 +201,16 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
169
201
  case "run_task": {
170
202
  const llm = args.llm ?? DEFAULT_LLM;
171
203
  const llmKey = args.llm_api_key ?? DEFAULT_LLM_KEY;
172
- if (!llmKey) {
204
+ const hosted = String(llm).toLowerCase() === "browsa";
205
+ if (!llmKey && !hosted) {
173
206
  return fail(
174
- "llm_api_key is required (or set BROWSA_LLM_API_KEY in the MCP env). Most users add their Anthropic key once via the env and never pass it per-call."
207
+ `llm_api_key is required (or set BROWSA_LLM_API_KEY in the MCP env), or pass llm:"browsa" to run on Browsa's hosted model with no key.`
175
208
  );
176
209
  }
177
210
  const job = await client.runTask({
178
211
  task: args.task,
179
212
  llm,
180
- llmApiKey: llmKey,
213
+ llmApiKey: hosted ? void 0 : llmKey,
181
214
  country: args.country ?? DEFAULT_COUNTRY,
182
215
  maxSteps: args.max_steps,
183
216
  initialUrl: args.initial_url,
@@ -226,6 +259,42 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
226
259
  return ok({ deleted: args.webhook_id });
227
260
  case "list_identities":
228
261
  return ok(await client.listIdentities());
262
+ case "create_schedule": {
263
+ const llm = args.llm ?? DEFAULT_LLM;
264
+ const llmKey = args.llm_api_key ?? DEFAULT_LLM_KEY;
265
+ const hosted = String(llm).toLowerCase() === "browsa";
266
+ if (!llmKey && !hosted) {
267
+ return fail(
268
+ 'llm_api_key is required (or set BROWSA_LLM_API_KEY), or pass llm:"browsa" for the hosted model.'
269
+ );
270
+ }
271
+ const s = await client.createSchedule({
272
+ name: args.name,
273
+ task: args.task,
274
+ llm,
275
+ llmApiKey: hosted ? void 0 : llmKey,
276
+ intervalSeconds: args.interval_seconds,
277
+ country: args.country ?? DEFAULT_COUNTRY,
278
+ maxSteps: args.max_steps,
279
+ initialUrl: args.initial_url
280
+ });
281
+ return ok({ id: s.id, name: s.name, interval_seconds: s.intervalSeconds, enabled: s.enabled, next_run_at: s.nextRunAt });
282
+ }
283
+ case "list_schedules":
284
+ return ok(
285
+ (await client.listSchedules()).map((s) => ({
286
+ id: s.id,
287
+ name: s.name,
288
+ task: s.task,
289
+ llm: s.llm,
290
+ interval_seconds: s.intervalSeconds,
291
+ enabled: s.enabled,
292
+ next_run_at: s.nextRunAt,
293
+ run_count: s.runCount
294
+ }))
295
+ );
296
+ case "list_job_files":
297
+ return ok(await client.listJobFiles(args.job_id));
229
298
  default:
230
299
  return fail(`unknown tool: ${name}`);
231
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsa/mcp",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server for Browsa — drive anti-detect cloud browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client",
5
5
  "license": "MIT",
6
6
  "author": "Browsa <support@browsa.io>",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/sdk": "^1.0.0",
43
- "browsa": "^0.1.4"
43
+ "browsa": "^0.2.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^20",