@browsa/mcp 0.1.4 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +32 -14
  2. package/dist/server.js +210 -33
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -1,8 +1,12 @@
1
+ <p align="center">
2
+ <a href="https://browsa.io"><img src="https://browsa.io/browsa-logo-lockup.png" alt="Browsa" width="340"></a>
3
+ </p>
4
+
1
5
  # @browsa/mcp
2
6
 
3
- **Drive anti-detect browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client.**
7
+ **Drive real browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client.**
4
8
 
5
- MCP (Model Context Protocol) server for [Browsa](https://browsa.io) — turn any LLM into a real-browser agent with one config line. The agent gets a freshly-spawned macOS-Chrome-fingerprinted Chromium with built-in CAPTCHA solving, human-shaped behavioral pacing, and a live noVNC stream so you can watch it work.
9
+ MCP (Model Context Protocol) server for [Browsa](https://browsa.io): turn any LLM into a real-browser agent with one config line. The agent gets a freshly-spawned macOS-Chrome-fingerprinted Chromium with built-in CAPTCHA solving, human-shaped behavioral pacing, and a live noVNC stream so you can watch it work.
6
10
 
7
11
  [![npm version](https://img.shields.io/npm/v/@browsa/mcp.svg)](https://www.npmjs.com/package/@browsa/mcp)
8
12
 
@@ -14,7 +18,7 @@ Most "AI agent" setups stop at the LLM. We give the LLM a real browser. Through
14
18
  - Run from a residential US/UK/DE/etc. exit IP
15
19
  - Stay logged in across calls via persistent identities
16
20
 
17
- No code from you — just configure Claude Desktop (or Cursor / Cline / Zed) once, and ask in natural language.
21
+ No code from you: just configure Claude Desktop (or Cursor / Cline / Zed) once, and ask in natural language.
18
22
 
19
23
  ## Install
20
24
 
@@ -29,14 +33,15 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
29
33
  "command": "npx",
30
34
  "args": ["-y", "@browsa/mcp"],
31
35
  "env": {
32
- "BROWSA_API_KEY": "agt_live_...",
33
- "BROWSA_LLM_API_KEY": "sk-ant-..."
36
+ "BROWSA_API_KEY": "agt_live_..."
34
37
  }
35
38
  }
36
39
  }
37
40
  }
38
41
  ```
39
42
 
43
+ No LLM secret goes in the config: save your Anthropic, OpenAI or Google key once at [app.browsa.io/dashboard/llm-keys](https://app.browsa.io/dashboard/llm-keys) and tasks use the workspace's default saved key. (Prefer to keep it local? Add `"BROWSA_LLM_API_KEY": "sk-ant-..."` instead.)
44
+
40
45
  Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top story title."*
41
46
 
42
47
  ### Cursor
@@ -49,7 +54,7 @@ Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top st
49
54
  "browsa": {
50
55
  "command": "npx",
51
56
  "args": ["-y", "@browsa/mcp"],
52
- "env": { "BROWSA_API_KEY": "agt_live_...", "BROWSA_LLM_API_KEY": "sk-ant-..." }
57
+ "env": { "BROWSA_API_KEY": "agt_live_..." }
53
58
  }
54
59
  }
55
60
  }
@@ -57,29 +62,42 @@ Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top st
57
62
 
58
63
  ### Cline / Continue / Zed
59
64
 
60
- Any MCP-spec-compliant client. Point at `npx -y @browsa/mcp` and set the two env vars.
65
+ Any MCP-spec-compliant client. Point at `npx -y @browsa/mcp` and set `BROWSA_API_KEY`.
61
66
 
62
- ## Required env
67
+ ## Env
63
68
 
64
69
  | Var | Required | What |
65
70
  |---|---|---|
66
- | `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [browsa.io → Keys](https://browsa.io/dashboard/keys) |
67
- | `BROWSA_LLM_API_KEY` | recommended | Default LLM provider key (e.g. Anthropic). Without this, Claude must pass it on every `run_task` call |
68
- | `BROWSA_LLM` | no | Default LLM. Defaults to `claude-opus-4-7` |
71
+ | `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [browsa.io → Keys](https://app.browsa.io/dashboard/keys) |
72
+ | `BROWSA_LLM_KEY_ID` | no | Id of a saved LLM key to use by default (see `list_llm_keys`). Without it, the workspace's default saved key for the model's provider is used |
73
+ | `BROWSA_LLM_API_KEY` | no | A per-task LLM provider key sent with every task. Not needed once a key is saved at [dashboard/llm-keys](https://app.browsa.io/dashboard/llm-keys). Wins over `BROWSA_LLM_KEY_ID` |
74
+ | `BROWSA_LLM` | no | Default LLM, e.g. `anthropic:claude-sonnet-5-5`. Unset: the saved key's provider default model (`claude-opus-5-5` with `BROWSA_LLM_API_KEY`) |
69
75
  | `BROWSA_COUNTRY` | no | Default egress country (e.g. `US`) |
70
76
  | `BROWSA_BASE_URL` | no | Override prod URL (staging / self-hosted) |
71
77
 
78
+ ### Which LLM key a task uses
79
+
80
+ Per call, first match wins: `llm: "browsa"` (Browsa's hosted model, no key, 5-credit surcharge), then `llm_api_key`, then `llm_key_id`, then `BROWSA_LLM_API_KEY`, then `BROWSA_LLM_KEY_ID`. With none of these, no key is sent and the server uses the workspace's default saved key for the provider of `llm` (with `llm` unset: the first default in the order anthropic, openai, google).
81
+
82
+ If no key is saved at all:
83
+
84
+ - **No model named** (no `llm` argument, no `BROWSA_LLM`): `run_task` and `create_schedule` still work with zero config. They retry once on Browsa's hosted model (adds 5 credits per task) and the result has a `note` saying so: *"No saved LLM key found, so this ran on Browsa's hosted model (adds 5 credits). Save a key at https://app.browsa.io/dashboard/llm-keys to use your own."* The same happens if the server has saved keys turned off (`LLM_KEYS_UNAVAILABLE`). A schedule created this way stays on the hosted model; create it again after saving a key.
85
+ - **A model named**: there is no fallback. The tool returns an error (code `LLM_KEY_REQUIRED`) that says to save a key at [app.browsa.io/dashboard/llm-keys](https://app.browsa.io/dashboard/llm-keys), set `BROWSA_LLM_API_KEY`, or pass `llm: "browsa"`.
86
+
72
87
  ## Tools exposed
73
88
 
74
89
  | Tool | What |
75
90
  |---|---|
76
- | `run_task` | Run a browser-driven task. Returns final result + live noVNC URL. |
91
+ | `run_task` | Run a browser-driven task. Returns final result + live noVNC URL. Optional `llm_key_id`. |
77
92
  | `get_job` | Poll a long-running task. Optional server-side `wait_seconds`. |
78
93
  | `cancel_job` | Cancel a running task. |
79
94
  | `respond_to_job` | Answer an `input_required` prompt (CAPTCHA, decision). |
80
95
  | `credits` | Show credit balance + top-up packs. |
81
96
  | `list_webhooks` / `create_webhook` / `delete_webhook` | Webhook CRUD. |
82
97
  | `list_identities` | List persistent browser identities (use one via `profile_id` to reuse warmed cookies). |
98
+ | `create_schedule` / `list_schedules` | Recurring tasks. `create_schedule` takes `llm_key_id`; the schedule stores only the key's id. |
99
+ | `list_job_files` | Output files a task wrote. |
100
+ | `list_llm_keys` | Saved LLM keys: id, provider, masked key, default flag, status. Read-only; never returns a secret. |
83
101
 
84
102
  ## Why MCP-first matters
85
103
 
@@ -87,8 +105,8 @@ Most agent platforms gate distribution behind "write code → deploy → call ou
87
105
 
88
106
  ## Source + Issues
89
107
 
90
- - Source: <https://github.com/mohasaaid/neout/tree/main/sdks/browsa-mcp>
91
- - Issues: <https://github.com/mohasaaid/neout/issues>
108
+ - Docs: <https://browsa.io/docs>
109
+ - Support: <mailto:support@browsa.io>
92
110
  - API reference: <https://browsa.io/docs>
93
111
 
94
112
  ## License
package/dist/server.js CHANGED
@@ -9,13 +9,16 @@ import {
9
9
  } from "@modelcontextprotocol/sdk/types.js";
10
10
  import { Client, BrowsaError } from "browsa";
11
11
  var API_KEY = process.env.BROWSA_API_KEY;
12
- var BASE_URL = process.env.BROWSA_BASE_URL ?? process.env.NEOUT_BASE_URL;
13
- var DEFAULT_LLM = process.env.BROWSA_LLM ?? process.env.NEOUT_LLM ?? "claude-opus-4-7";
14
- var DEFAULT_LLM_KEY = process.env.BROWSA_LLM_API_KEY;
15
- var DEFAULT_COUNTRY = process.env.BROWSA_COUNTRY ?? process.env.NEOUT_COUNTRY;
12
+ var BASE_URL = process.env.BROWSA_BASE_URL;
13
+ var DEFAULT_LLM = process.env.BROWSA_LLM || void 0;
14
+ var BYOK_DEFAULT_LLM = "claude-opus-5-5";
15
+ var DEFAULT_LLM_KEY = process.env.BROWSA_LLM_API_KEY || void 0;
16
+ var DEFAULT_LLM_KEY_ID = process.env.BROWSA_LLM_KEY_ID || void 0;
17
+ var DEFAULT_COUNTRY = process.env.BROWSA_COUNTRY;
18
+ var LLM_KEYS_URL = "https://app.browsa.io/dashboard/llm-keys";
16
19
  if (!API_KEY) {
17
20
  console.error("[browsa-mcp] BROWSA_API_KEY env var is required");
18
- console.error(" Mint one at https://browsa.io/dashboard/keys");
21
+ console.error(" Mint one at https://app.browsa.io/dashboard/keys");
19
22
  process.exit(2);
20
23
  }
21
24
  var client = new Client({
@@ -23,13 +26,13 @@ var client = new Client({
23
26
  ...BASE_URL ? { baseUrl: BASE_URL } : {}
24
27
  });
25
28
  var server = new Server(
26
- { name: "browsa", version: "0.1.4" },
29
+ { name: "browsa", version: "0.2.1" },
27
30
  { capabilities: { tools: {} } }
28
31
  );
29
32
  var tools = [
30
33
  {
31
34
  name: "run_task",
32
- description: "Run a browser-driven AI task on a fresh anti-detect Chromium burner. Returns the final result, total steps, and a live noVNC URL the user can open to watch the browser drive in real time. Use this when the user asks for anything web-shaped: scrape, fill, click, extract, login, place an order, search, summarize a page, etc. The browser is a real macOS-Chrome-fingerprinted Chromium with built-in CAPTCHA solving (Turnstile, hCaptcha, reCAPTCHA, ALTCHA, FunCaptcha) and behavioral humanization. Default timeout: 10 minutes.",
35
+ description: "Run a browser-driven AI task on a fresh real Chromium burner. Returns the final result, total steps, and a live noVNC URL the user can open to watch the browser drive in real time. Use this when the user asks for anything web-shaped: scrape, fill, click, extract, login, place an order, search, summarize a page, etc. The browser is a real macOS-Chrome-fingerprinted Chromium with built-in CAPTCHA solving (Turnstile, hCaptcha, reCAPTCHA, ALTCHA, FunCaptcha) and behavioral humanization. Default timeout: 10 minutes.",
33
36
  inputSchema: {
34
37
  type: "object",
35
38
  required: ["task"],
@@ -40,11 +43,15 @@ var tools = [
40
43
  },
41
44
  llm: {
42
45
  type: "string",
43
- description: `LLM identifier (default: ${DEFAULT_LLM}). Common: claude-opus-4-7, claude-sonnet-4-6, gpt-4o.`
46
+ description: `LLM identifier, e.g. anthropic:claude-sonnet-5-5, openai:gpt-4o, google:gemini-2.5-flash${DEFAULT_LLM ? ` (default: ${DEFAULT_LLM})` : ""}. Omit to use the workspace's default saved key with its provider's default model; if no key is saved at all, the task runs on Browsa's hosted model and the result says so. Pass "browsa" to choose the hosted model (no LLM key, 5-credit surcharge per task). When you name a model, there is no hosted fallback.`
47
+ },
48
+ llm_key_id: {
49
+ type: "string",
50
+ description: `Id of a saved LLM key of this workspace (see list_llm_keys). Default: ${DEFAULT_LLM_KEY_ID ? "BROWSA_LLM_KEY_ID" : "none"}. Usually not needed: with no key given, the workspace's default saved key for the provider of llm is used.`
44
51
  },
45
52
  llm_api_key: {
46
53
  type: "string",
47
- description: "LLM provider API key (sk-ant-... / sk-...). Required if not set via BROWSA_LLM_API_KEY env."
54
+ description: "Per-task LLM provider key. Rarely needed: prefer a saved key (llm_key_id, or the workspace default) so the secret never passes through the chat. Overrides llm_key_id."
48
55
  },
49
56
  country: {
50
57
  type: "string",
@@ -58,7 +65,7 @@ var tools = [
58
65
  },
59
66
  profile_id: {
60
67
  type: "string",
61
- description: "Persistent identity UUID. If set, reuses an existing browser identity (cookies, history, fingerprint stay sticky). Omit for a fresh burner."
68
+ description: "Id of a persistent identity (agt_..., from list_identities). If set, reuses that browser identity (cookies, history, fingerprint stay sticky). Omit for a fresh burner."
62
69
  },
63
70
  timeout_minutes: {
64
71
  type: "integer",
@@ -71,7 +78,7 @@ var tools = [
71
78
  },
72
79
  {
73
80
  name: "get_job",
74
- description: "Fetch the current state of a previously-submitted job by UUID. Returns status (queued|running|completed|failed|cancelled|input_required), step count, final_result text if terminal, and the live_url for the noVNC stream. Cheap \u2014 call repeatedly to poll a long-running job started by run_task.",
81
+ description: "Fetch the current state of a previously-submitted job by UUID. Returns status (queued|running|completed|failed|input_required; a cancelled job is failed with error_code CANCELLED), step count, final_result text if terminal, and the live_url for the noVNC stream. Cheap \u2014 call repeatedly to poll a long-running job started by run_task.",
75
82
  inputSchema: {
76
83
  type: "object",
77
84
  required: ["job_id"],
@@ -88,7 +95,7 @@ var tools = [
88
95
  },
89
96
  {
90
97
  name: "cancel_job",
91
- description: "Cancel a running job. Idempotent \u2014 returns success even if the job already terminated.",
98
+ description: "Cancel a queued or running job. The job ends as failed with error_code CANCELLED and keeps its browser charge. A job that already finished returns an error with code JOB_NOT_CANCELLABLE.",
92
99
  inputSchema: {
93
100
  type: "object",
94
101
  required: ["job_id"],
@@ -146,6 +153,50 @@ var tools = [
146
153
  name: "list_identities",
147
154
  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
155
  inputSchema: { type: "object", properties: {} }
156
+ },
157
+ {
158
+ name: "create_schedule",
159
+ description: `Schedule a browser task to run automatically on a fixed interval (min 1 hour). Each run is a normal billed task. LLM key: same rules as run_task (the workspace's default saved key unless llm_key_id is given); the schedule stores only the saved key's id. With no llm and no saved key, the schedule runs on Browsa's hosted model and the result says so. Pass llm:"browsa" to choose Browsa's hosted model.`,
160
+ inputSchema: {
161
+ type: "object",
162
+ required: ["task", "interval_seconds"],
163
+ properties: {
164
+ task: { type: "string", description: "Plain-English task instructions (same as run_task)." },
165
+ interval_seconds: { type: "integer", description: "Run interval in seconds. 3600 (1h) \u2013 2592000 (30d).", minimum: 3600, maximum: 2592e3 },
166
+ name: { type: "string", description: "Optional label for the schedule." },
167
+ llm: {
168
+ type: "string",
169
+ description: `LLM id${DEFAULT_LLM ? ` (default ${DEFAULT_LLM})` : ""}. Omit to use the workspace's default saved key (hosted model if none is saved); use "browsa" for the hosted model.`
170
+ },
171
+ llm_key_id: { type: "string", description: "Id of a saved LLM key (see list_llm_keys). Optional." },
172
+ llm_api_key: {
173
+ type: "string",
174
+ description: "Per-schedule LLM key. Rarely needed: prefer a saved key. Overrides llm_key_id."
175
+ },
176
+ country: { type: "string", description: "2-letter egress country." },
177
+ max_steps: { type: "integer", description: "Max agent steps per run." },
178
+ initial_url: { type: "string", description: "Optional pre-navigation URL." }
179
+ }
180
+ }
181
+ },
182
+ {
183
+ name: "list_schedules",
184
+ description: "List this workspace's scheduled tasks (id, task, interval, next run, run count). Secrets redacted.",
185
+ inputSchema: { type: "object", properties: {} }
186
+ },
187
+ {
188
+ name: "list_llm_keys",
189
+ description: "List the LLM provider keys saved in this workspace: id, name, provider, masked key (prefix + last 4), whether it is the default for its provider, and its status (valid, invalid or unchecked). Never returns a secret. Pass an id as llm_key_id to run_task or create_schedule. Keys are added at " + LLM_KEYS_URL + ".",
190
+ inputSchema: { type: "object", properties: {} }
191
+ },
192
+ {
193
+ name: "list_job_files",
194
+ description: "List the output files a task wrote \u2014 extracted data + a session.gif recording. Returns name + size per file.",
195
+ inputSchema: {
196
+ type: "object",
197
+ required: ["job_id"],
198
+ properties: { job_id: { type: "string", description: "The job id from run_task / create_task." } }
199
+ }
149
200
  }
150
201
  ];
151
202
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
@@ -161,38 +212,118 @@ function fail(message, extra) {
161
212
  content: [{ type: "text", text: JSON.stringify(body, null, 2) }]
162
213
  };
163
214
  }
215
+ function chooseLlm(args) {
216
+ const llm = args.llm ?? DEFAULT_LLM;
217
+ if (String(llm ?? "").toLowerCase() === "browsa") return { llm: "browsa", source: "hosted" };
218
+ if (args.llm_api_key) return { llm: llm ?? BYOK_DEFAULT_LLM, llmApiKey: args.llm_api_key, source: "per_task" };
219
+ if (args.llm_key_id) return { llm, llmKeyId: args.llm_key_id, source: "saved" };
220
+ if (DEFAULT_LLM_KEY) return { llm: llm ?? BYOK_DEFAULT_LLM, llmApiKey: DEFAULT_LLM_KEY, source: "per_task" };
221
+ if (DEFAULT_LLM_KEY_ID) return { llm, llmKeyId: DEFAULT_LLM_KEY_ID, source: "saved" };
222
+ return { llm, source: "default" };
223
+ }
224
+ var HOSTED = { llm: "browsa", source: "hosted" };
225
+ var NO_KEY_HELP = `No LLM key for this task: the workspace has no default saved key for this model's provider. Save a key at ${LLM_KEYS_URL} (the first key of a provider becomes its default), or set BROWSA_LLM_API_KEY in the MCP env, or pass llm:"browsa" to run on Browsa's hosted model.`;
226
+ var HOSTED_FALLBACK_TASK_NOTE = `No saved LLM key found, so this ran on Browsa's hosted model (adds 5 credits). Save a key at ${LLM_KEYS_URL} to use your own.`;
227
+ var HOSTED_FALLBACK_SCHEDULE_NOTE = `No saved LLM key found, so this schedule runs on Browsa's hosted model (adds 5 credits per run). Save a key at ${LLM_KEYS_URL} and create the schedule again to use your own.`;
228
+ function canFallBackToHosted(e, choice) {
229
+ if (choice.source !== "default" || choice.llm !== void 0) return false;
230
+ return e.status === 400 && e.code === "LLM_KEY_REQUIRED" || e.status === 503 && e.code === "LLM_KEYS_UNAVAILABLE";
231
+ }
232
+ async function submitWithHostedFallback(choice, submit) {
233
+ try {
234
+ return { result: await submit(choice), fellBack: false };
235
+ } catch (e) {
236
+ if (e instanceof BrowsaError && canFallBackToHosted(e, choice)) {
237
+ return { result: await submit(HOSTED), fellBack: true };
238
+ }
239
+ throw e;
240
+ }
241
+ }
242
+ function llmKeyError(e, choice) {
243
+ const extra = { code: e.code, status: e.status, request_id: e.requestId, server_error: e.message };
244
+ if (choice.source === "hosted" || choice.source === "per_task") return null;
245
+ switch (e.code) {
246
+ case "LLM_KEY_REQUIRED":
247
+ return fail(NO_KEY_HELP, extra);
248
+ case "LLM_KEY_NOT_FOUND":
249
+ return fail(`Saved LLM key ${choice.llmKeyId} was not found in this workspace. Call list_llm_keys to see the saved keys.`, extra);
250
+ case "LLM_KEY_REJECTED":
251
+ return fail(`The provider rejected the saved LLM key. Rotate it at ${LLM_KEYS_URL}, or pick another key with llm_key_id.`, extra);
252
+ case "LLM_KEY_PROVIDER_MISMATCH":
253
+ return fail("The saved LLM key is for a different provider than llm. Omit llm to use the key's default model, or pick a matching model.", extra);
254
+ case "LLM_MODEL_REQUIRED":
255
+ return fail("This saved key is an OpenAI-compatible key, so the model must be named: pass llm with the model id your endpoint serves.", extra);
256
+ case "LLM_KEYS_UNAVAILABLE":
257
+ return fail(
258
+ `Saved LLM keys are not available on this Browsa server. Set BROWSA_LLM_API_KEY in the MCP env, pass llm_api_key, or pass llm:"browsa" to run on Browsa's hosted model.`,
259
+ extra
260
+ );
261
+ }
262
+ return null;
263
+ }
264
+ async function listLlmKeys() {
265
+ const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
266
+ const resp = await fetch(`${base}/v1/llm-keys`, {
267
+ headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.2.1" }
268
+ });
269
+ const body = await resp.json().catch(() => ({}));
270
+ if (!resp.ok) {
271
+ throw new BrowsaError(body?.error || `HTTP ${resp.status}`, { code: body?.code, requestId: body?.request_id, status: resp.status });
272
+ }
273
+ return {
274
+ llm_keys: (body?.llm_keys ?? []).map((k) => ({
275
+ id: k.id,
276
+ name: k.name,
277
+ provider: k.provider,
278
+ masked: k.masked,
279
+ base_url: k.base_url ?? null,
280
+ is_default: !!k.is_default,
281
+ status: k.status,
282
+ status_detail: k.status_detail,
283
+ status_message: k.status_message,
284
+ last_validated_at: k.last_validated_at ?? null,
285
+ last_used_at: k.last_used_at ?? null
286
+ })),
287
+ limit: body?.limit,
288
+ manage_at: LLM_KEYS_URL
289
+ };
290
+ }
164
291
  server.setRequestHandler(CallToolRequestSchema, async (req) => {
165
292
  const name = req.params.name;
166
293
  const args = req.params.arguments ?? {};
294
+ let choice = null;
167
295
  try {
168
296
  switch (name) {
169
297
  case "run_task": {
170
- const llm = args.llm ?? DEFAULT_LLM;
171
- const llmKey = args.llm_api_key ?? DEFAULT_LLM_KEY;
172
- if (!llmKey) {
173
- 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."
175
- );
176
- }
177
- const job = await client.runTask({
178
- task: args.task,
179
- llm,
180
- llmApiKey: llmKey,
181
- country: args.country ?? DEFAULT_COUNTRY,
182
- maxSteps: args.max_steps,
183
- initialUrl: args.initial_url,
184
- ja3Profile: args.ja3_profile,
185
- profileId: args.profile_id,
186
- timeoutMs: (args.timeout_minutes ?? 10) * 6e4
187
- });
298
+ choice = chooseLlm(args);
299
+ const { result: job, fellBack } = await submitWithHostedFallback(
300
+ choice,
301
+ (c) => client.runTask({
302
+ task: args.task,
303
+ // Omitted fields are dropped from the request body.
304
+ llm: c.llm,
305
+ llmApiKey: c.llmApiKey,
306
+ llmKeyId: c.llmKeyId,
307
+ country: args.country ?? DEFAULT_COUNTRY,
308
+ maxSteps: args.max_steps,
309
+ initialUrl: args.initial_url,
310
+ ja3Profile: args.ja3_profile,
311
+ profileId: args.profile_id,
312
+ timeoutMs: (args.timeout_minutes ?? 10) * 6e4
313
+ })
314
+ );
188
315
  return ok({
316
+ ...fellBack ? { note: HOSTED_FALLBACK_TASK_NOTE, llm: "browsa" } : {},
189
317
  job_id: job.id,
190
318
  status: job.status,
191
319
  steps: `${job.stepCount}/${job.progressTotal}`,
192
320
  live_url: job.liveUrl,
193
321
  credits_charged: job.creditsCharged,
322
+ llm_key_masked: job.raw?.llm_key_masked,
323
+ llm_key_source: job.raw?.llm_key_source,
194
324
  final_result: job.finalResult,
195
- error: job.errorMessage
325
+ error: job.errorMessage,
326
+ error_code: job.errorCode
196
327
  });
197
328
  }
198
329
  case "get_job": {
@@ -204,7 +335,8 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
204
335
  live_url: job.liveUrl,
205
336
  input_question: job.inputQuestion,
206
337
  final_result: job.finalResult,
207
- error: job.errorMessage
338
+ error: job.errorMessage,
339
+ error_code: job.errorCode
208
340
  });
209
341
  }
210
342
  case "cancel_job": {
@@ -225,12 +357,57 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
225
357
  await client.deleteWebhook(args.webhook_id);
226
358
  return ok({ deleted: args.webhook_id });
227
359
  case "list_identities":
228
- return ok(await client.listIdentities());
360
+ return ok((await client.listIdentities()).filter((a) => a.mode === "persistent"));
361
+ case "create_schedule": {
362
+ choice = chooseLlm(args);
363
+ const { result: s, fellBack } = await submitWithHostedFallback(
364
+ choice,
365
+ (c) => client.createSchedule({
366
+ name: args.name,
367
+ task: args.task,
368
+ llm: c.llm,
369
+ llmApiKey: c.llmApiKey,
370
+ llmKeyId: c.llmKeyId,
371
+ intervalSeconds: args.interval_seconds,
372
+ country: args.country ?? DEFAULT_COUNTRY,
373
+ maxSteps: args.max_steps,
374
+ initialUrl: args.initial_url
375
+ })
376
+ );
377
+ return ok({
378
+ ...fellBack ? { note: HOSTED_FALLBACK_SCHEDULE_NOTE, llm: "browsa" } : {},
379
+ id: s.id,
380
+ name: s.name,
381
+ interval_seconds: s.intervalSeconds,
382
+ enabled: s.enabled,
383
+ next_run_at: s.nextRunAt,
384
+ llm_key_id: s.raw?.llm_key_id
385
+ });
386
+ }
387
+ case "list_schedules":
388
+ return ok(
389
+ (await client.listSchedules()).map((s) => ({
390
+ id: s.id,
391
+ name: s.name,
392
+ task: s.task,
393
+ llm: s.llm,
394
+ interval_seconds: s.intervalSeconds,
395
+ enabled: s.enabled,
396
+ next_run_at: s.nextRunAt,
397
+ run_count: s.runCount
398
+ }))
399
+ );
400
+ case "list_job_files":
401
+ return ok(await client.listJobFiles(args.job_id));
402
+ case "list_llm_keys":
403
+ return ok(await listLlmKeys());
229
404
  default:
230
405
  return fail(`unknown tool: ${name}`);
231
406
  }
232
407
  } catch (e) {
233
408
  if (e instanceof BrowsaError) {
409
+ const keyErr = choice ? llmKeyError(e, choice) : null;
410
+ if (keyErr) return keyErr;
234
411
  return fail(e.message, {
235
412
  code: e.code,
236
413
  status: e.status,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@browsa/mcp",
3
- "version": "0.1.4",
4
- "description": "MCP server for Browsa — drive anti-detect cloud browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client",
3
+ "version": "0.2.1",
4
+ "description": "MCP server for Browsa: drive real cloud browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client",
5
5
  "license": "MIT",
6
6
  "author": "Browsa <support@browsa.io>",
7
7
  "homepage": "https://browsa.io",
@@ -15,7 +15,7 @@
15
15
  "cursor",
16
16
  "anthropic",
17
17
  "browser-automation",
18
- "anti-detect",
18
+ "real-browser",
19
19
  "ai-agents",
20
20
  "browser-use"
21
21
  ],
@@ -39,8 +39,8 @@
39
39
  "start": "node dist/server.js"
40
40
  },
41
41
  "dependencies": {
42
- "@modelcontextprotocol/sdk": "^1.0.0",
43
- "browsa": "^0.1.4"
42
+ "@modelcontextprotocol/sdk": "^1.32.2",
43
+ "browsa": "^0.2.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^20",