@browsa/mcp 0.3.0 → 0.3.2

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
@@ -16,7 +16,7 @@ MCP (Model Context Protocol) server for [Browsa](https://browsa.io): turn any LL
16
16
  Most "AI agent" setups stop at the LLM. We give the LLM a real browser. Through MCP, Claude can now:
17
17
  - Navigate, fill forms, click, scroll, scrape
18
18
  - Return results as structured JSON
19
- - Use your own HTTP or SOCKS5 proxy per browser (Browsa supplies no proxies)
19
+ - Use your own HTTP or SOCKS5 proxy per browser, or a tier of Browsa's built-in network where it is on (see `proxy_network`)
20
20
  - Stay logged in across calls via persistent identities
21
21
 
22
22
  No code from you: just configure Claude Desktop (or Cursor / Cline / Zed) once, and ask in natural language.
@@ -100,18 +100,21 @@ Hosted tiers need no LLM key and add a flat number of credits per task. Which mo
100
100
 
101
101
  `reasoning` is `"low"`, `"medium"` or `"high"`; leave it out for the tier's or the provider's default. Ask in plain language, for example: *"Use browsa-smart with high reasoning to compare the pricing pages of these three sites."*
102
102
 
103
+ `run_task` and `get_job` results carry `status` and `outcome`. `status: completed` only means the run ended; `outcome: failed` with it means the agent finished but could not do the task, and `outcome_message` and `final_result` say why. `signals` lists what was seen on the way (a bot check, a proxy failure) when there is any.
104
+
103
105
  When the job has them, `run_task` and `get_job` results include `usage` (`input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_write_tokens`, `requests`), `llm_tier`, `reasoning` (the level that was applied) and `llm_cost_usd`. `llm_cost_usd` is an estimate from public list prices for runs with your own key; it is `null` when unknown and always `null` for hosted runs, which are paid in credits.
104
106
 
105
107
  ## Tools exposed
106
108
 
107
109
  | Tool | What |
108
110
  |---|---|
109
- | `run_task` | Run a browser-driven task. Returns final result + live noVNC URL. Optional `llm`, `reasoning`, `llm_key_id`. |
111
+ | `run_task` | Run a browser-driven task. Returns the final result, `outcome` and steps. Optional `llm`, `reasoning`, `llm_key_id`. |
110
112
  | `get_job` | Poll a long-running task. Optional server-side `wait_seconds`. |
111
113
  | `cancel_job` | Cancel a running task. |
112
114
  | `respond_to_job` | Answer an `input_required` prompt (CAPTCHA, decision). |
113
115
  | `start_browser` | Start a real cloud browser and get its CDP URL, to drive yourself with Playwright or Puppeteer. |
114
116
  | `stop_browser` | Stop a browser from `start_browser` and release it. |
117
+ | `proxy_network` | Whether Browsa's built-in proxy network is on, its tiers, countries and price. Read-only and free. |
115
118
  | `observe` | Read the page of a browser from `start_browser` as compact text with element ids. No Playwright needed. |
116
119
  | `act` | One action in that browser (click, type, press, select, scroll, navigate, wait and more); returns what changed. |
117
120
  | `list_browsers` | List this workspace's browsers and their status. |
package/dist/server.js CHANGED
@@ -16,17 +16,14 @@ var DEFAULT_LLM_KEY = process.env.BROWSA_LLM_API_KEY || void 0;
16
16
  var DEFAULT_LLM_KEY_ID = process.env.BROWSA_LLM_KEY_ID || void 0;
17
17
  var DEFAULT_COUNTRY = process.env.BROWSA_COUNTRY;
18
18
  var LLM_KEYS_URL = "https://app.browsa.io/dashboard/llm-keys";
19
+ var NO_KEY_MESSAGE = "BROWSA_API_KEY is not set. Add it to this MCP server's env (mint one at https://app.browsa.io/dashboard/keys), then restart the server.";
19
20
  if (!API_KEY) {
20
- console.error("[browsa-mcp] BROWSA_API_KEY env var is required");
21
+ console.error("[browsa-mcp] BROWSA_API_KEY is not set: tools are listed, but every call will fail until it is.");
21
22
  console.error(" Mint one at https://app.browsa.io/dashboard/keys");
22
- process.exit(2);
23
23
  }
24
- var client = new Client({
25
- apiKey: API_KEY,
26
- ...BASE_URL ? { baseUrl: BASE_URL } : {}
27
- });
24
+ var client = API_KEY ? new Client({ apiKey: API_KEY, ...BASE_URL ? { baseUrl: BASE_URL } : {} }) : null;
28
25
  var server = new Server(
29
- { name: "browsa", version: "0.3.0" },
26
+ { name: "browsa", version: "0.3.2" },
30
27
  { capabilities: { tools: {} } }
31
28
  );
32
29
  var REASONING_PROP = {
@@ -37,7 +34,7 @@ var REASONING_PROP = {
37
34
  var tools = [
38
35
  {
39
36
  name: "run_task",
40
- 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.",
37
+ description: "Run a browser-driven AI task on a fresh real Chromium burner. Returns the final result, the outcome and the total steps. `status: completed` only means the run ended: read `outcome`. `outcome: failed` with `status: completed` means the agent finished but could not do the task, and `final_result` says what stopped it. 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.",
41
38
  inputSchema: {
42
39
  type: "object",
43
40
  required: ["task"],
@@ -377,7 +374,7 @@ function llmKeyError(e, choice) {
377
374
  async function proxyNetwork() {
378
375
  const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
379
376
  const resp = await fetch(`${base}/v1/proxy-network`, {
380
- headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.0" }
377
+ headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.2" }
381
378
  });
382
379
  const body = await resp.json().catch(() => ({}));
383
380
  if (resp.status === 404) return { enabled: false, tiers: [] };
@@ -402,7 +399,7 @@ function proxyUsage(raw) {
402
399
  async function apiGet(path) {
403
400
  const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
404
401
  const resp = await fetch(`${base}${path}`, {
405
- headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.0" }
402
+ headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.2" }
406
403
  });
407
404
  const body = await resp.json().catch(() => ({}));
408
405
  if (!resp.ok) {
@@ -418,7 +415,7 @@ async function apiPost(path, payload, timeoutMs = 9e4) {
418
415
  "X-API-Key": API_KEY,
419
416
  Accept: "application/json",
420
417
  "Content-Type": "application/json",
421
- "User-Agent": "browsa-mcp/0.3.0"
418
+ "User-Agent": "browsa-mcp/0.3.2"
422
419
  },
423
420
  body: JSON.stringify(payload),
424
421
  signal: AbortSignal.timeout(timeoutMs)
@@ -452,6 +449,13 @@ async function listModels() {
452
449
  const body = await apiGet("/v1/models");
453
450
  return { hosted: body?.hosted ?? [], own_key: body?.own_key ?? {} };
454
451
  }
452
+ function outcomeFields(job) {
453
+ return {
454
+ outcome: job.outcome,
455
+ outcome_message: job.outcomeMessage,
456
+ ...job.signals && job.signals.length ? { signals: job.signals } : {}
457
+ };
458
+ }
455
459
  function llmResultFields(job) {
456
460
  const r = job.raw?.result;
457
461
  if (!r || typeof r !== "object") return {};
@@ -481,6 +485,9 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
481
485
  const name = req.params.name;
482
486
  const args = req.params.arguments ?? {};
483
487
  let choice = null;
488
+ if (!API_KEY) {
489
+ return { content: [{ type: "text", text: NO_KEY_MESSAGE }], isError: true };
490
+ }
484
491
  try {
485
492
  switch (name) {
486
493
  case "run_task": {
@@ -506,6 +513,7 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
506
513
  ...fellBack ? { note: HOSTED_FALLBACK_TASK_NOTE, llm: "browsa" } : {},
507
514
  job_id: job.id,
508
515
  status: job.status,
516
+ ...outcomeFields(job),
509
517
  steps: `${job.stepCount}/${job.progressTotal}`,
510
518
  live_url: job.liveUrl,
511
519
  credits_charged: job.creditsCharged,
@@ -523,6 +531,7 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
523
531
  return ok({
524
532
  job_id: job.id,
525
533
  status: job.status,
534
+ ...outcomeFields(job),
526
535
  steps: `${job.stepCount}/${job.progressTotal}`,
527
536
  live_url: job.liveUrl,
528
537
  input_question: job.inputQuestion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsa/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "mcpName": "io.browsa/browsa",
5
5
  "description": "MCP server for Browsa: drive real cloud browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.32.2",
45
- "browsa": "^0.3.0"
45
+ "browsa": "^0.3.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^20",