@browsa/mcp 0.10.0 → 0.11.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
@@ -12,7 +12,7 @@
12
12
  [![npm version](https://img.shields.io/npm/v/@browsa/mcp.svg)](https://www.npmjs.com/package/@browsa/mcp)
13
13
  [![CI](https://github.com/browsa-io/browsa/actions/workflows/ci.yml/badge.svg)](https://github.com/browsa-io/browsa/actions/workflows/ci.yml)
14
14
 
15
- You need a Browsa API key: create one at [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys) and replace `agt_live_...` below with it. New accounts get 100 free credits after email verification, no card.
15
+ You need a Browsa API key: create one at [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys) and replace `agt_live_...` below with it. New accounts get $3 of free credits after email verification, no card.
16
16
 
17
17
  ## Install
18
18
 
@@ -136,7 +136,7 @@ Ten tools are on by default. Their definitions are about 1.86k tokens in total.
136
136
 
137
137
  | Tool | What it does |
138
138
  |---|---|
139
- | `open` | Opens a cloud browser and goes to `url`. Returns the browser id, a live view link and the first view. Options: `country`, `profile` (a saved identity), `proxy`, `ttl` (default 10m). |
139
+ | `open` | Opens a cloud browser and goes to `url`. Returns the browser id, a live view link and the first view. Options: `country`, `profile` (a saved profile), `proxy`, `ttl` (default 10m). |
140
140
  | `observe` | The page as text, one line per element: `[id] role "name" state`. Default budget 1500 tokens, up to 6000. `scope: page` for the whole page, `expand` for one container in full, `find` (text or `/regex/`) for only the matching lines. |
141
141
  | `act` | One action with real input: click, type, press, select, check, uncheck, hover, scroll, navigate, back, forward, reload, wait, upload, dialog, press_and_hold, solve_captcha. Answers with what changed (at most 400 tokens) or a fresh view. |
142
142
  | `read` | The full content of one container, with no model: `as: text`, `table` (TSV) or `links`. |
@@ -199,6 +199,8 @@ flow {op: "run", name: "book-search", params: {query: "travel"}}
199
199
  - The server writes no files. Screenshots and page text come back inline; state (open browsers, a flow being recorded, captcha spend) is kept in memory.
200
200
  - Live links are single use and expire.
201
201
 
202
+ `start_browser` (group `cdp`) takes `captcha: "off"` to keep Browsa from solving captchas in that browser; by default a solved captcha is charged per solve.
203
+
202
204
  ## More tools (optional groups)
203
205
 
204
206
  Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma separated) or the argument `--tools=...`:
@@ -212,6 +214,7 @@ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma
212
214
  | `cdp` | `start_browser`, `stop_browser` (a CDP address, to drive the browser from your own code) |
213
215
  | `captcha_page` | `detect_captcha`, `solve_captcha_on_page`, `captcha_allowance`: captcha solving for a browser of your own, [below](#captchas-in-your-own-browser) |
214
216
  | `captcha` | `solve_captcha_task` (Browsa's captcha API, for pages outside a Browsa browser; the answer says what the solve cost), `list_captcha_types` (every type with its parameters, price and measured pass rate), `report_captcha_result` (tell Browsa whether the site took a solution; an incorrect report refunds that solve once, within limits: within 15 minutes of the solve, and a capped share of the workspace's solves of the last 24 hours. The answer's `refunded` says whether it did) |
217
+ | `profiles` | `list_profiles`, `create_profile`, `open_profile`, `close_profile`, `update_profile`, `delete_profile`, `profile_runs`: [saved profiles](#saved-profiles) |
215
218
  | `admin` | `credits`, `list_browsers`, `list_identities`, `proxy_network`, `list_llm_keys`, `list_models` |
216
219
  | `all` | every group |
217
220
 
@@ -221,32 +224,49 @@ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma
221
224
 
222
225
  A tool name works too (`BROWSA_MCP_TOOLS=run_task,credits`). A leading `-` takes a group or a tool off again, and `-core` takes the ten core tools off: `captcha_page,-core` lists three tools, `captcha,captcha_page,-core,-report_captcha_result` five. Calling a tool whose group is off answers with the setting that turns it on.
223
226
 
227
+ ### Saved profiles
228
+
229
+ A saved profile is a browser that keeps its cookies, logins and fingerprint between sessions: log in once, and every later browser on it starts logged in. The seven tools are in the `profiles` group, so they are not in the default ten (`BROWSA_MCP_TOOLS=profiles`).
230
+
231
+ | Tool | Does |
232
+ |---|---|
233
+ | `list_profiles` | Saved profiles: `profile_id`, `name`, `notes`, `status`, `open_session` |
234
+ | `create_profile` | Create one (`name`, `notes`, `country`, `os_type`, `captcha`, `proxy`) and open its first browser; charged on creation and every 30 days |
235
+ | `open_profile` | Open a browser on it (`start_url`, `ttl`, `idle_timeout`, `country`); returns `cdp_http`, `cdp_url`, `live_url` |
236
+ | `close_profile` | Stop its open browser and save the cookies; the profile stays |
237
+ | `update_profile` | Set `name`, `notes` or both; `""` clears |
238
+ | `delete_profile` | Delete it for good, with its cookies |
239
+ | `profile_runs` | Its browser sessions, newest first, with `cost_usd` |
240
+
241
+ `list_identities` (admin group) is the older name for `list_profiles` and keeps working. Pass a profile's id to `run_task` or `start_browser` as `profile_id` to run on it.
242
+
224
243
  ### What the tool list costs
225
244
 
226
245
  The tool definitions a client loads before the first message, per setting. Tokens are an estimate, characters of the JSON definitions divided by 4 (no tokenizer; real counts differ by model). `npm run tokens` prints this table from the built server.
227
246
 
228
247
  | Tools listed | `BROWSA_MCP_TOOLS` | Tools | Tokens (chars / 4) |
229
248
  |---|---|---|---|
230
- | default | (unset) | 10 | 1,863 |
249
+ | default | (unset) | 10 | 1,903 |
231
250
  | the captcha tools for your own browser | `captcha_page,-core` | 3 | 603 |
232
251
  | the captcha API tools | `captcha,-core` | 3 | 765 |
233
- | `tasks` | `tasks,-core` | 5 | 1,410 |
252
+ | `tasks` | `tasks,-core` | 5 | 1,598 |
234
253
  | `robots` | `robots,-core` | 3 | 496 |
235
254
  | `schedules` | `schedules,-core` | 2 | 505 |
236
255
  | `webhooks` | `webhooks,-core` | 3 | 281 |
237
- | `cdp` | `cdp,-core` | 2 | 691 |
238
- | `admin` | `admin,-core` | 6 | 575 |
239
- | everything | `all` | 37 | 7,396 |
256
+ | `cdp` | `cdp,-core` | 2 | 795 |
257
+ | `profiles` | `profiles,-core` | 7 | 1,272 |
258
+ | `admin` | `admin,-core` | 6 | 640 |
259
+ | everything | `all` | 44 | 8,852 |
240
260
 
241
- A group adds its row to the default's 1,863. Prompts are fetched only when picked and add nothing. The annotations are about 200 of the default's tokens (0.8.0 listed the same nine tools in 1,244).
261
+ A group adds its row to the default's 1,903. Prompts are fetched only when picked and add nothing. The annotations are about 200 of the default's tokens (0.8.0 listed the same nine tools in 1,244).
242
262
 
243
263
  ### Annotations
244
264
 
245
265
  | Hint | Tools |
246
266
  |---|---|
247
- | Read-only (`readOnlyHint: true`): changes nothing, spends nothing | `observe`, `read`, `screenshot`, `secrets`, `get_job`, `list_job_files`, `list_robots`, `get_robot_run`, `list_schedules`, `list_webhooks`, `list_captcha_types`, `detect_captcha`, `captcha_allowance`, `credits`, `list_browsers`, `list_identities`, `proxy_network`, `list_llm_keys`, `list_models` |
248
- | Can change something for good (`destructiveHint: true`) | `act`, `flow`, `run_task`, `run_robot` (the page decides what a click does), `close`, `stop_browser`, `cancel_job`, `delete_webhook` |
249
- | Writes, not destructive | `open`, `handoff`, `respond_to_job`, `create_schedule`, `create_webhook`, `start_browser`, `solve_captcha_task`, `solve_captcha_on_page`, `report_captcha_result` |
267
+ | Read-only (`readOnlyHint: true`): changes nothing, spends nothing | `observe`, `read`, `screenshot`, `secrets`, `get_job`, `list_job_files`, `list_robots`, `get_robot_run`, `list_schedules`, `list_webhooks`, `list_captcha_types`, `detect_captcha`, `captcha_allowance`, `credits`, `list_browsers`, `list_identities`, `list_profiles`, `profile_runs`, `proxy_network`, `list_llm_keys`, `list_models` |
268
+ | Can change something for good (`destructiveHint: true`) | `act`, `flow`, `run_task`, `run_robot` (the page decides what a click does), `close`, `stop_browser`, `close_profile`, `delete_profile`, `cancel_job`, `delete_webhook` |
269
+ | Writes, not destructive | `open`, `handoff`, `respond_to_job`, `create_schedule`, `create_webhook`, `start_browser`, `create_profile`, `open_profile`, `update_profile`, `solve_captcha_task`, `solve_captcha_on_page`, `report_captcha_result` |
250
270
 
251
271
  `detect_captcha` and `captcha_allowance` also say `openWorldHint: false`: they run inside the server process and make no request.
252
272
 
@@ -338,7 +358,7 @@ Nothing to change. The default tool list is the same nine tools, and every exist
338
358
  - **To keep every 0.5 tool**, set `BROWSA_MCP_TOOLS=all`. Nothing else changes for them: same names, same arguments, same JSON answers.
339
359
  - `start_browser` and `stop_browser` move to the `cdp` group. Use `open` and `close` instead: `open` also navigates and returns the first view.
340
360
  - `observe` and `act` keep their names and arguments; `browser_id` is now optional. Their answers are plain text and the first line of `act` is the status, as above. `observe`'s default budget is 1500 tokens (it was 2000); pass `budget` for more.
341
- - `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and identities in `admin`.
361
+ - `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and profiles in `admin`.
342
362
  - The task tools still read `BROWSA_LLM`, `BROWSA_LLM_KEY_ID` and `BROWSA_LLM_API_KEY`.
343
363
 
344
364
  ## Env
package/dist/server.js CHANGED
@@ -682,7 +682,7 @@ var catalogue_snapshot_default = {
682
682
  import { BrowsaError } from "browsa";
683
683
 
684
684
  // src/config.ts
685
- var VERSION = "0.10.0";
685
+ var VERSION = "0.11.0";
686
686
  var USER_AGENT = `browsa-mcp/${VERSION}`;
687
687
  var API_KEY = process.env.BROWSA_API_KEY?.trim() || void 0;
688
688
  var BASE_URL = (process.env.BROWSA_BASE_URL || "https://browsa.io").replace(/\/+$/, "");
@@ -740,6 +740,7 @@ var GROUPS = {
740
740
  cdp: ["start_browser", "stop_browser"],
741
741
  captcha: ["solve_captcha_task", "list_captcha_types", "report_captcha_result"],
742
742
  captcha_page: ["detect_captcha", "solve_captcha_on_page", "captcha_allowance"],
743
+ profiles: ["list_profiles", "create_profile", "open_profile", "close_profile", "update_profile", "delete_profile", "profile_runs"],
743
744
  admin: ["credits", "list_browsers", "list_identities", "proxy_network", "list_llm_keys", "list_models"]
744
745
  };
745
746
  var CORE_TOOLS = ["open", "observe", "act", "read", "screenshot", "secrets", "handoff", "flow", "close", "fetch_page"];
@@ -1820,7 +1821,14 @@ var ANNOTATIONS = {
1820
1821
  // admin
1821
1822
  credits: read("Credit balance"),
1822
1823
  list_browsers: read("List browsers"),
1823
- list_identities: read("List identities"),
1824
+ list_identities: read("List profiles"),
1825
+ list_profiles: read("List saved profiles"),
1826
+ create_profile: write("Create a saved profile"),
1827
+ open_profile: write("Open a saved profile"),
1828
+ close_profile: destructive("Close a profile's browser", { idempotentHint: true }),
1829
+ update_profile: write("Rename a saved profile", { idempotentHint: true }),
1830
+ delete_profile: destructive("Delete a saved profile", { idempotentHint: true }),
1831
+ profile_runs: read("A profile's sessions"),
1824
1832
  proxy_network: read("Proxy network"),
1825
1833
  list_llm_keys: read("List saved LLM keys"),
1826
1834
  list_models: read("List models")
@@ -1864,6 +1872,14 @@ async function apiPost(path, payload, timeoutMs = 9e4) {
1864
1872
  signal: AbortSignal.timeout(timeoutMs)
1865
1873
  }), { idempotent: false }));
1866
1874
  }
1875
+ async function apiPatch(path, payload, timeoutMs = 3e4) {
1876
+ return parse(await fetchRetry(`${BASE_URL}${path}`, () => ({
1877
+ method: "PATCH",
1878
+ headers: headers(true),
1879
+ body: JSON.stringify(payload ?? {}),
1880
+ signal: AbortSignal.timeout(timeoutMs)
1881
+ }), { idempotent: false }));
1882
+ }
1867
1883
  async function apiDelete(path, timeoutMs = 3e4) {
1868
1884
  return parse(await fetchRetry(
1869
1885
  `${BASE_URL}${path}`,
@@ -2154,7 +2170,7 @@ var coreTools = [
2154
2170
  url: { type: "string" },
2155
2171
  where: { type: "string", enum: ["cloud"] },
2156
2172
  country: { type: "string", description: "Exit country, e.g. us. Needs a proxy." },
2157
- profile: { type: "string", description: "Saved identity id: keeps its cookies and logins." },
2173
+ profile: { type: "string", description: "Saved profile id: keeps its cookies and logins." },
2158
2174
  proxy: { type: "object", description: "{network: datacenter|residential, country?} or your own {server, username?, password?}." },
2159
2175
  ttl: { type: "string", description: "e.g. 10m (default), 1h, 8h (up to 24h), or until_stopped (runs until close, 30 min idle, or out of credits). Over 1h needs purchased credits." },
2160
2176
  idle_timeout: { type: "string", description: "Stop after this long with nothing connected, e.g. 10m; off = never." }
@@ -2875,7 +2891,7 @@ var legacyTools = [
2875
2891
  },
2876
2892
  profile_id: {
2877
2893
  type: "string",
2878
- 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."
2894
+ description: "Id of a saved profile (agt_..., from list_identities). If set, reuses that browser profile (cookies, history, fingerprint stay sticky). Omit for a fresh burner."
2879
2895
  },
2880
2896
  secret_ids: {
2881
2897
  type: "array",
@@ -2952,9 +2968,10 @@ var legacyTools = [
2952
2968
  idle_timeout: { type: "string", description: 'Stop after this long with nothing connected, e.g. "10m"; "off" = never.' },
2953
2969
  country: { type: "string", description: 'ISO-2 country, e.g. "us". Takes effect only with a proxy.' },
2954
2970
  os_type: { type: "string", description: 'Operating system the browser presents, e.g. "macos", "windows".' },
2971
+ captcha: { type: "string", enum: ["auto", "off"], description: '"auto" (default): Browsa solves a captcha widget in this browser by itself while you drive it, charged per solve. "off": it never touches the browser.' },
2955
2972
  profile_id: {
2956
2973
  type: "string",
2957
- description: "Reuse a saved identity (see list_identities) so the browser starts with its cookies and logins."
2974
+ description: "Reuse a saved profile (see list_identities) so the browser starts with its cookies and logins."
2958
2975
  },
2959
2976
  proxy: {
2960
2977
  type: "object",
@@ -2989,7 +3006,7 @@ var legacyTools = [
2989
3006
  },
2990
3007
  {
2991
3008
  name: "list_browsers",
2992
- description: "List this workspace's browsers (burners and saved identities) with their status.",
3009
+ description: "List this workspace's browsers (burners and saved profiles) with their status.",
2993
3010
  inputSchema: { type: "object", properties: {} }
2994
3011
  },
2995
3012
  {
@@ -3029,7 +3046,7 @@ var legacyTools = [
3029
3046
  },
3030
3047
  {
3031
3048
  name: "list_identities",
3032
- description: "List persistent browser identities (long-lived cookies/history/fingerprint, billed monthly). Use one in run_task via profile_id (or open via profile) to reuse a warmed-up session: it matters on sites that check cookie age, session continuity or behavioral history.",
3049
+ description: "Older name of list_profiles (group profiles): list saved browser profiles (long-lived cookies/history/fingerprint, billed monthly). Use one in run_task via profile_id (or open via profile) to reuse a warmed-up session: it matters on sites that check cookie age, session continuity or behavioral history.",
3033
3050
  inputSchema: { type: "object", properties: {} }
3034
3051
  },
3035
3052
  {
@@ -3241,7 +3258,24 @@ async function proxyNetwork() {
3241
3258
  }
3242
3259
  function proxyUsage(raw) {
3243
3260
  if (!raw || typeof raw.proxy_network !== "string" || !raw.proxy_network) return {};
3244
- return { proxy_network: raw.proxy_network, proxy_bytes: raw.proxy_bytes ?? 0, proxy_credits: raw.proxy_credits ?? 0 };
3261
+ return {
3262
+ proxy_network: raw.proxy_network,
3263
+ proxy_bytes: raw.proxy_bytes ?? 0,
3264
+ proxy_credits: raw.proxy_credits ?? 0,
3265
+ ...typeof raw.proxy_credits_usd === "string" ? { proxy_credits_usd: raw.proxy_credits_usd } : {}
3266
+ };
3267
+ }
3268
+ function settledFields(raw) {
3269
+ if (!raw || typeof raw !== "object") return {};
3270
+ const r = raw.result && typeof raw.result === "object" ? raw.result : {};
3271
+ const captcha = Array.isArray(raw.captcha) ? raw.captcha : Array.isArray(r.captcha) ? r.captcha : void 0;
3272
+ return {
3273
+ ...raw.exit && typeof raw.exit === "object" ? { exit: raw.exit } : {},
3274
+ ...typeof raw.credits_refunded_usd === "string" ? { credits_refunded_usd: raw.credits_refunded_usd } : {},
3275
+ ...typeof raw.net_charged_usd === "string" ? { net_charged_usd: raw.net_charged_usd } : {},
3276
+ ...captcha && captcha.length ? { captcha } : {},
3277
+ ...typeof r.captcha_message === "string" ? { captcha_message: r.captcha_message } : {}
3278
+ };
3245
3279
  }
3246
3280
  async function listModels() {
3247
3281
  const body = await apiGet("/v1/models");
@@ -3489,6 +3523,7 @@ async function callLegacy(name, args) {
3489
3523
  credits_charged: job.creditsCharged,
3490
3524
  ...typeof job.raw?.credits_charged_usd === "string" ? { credits_charged_usd: job.raw.credits_charged_usd } : {},
3491
3525
  ...proxyUsage(job.raw),
3526
+ ...settledFields(job.raw),
3492
3527
  llm_key_masked: job.raw?.llm_key_masked,
3493
3528
  llm_key_source: job.raw?.llm_key_source,
3494
3529
  ...llmResultFields(job),
@@ -3513,7 +3548,8 @@ async function callLegacy(name, args) {
3513
3548
  final_result: job.finalResult,
3514
3549
  error: job.errorMessage,
3515
3550
  error_code: job.errorCode,
3516
- ...proxyUsage(job.raw)
3551
+ ...proxyUsage(job.raw),
3552
+ ...settledFields(job.raw)
3517
3553
  });
3518
3554
  }
3519
3555
  case "cancel_job": {
@@ -3531,7 +3567,8 @@ async function callLegacy(name, args) {
3531
3567
  country: args.country ?? DEFAULT_COUNTRY2,
3532
3568
  osType: args.os_type,
3533
3569
  agent_id: args.profile_id,
3534
- proxy: args.proxy
3570
+ proxy: args.proxy,
3571
+ captcha: args.captcha
3535
3572
  });
3536
3573
  return ok({
3537
3574
  browser_id: a.id,
@@ -3545,6 +3582,7 @@ async function callLegacy(name, args) {
3545
3582
  credits_charged: a.cost_credits,
3546
3583
  ...typeof a.cost_usd === "string" ? { cost_usd: a.cost_usd } : {},
3547
3584
  ...proxyUsage(a),
3585
+ ...settledFields(a),
3548
3586
  egress: args.proxy?.network ? `Browsa ${args.proxy.network} proxy network` : args.proxy ? "your proxy" : "Browsa's data-center IP",
3549
3587
  note: "Call stop_browser with this browser_id when you are done."
3550
3588
  });
@@ -3663,6 +3701,179 @@ function keptBrowserFields(raw) {
3663
3701
  };
3664
3702
  }
3665
3703
 
3704
+ // src/profiles.ts
3705
+ var ID = { type: "string", description: "The profile id (agt_..., from list_profiles or create_profile)." };
3706
+ var PROFILE_TOOLS = [
3707
+ "list_profiles",
3708
+ "create_profile",
3709
+ "open_profile",
3710
+ "close_profile",
3711
+ "update_profile",
3712
+ "delete_profile",
3713
+ "profile_runs"
3714
+ ];
3715
+ var profileTools = [
3716
+ {
3717
+ name: "list_profiles",
3718
+ description: "List saved profiles: browsers that keep cookies, logins and a fingerprint between sessions. Each row has id, name, notes, status and open_session (null when no browser is open on it). Pass the id to open_profile, or to run_task as profile_id. Free.",
3719
+ inputSchema: {
3720
+ type: "object",
3721
+ properties: {
3722
+ include_deleted: { type: "boolean", description: "Also list deleted profiles. Default false." },
3723
+ limit: { type: "integer", description: "1 to 200. Default 50." }
3724
+ }
3725
+ }
3726
+ },
3727
+ {
3728
+ name: "create_profile",
3729
+ description: "Create a saved profile and open its first browser. It is charged when created and again every 30 days to keep it: cost_usd in the answer says what was charged. Returns profile_id and the browser's cdp_http, cdp_url and live_url. Log in once in it, and every later open_profile starts already logged in. Call close_profile when you are done with the browser.",
3730
+ inputSchema: {
3731
+ type: "object",
3732
+ properties: {
3733
+ name: { type: "string", description: "A name for the profile, up to 80 characters." },
3734
+ notes: { type: "string", description: "Free text about it, up to 1500 characters." },
3735
+ country: { type: "string", description: 'ISO-2 country, e.g. "us". Takes effect only with a proxy.' },
3736
+ os_type: { type: "string", description: 'Operating system the browser presents, e.g. "linux", "macos", "windows".' },
3737
+ captcha: { type: "string", enum: ["auto", "off"], description: '"auto" (default): Browsa solves captcha widgets in this browser by itself, charged per solve. "off": it never touches the browser.' },
3738
+ proxy: {
3739
+ type: "object",
3740
+ description: `Your own proxy (host and port, or server) or a tier of Browsa's built-in network: {"network": "datacenter"} or {"network": "residential", "country": "us"}. The profile keeps it for every later session.`
3741
+ }
3742
+ }
3743
+ }
3744
+ },
3745
+ {
3746
+ name: "open_profile",
3747
+ description: "Open a new browser on a saved profile, with its cookies and logins. Billed per started hour. Returns the browser's cdp_http, cdp_url and live_url. Call close_profile when you are done.",
3748
+ inputSchema: {
3749
+ type: "object",
3750
+ required: ["profile_id"],
3751
+ properties: {
3752
+ profile_id: ID,
3753
+ start_url: { type: "string", description: "The page the browser opens on." },
3754
+ ttl: { type: "string", description: 'How long to keep it, e.g. "30m", "8h" (up to 24h). Default 1h.' },
3755
+ idle_timeout: { type: "string", description: 'Stop after this long with nothing connected, e.g. "10m"; "off" = never.' },
3756
+ country: { type: "string", description: 'ISO-2 country, e.g. "us".' }
3757
+ }
3758
+ }
3759
+ },
3760
+ {
3761
+ name: "close_profile",
3762
+ description: "Close the open browser of a saved profile and save its cookies. The profile stays and open_profile opens it again. Closing when nothing is open is not an error. To remove the profile itself use delete_profile.",
3763
+ inputSchema: { type: "object", required: ["profile_id"], properties: { profile_id: ID } }
3764
+ },
3765
+ {
3766
+ name: "update_profile",
3767
+ description: "Rename a saved profile or change its notes. Send name, notes or both: a field you leave out stays as it is, and an empty string clears it. Free.",
3768
+ inputSchema: {
3769
+ type: "object",
3770
+ required: ["profile_id"],
3771
+ properties: {
3772
+ profile_id: ID,
3773
+ name: { type: "string", description: "New name, up to 80 characters." },
3774
+ notes: { type: "string", description: "New notes, up to 1500 characters." }
3775
+ }
3776
+ }
3777
+ },
3778
+ {
3779
+ name: "delete_profile",
3780
+ description: "Delete a saved profile for good: any open browser is stopped and its cookies and logins are removed. This cannot be undone. To stop only the browser, use close_profile.",
3781
+ inputSchema: { type: "object", required: ["profile_id"], properties: { profile_id: ID } }
3782
+ },
3783
+ {
3784
+ name: "profile_runs",
3785
+ description: "The browser sessions a saved profile has had, newest first: id, started_at, closed_at (null while open), seconds, cost_usd and status. Free.",
3786
+ inputSchema: {
3787
+ type: "object",
3788
+ required: ["profile_id"],
3789
+ properties: { profile_id: ID, limit: { type: "integer", description: "1 to 200. Default 50." } }
3790
+ }
3791
+ }
3792
+ ];
3793
+ function ok2(payload) {
3794
+ return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
3795
+ }
3796
+ function fail2(message, extra) {
3797
+ return { isError: true, content: [{ type: "text", text: JSON.stringify(extra ? { error: message, ...extra } : { error: message }, null, 2) }] };
3798
+ }
3799
+ var seg = (id) => encodeURIComponent(String(id));
3800
+ function profileView(a) {
3801
+ return {
3802
+ profile_id: a.id,
3803
+ name: a.name ?? a.persona ?? "",
3804
+ notes: a.notes ?? "",
3805
+ status: a.status,
3806
+ open_session: a.open_session ?? null,
3807
+ created_at: a.created_at
3808
+ };
3809
+ }
3810
+ function browserView(a) {
3811
+ return {
3812
+ ...profileView(a),
3813
+ cdp_http: a.cdp_http,
3814
+ cdp_url: a.cdp_url,
3815
+ live_url: a.live_url,
3816
+ expires_at: a.expires_at,
3817
+ ...a.cost_credits != null ? { credits_charged: a.cost_credits } : {},
3818
+ ...typeof a.cost_usd === "string" ? { cost_usd: a.cost_usd } : {},
3819
+ note: "Call close_profile with this profile_id when you are done."
3820
+ };
3821
+ }
3822
+ async function callProfiles(name, args) {
3823
+ try {
3824
+ if (name !== "list_profiles" && name !== "create_profile" && !args.profile_id) return fail2("profile_id is required");
3825
+ switch (name) {
3826
+ case "list_profiles": {
3827
+ const q = new URLSearchParams();
3828
+ if (Number(args.limit) > 0) q.set("limit", String(Math.floor(Number(args.limit))));
3829
+ if (args.include_deleted === true) q.set("include_deleted", "true");
3830
+ const s = q.toString();
3831
+ const body = await apiGet(`/v1/profiles${s ? `?${s}` : ""}`);
3832
+ return ok2({ profiles: (body?.agents ?? []).map(profileView) });
3833
+ }
3834
+ case "create_profile": {
3835
+ const body = {};
3836
+ for (const k of ["name", "notes", "country", "os_type", "captcha", "proxy"]) if (args[k] != null) body[k] = args[k];
3837
+ return ok2(browserView(await apiPost("/v1/profiles", body)));
3838
+ }
3839
+ case "open_profile": {
3840
+ const body = {};
3841
+ if (args.start_url != null) body.initial_url = args.start_url;
3842
+ for (const k of ["ttl", "idle_timeout", "country"]) if (args[k] != null) body[k] = args[k];
3843
+ return ok2(browserView(await apiPost(`/v1/profiles/${seg(args.profile_id)}/sessions`, body)));
3844
+ }
3845
+ case "close_profile": {
3846
+ const r = await apiDelete(`/v1/profiles/${seg(args.profile_id)}/sessions`);
3847
+ return ok2({
3848
+ closed: args.profile_id,
3849
+ closed_sessions: r?.closed_sessions ?? [],
3850
+ ...r?.closed_sessions?.length === 0 ? { note: "nothing was open" } : {}
3851
+ });
3852
+ }
3853
+ case "update_profile": {
3854
+ const body = {};
3855
+ if (typeof args.name === "string") body.name = args.name;
3856
+ if (typeof args.notes === "string") body.notes = args.notes;
3857
+ if (!Object.keys(body).length) return fail2("send name, notes or both");
3858
+ return ok2(profileView(await apiPatch(`/v1/profiles/${seg(args.profile_id)}`, body)));
3859
+ }
3860
+ case "delete_profile":
3861
+ await apiDelete(`/v1/profiles/${seg(args.profile_id)}`);
3862
+ return ok2({ deleted: args.profile_id });
3863
+ case "profile_runs": {
3864
+ const lim = Number(args.limit) > 0 ? `?limit=${Math.floor(Number(args.limit))}` : "";
3865
+ const r = await apiGet(`/v1/profiles/${seg(args.profile_id)}/sessions${lim}`);
3866
+ return ok2({ sessions: r?.sessions ?? [], total: r?.total ?? (r?.sessions ?? []).length });
3867
+ }
3868
+ default:
3869
+ return fail2(`unknown tool: ${name}`);
3870
+ }
3871
+ } catch (e) {
3872
+ if (e instanceof BrowsaError3) return fail2(e.message, { code: e.code, status: e.status, request_id: e.requestId });
3873
+ return fail2(e.message || String(e));
3874
+ }
3875
+ }
3876
+
3666
3877
  // src/prompts.ts
3667
3878
  var PROMPTS = [
3668
3879
  {
@@ -3760,7 +3971,8 @@ for (const w of FLAG ? [] : extras.unknown) {
3760
3971
  var tools = [
3761
3972
  ...coreTools.filter((t) => extras.core.has(t.name)),
3762
3973
  ...captchaPageTools.filter((t) => extras.tools.has(t.name)),
3763
- ...legacyTools.filter((t) => extras.tools.has(t.name))
3974
+ ...legacyTools.filter((t) => extras.tools.has(t.name)),
3975
+ ...profileTools.filter((t) => extras.tools.has(t.name))
3764
3976
  ].map((t) => annotate2(t));
3765
3977
  var listed = new Set(tools.map((t) => t.name));
3766
3978
  setReportToolListed(listed.has("report_captcha_result"));
@@ -3798,6 +4010,11 @@ next: take "-core" out of BROWSA_MCP_TOOLS in this server's env and restart it`
3798
4010
  content.push({ type: "text", text: clean(r2.text) });
3799
4011
  return { ...r2.isError ? { isError: true } : {}, content };
3800
4012
  }
4013
+ if (PROFILE_TOOLS.includes(name)) {
4014
+ const r2 = await callProfiles(name, args);
4015
+ for (const c of r2.content ?? []) if (c.type === "text") c.text = clean(c.text);
4016
+ return r2;
4017
+ }
3801
4018
  const r = await callLegacy(name, args);
3802
4019
  for (const c of r.content ?? []) if (c.type === "text") c.text = clean(c.text);
3803
4020
  return r;
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "manifest_version": "0.2",
3
3
  "name": "browsa",
4
4
  "display_name": "Browsa",
5
- "version": "0.10.0",
5
+ "version": "0.11.0",
6
6
  "description": "Cloud browsers for AI agents, and captcha solving for a browser of your own.",
7
7
  "long_description": "Browsa gives a model a real cloud browser (Phantom): it reads the page as compact text, acts with real input, types saved secrets it never sees, hands over to a person when a check needs one, and replays what it did with no model calls. For agents that drive their own browser, the captcha tools find the captcha in a page's HTML locally and return a solution with the step to apply it in that browser.",
8
8
  "author": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsa/mcp",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "mcpName": "io.browsa/browsa",
5
5
  "description": "MCP server for Browsa: real cloud browsers (Phantom) for Claude, Cursor, VS Code and any MCP client, and captcha solving for a browser of your own",
6
6
  "license": "MIT",