@browsa/mcp 0.10.1 → 0.12.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
@@ -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`. |
@@ -214,6 +214,7 @@ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma
214
214
  | `cdp` | `start_browser`, `stop_browser` (a CDP address, to drive the browser from your own code) |
215
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) |
216
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`, `clone_profile`, `bulk_profiles`: [saved profiles](#saved-profiles) |
217
218
  | `admin` | `credits`, `list_browsers`, `list_identities`, `proxy_network`, `list_llm_keys`, `list_models` |
218
219
  | `all` | every group |
219
220
 
@@ -223,32 +224,51 @@ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma
223
224
 
224
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.
225
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 nine 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`, `tags`, `favorite`, `exit_setting`, `status`, `open_session`. Filters: `tag`, `favorite`, `include_deleted`, `limit` |
234
+ | `create_profile` | Create one (`name`, `notes`, `tags`, `favorite`, `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`, `restart`); returns `cdp_http`, `cdp_url`, `live_url`. A browser on a saved profile is $0.10 an hour, billed per minute; unused time is refunded when it closes. If one is already open, that browser is returned and nothing is charged (`restart: true` opens a new one) |
236
+ | `close_profile` | Stop its open browser and save the cookies; the profile stays |
237
+ | `update_profile` | Set `name`, `notes`, `tags` (replaces the list), `favorite` or `location` (`{network, country}`, `{proxy_id}`, `{none: true}` or `{country}`; needs no open browser, applies from the next open); `""` clears name and notes |
238
+ | `clone_profile` | A new profile with the settings of another (`name`, `tags`; `proxy` or `proxy_id` only when the source's exit cannot be copied); new fingerprint, empty, charged like `create_profile` |
239
+ | `bulk_profiles` | `ids` (1 to 50) and `action`: `close`, `delete`, `tag`, `untag` (with `tags`), `favorite`, `unfavorite`; one result per id |
240
+ | `delete_profile` | Delete it for good, with its cookies |
241
+ | `profile_runs` | Its browser sessions, newest first, with `cost_usd` |
242
+
243
+ Errors keep the API's `code`: `SESSION_OPEN` (close the browser first), `EXIT_CHANGING` (retry in a few seconds), `PROXY_NOT_COPYABLE`, `NOT_A_SAVED_PROFILE`, `NO_OPEN_SESSION`. `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.
244
+
226
245
  ### What the tool list costs
227
246
 
228
247
  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.
229
248
 
230
249
  | Tools listed | `BROWSA_MCP_TOOLS` | Tools | Tokens (chars / 4) |
231
250
  |---|---|---|---|
232
- | default | (unset) | 10 | 1,863 |
251
+ | default | (unset) | 10 | 1,903 |
233
252
  | the captcha tools for your own browser | `captcha_page,-core` | 3 | 603 |
234
253
  | the captcha API tools | `captcha,-core` | 3 | 765 |
235
- | `tasks` | `tasks,-core` | 5 | 1,410 |
254
+ | `tasks` | `tasks,-core` | 5 | 1,598 |
236
255
  | `robots` | `robots,-core` | 3 | 496 |
237
256
  | `schedules` | `schedules,-core` | 2 | 505 |
238
257
  | `webhooks` | `webhooks,-core` | 3 | 281 |
239
- | `cdp` | `cdp,-core` | 2 | 691 |
240
- | `admin` | `admin,-core` | 6 | 575 |
241
- | everything | `all` | 37 | 7,396 |
258
+ | `cdp` | `cdp,-core` | 2 | 795 |
259
+ | `profiles` | `profiles,-core` | 9 | 2,264 |
260
+ | `admin` | `admin,-core` | 6 | 640 |
261
+ | everything | `all` | 46 | 9,843 |
242
262
 
243
- 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).
263
+ 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).
244
264
 
245
265
  ### Annotations
246
266
 
247
267
  | Hint | Tools |
248
268
  |---|---|
249
- | 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` |
250
- | 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` |
251
- | Writes, not destructive | `open`, `handoff`, `respond_to_job`, `create_schedule`, `create_webhook`, `start_browser`, `solve_captcha_task`, `solve_captcha_on_page`, `report_captcha_result` |
269
+ | 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` |
270
+ | 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`, `bulk_profiles`, `cancel_job`, `delete_webhook` |
271
+ | Writes, not destructive | `open`, `handoff`, `respond_to_job`, `create_schedule`, `create_webhook`, `start_browser`, `create_profile`, `open_profile`, `update_profile`, `clone_profile`, `solve_captcha_task`, `solve_captcha_on_page`, `report_captcha_result` |
252
272
 
253
273
  `detect_captcha` and `captcha_allowance` also say `openWorldHint: false`: they run inside the server process and make no request.
254
274
 
@@ -340,7 +360,7 @@ Nothing to change. The default tool list is the same nine tools, and every exist
340
360
  - **To keep every 0.5 tool**, set `BROWSA_MCP_TOOLS=all`. Nothing else changes for them: same names, same arguments, same JSON answers.
341
361
  - `start_browser` and `stop_browser` move to the `cdp` group. Use `open` and `close` instead: `open` also navigates and returns the first view.
342
362
  - `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.
343
- - `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and identities in `admin`.
363
+ - `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and profiles in `admin`.
344
364
  - The task tools still read `BROWSA_LLM`, `BROWSA_LLM_KEY_ID` and `BROWSA_LLM_API_KEY`.
345
365
 
346
366
  ## 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.1";
685
+ var VERSION = "0.12.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", "clone_profile", "bulk_profiles"],
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,16 @@ 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("Change a saved profile", { idempotentHint: true }),
1830
+ clone_profile: write("Clone a saved profile"),
1831
+ bulk_profiles: destructive("Act on several profiles"),
1832
+ delete_profile: destructive("Delete a saved profile", { idempotentHint: true }),
1833
+ profile_runs: read("A profile's sessions"),
1824
1834
  proxy_network: read("Proxy network"),
1825
1835
  list_llm_keys: read("List saved LLM keys"),
1826
1836
  list_models: read("List models")
@@ -1864,6 +1874,14 @@ async function apiPost(path, payload, timeoutMs = 9e4) {
1864
1874
  signal: AbortSignal.timeout(timeoutMs)
1865
1875
  }), { idempotent: false }));
1866
1876
  }
1877
+ async function apiPatch(path, payload, timeoutMs = 3e4) {
1878
+ return parse(await fetchRetry(`${BASE_URL}${path}`, () => ({
1879
+ method: "PATCH",
1880
+ headers: headers(true),
1881
+ body: JSON.stringify(payload ?? {}),
1882
+ signal: AbortSignal.timeout(timeoutMs)
1883
+ }), { idempotent: false }));
1884
+ }
1867
1885
  async function apiDelete(path, timeoutMs = 3e4) {
1868
1886
  return parse(await fetchRetry(
1869
1887
  `${BASE_URL}${path}`,
@@ -2154,7 +2172,7 @@ var coreTools = [
2154
2172
  url: { type: "string" },
2155
2173
  where: { type: "string", enum: ["cloud"] },
2156
2174
  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." },
2175
+ profile: { type: "string", description: "Saved profile id: keeps its cookies and logins." },
2158
2176
  proxy: { type: "object", description: "{network: datacenter|residential, country?} or your own {server, username?, password?}." },
2159
2177
  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
2178
  idle_timeout: { type: "string", description: "Stop after this long with nothing connected, e.g. 10m; off = never." }
@@ -2875,7 +2893,7 @@ var legacyTools = [
2875
2893
  },
2876
2894
  profile_id: {
2877
2895
  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."
2896
+ 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
2897
  },
2880
2898
  secret_ids: {
2881
2899
  type: "array",
@@ -2955,7 +2973,7 @@ var legacyTools = [
2955
2973
  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.' },
2956
2974
  profile_id: {
2957
2975
  type: "string",
2958
- description: "Reuse a saved identity (see list_identities) so the browser starts with its cookies and logins."
2976
+ description: "Reuse a saved profile (see list_identities) so the browser starts with its cookies and logins."
2959
2977
  },
2960
2978
  proxy: {
2961
2979
  type: "object",
@@ -2990,7 +3008,7 @@ var legacyTools = [
2990
3008
  },
2991
3009
  {
2992
3010
  name: "list_browsers",
2993
- description: "List this workspace's browsers (burners and saved identities) with their status.",
3011
+ description: "List this workspace's browsers (burners and saved profiles) with their status.",
2994
3012
  inputSchema: { type: "object", properties: {} }
2995
3013
  },
2996
3014
  {
@@ -3030,7 +3048,7 @@ var legacyTools = [
3030
3048
  },
3031
3049
  {
3032
3050
  name: "list_identities",
3033
- 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.",
3051
+ 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.",
3034
3052
  inputSchema: { type: "object", properties: {} }
3035
3053
  },
3036
3054
  {
@@ -3685,6 +3703,262 @@ function keptBrowserFields(raw) {
3685
3703
  };
3686
3704
  }
3687
3705
 
3706
+ // src/profiles.ts
3707
+ var ID = { type: "string", description: "The profile id (agt_..., from list_profiles or create_profile)." };
3708
+ var PROFILE_TOOLS = [
3709
+ "list_profiles",
3710
+ "create_profile",
3711
+ "open_profile",
3712
+ "close_profile",
3713
+ "update_profile",
3714
+ "delete_profile",
3715
+ "profile_runs",
3716
+ "clone_profile",
3717
+ "bulk_profiles"
3718
+ ];
3719
+ var TAGS = {
3720
+ type: "array",
3721
+ items: { type: "string" },
3722
+ maxItems: 10,
3723
+ description: "Tags: at most 10, each 1 to 24 characters, no commas."
3724
+ };
3725
+ var LOCATION = {
3726
+ type: "object",
3727
+ description: `Where the profile's next browser leaves from. One of: {"network": "datacenter" or "residential", "country": "de"} (Browsa's proxy network), {"proxy_id": "px_..."} (a saved proxy), {"none": true} (no proxy), or {"country": "de"} alone (a new country on the proxy network). Only while no browser is open on the profile (409 SESSION_OPEN otherwise: close_profile first); it applies from the next open_profile.`,
3728
+ properties: {
3729
+ network: { type: "string", enum: ["datacenter", "residential"] },
3730
+ country: { type: "string", description: 'ISO-2, e.g. "de".' },
3731
+ proxy_id: { type: "string" },
3732
+ none: { type: "boolean", description: "true: no proxy." }
3733
+ }
3734
+ };
3735
+ var profileTools = [
3736
+ {
3737
+ name: "list_profiles",
3738
+ description: "List saved profiles: browsers that keep cookies, logins and a fingerprint between sessions. Each row has id, name, notes, tags, favorite, exit_setting, 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.",
3739
+ inputSchema: {
3740
+ type: "object",
3741
+ properties: {
3742
+ include_deleted: { type: "boolean", description: "Also list deleted profiles. Default false." },
3743
+ limit: { type: "integer", description: "1 to 200. Default 50." },
3744
+ tag: { type: "string", description: "Only profiles carrying this tag." },
3745
+ favorite: { type: "boolean", description: "true: only favorites; false: only the others." }
3746
+ }
3747
+ }
3748
+ },
3749
+ {
3750
+ name: "create_profile",
3751
+ 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.",
3752
+ inputSchema: {
3753
+ type: "object",
3754
+ properties: {
3755
+ name: { type: "string", description: "A name for the profile, up to 80 characters." },
3756
+ notes: { type: "string", description: "Free text about it, up to 1500 characters." },
3757
+ tags: TAGS,
3758
+ favorite: { type: "boolean", description: "Star the profile." },
3759
+ country: { type: "string", description: 'ISO-2 country, e.g. "us". Takes effect only with a proxy.' },
3760
+ os_type: { type: "string", description: 'Operating system the browser presents, e.g. "linux", "macos", "windows".' },
3761
+ 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.' },
3762
+ proxy: {
3763
+ type: "object",
3764
+ 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.`
3765
+ }
3766
+ }
3767
+ }
3768
+ },
3769
+ {
3770
+ name: "open_profile",
3771
+ description: "Open a browser on a saved profile, with its cookies and logins. Billed per minute; unused time is refunded when it closes. If a browser is already open on the profile, that browser is returned as it is and nothing is charged (restart: true closes it and opens a new one). Returns the browser's cdp_http (the address to connect a CDP client to), cdp_url and live_url. If the profile's location is being changed, it answers EXIT_CHANGING: retry in a few seconds. Call close_profile when you are done.",
3772
+ inputSchema: {
3773
+ type: "object",
3774
+ required: ["profile_id"],
3775
+ properties: {
3776
+ profile_id: ID,
3777
+ start_url: { type: "string", description: "The page the browser opens on." },
3778
+ ttl: { type: "string", description: 'How long to keep it, e.g. "30m", "8h" (up to 24h). Default 1h.' },
3779
+ idle_timeout: { type: "string", description: 'Stop after this long with nothing connected, e.g. "10m"; "off" = never.' },
3780
+ country: { type: "string", description: 'ISO-2 country, e.g. "us".' },
3781
+ restart: { type: "boolean", description: "Close the browser already open on the profile and open a new one (charged). Default false." }
3782
+ }
3783
+ }
3784
+ },
3785
+ {
3786
+ name: "close_profile",
3787
+ 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.",
3788
+ inputSchema: { type: "object", required: ["profile_id"], properties: { profile_id: ID } }
3789
+ },
3790
+ {
3791
+ name: "update_profile",
3792
+ description: "Change a saved profile: name, notes, tags (replaces the whole list; [] clears it), favorite, or location (where its next browser leaves from). A field you leave out stays as it is, and an empty string clears name or notes. Changing the location needs no open browser. Free.",
3793
+ inputSchema: {
3794
+ type: "object",
3795
+ required: ["profile_id"],
3796
+ properties: {
3797
+ profile_id: ID,
3798
+ name: { type: "string", description: "New name, up to 80 characters." },
3799
+ notes: { type: "string", description: "New notes, up to 1500 characters." },
3800
+ tags: TAGS,
3801
+ favorite: { type: "boolean", description: "Star or unstar the profile." },
3802
+ location: LOCATION
3803
+ }
3804
+ }
3805
+ },
3806
+ {
3807
+ name: "delete_profile",
3808
+ 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.",
3809
+ inputSchema: { type: "object", required: ["profile_id"], properties: { profile_id: ID } }
3810
+ },
3811
+ {
3812
+ name: "profile_runs",
3813
+ 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.",
3814
+ inputSchema: {
3815
+ type: "object",
3816
+ required: ["profile_id"],
3817
+ properties: { profile_id: ID, limit: { type: "integer", description: "1 to 200. Default 50." } }
3818
+ }
3819
+ },
3820
+ {
3821
+ name: "clone_profile",
3822
+ description: "Make a new saved profile with the settings of another (OS, browser, screen, country, proxy network and country, and its tags unless you send tags). It gets a new fingerprint and starts empty: no cookies, logins or notes. It opens its first browser and is charged like create_profile. A source on your own inline proxy cannot be copied (PROXY_NOT_COPYABLE): send proxy or proxy_id. Call close_profile when you are done with the browser.",
3823
+ inputSchema: {
3824
+ type: "object",
3825
+ required: ["profile_id"],
3826
+ properties: {
3827
+ profile_id: ID,
3828
+ name: { type: "string", description: `Name of the copy, up to 80 characters. Default: the source's name plus " (copy)".` },
3829
+ tags: TAGS,
3830
+ proxy: { type: "object", nullable: true, description: "Only for a source whose exit cannot be copied: the copy's proxy, as on create_profile; null for none." },
3831
+ proxy_id: { type: "string", description: "Only for a source whose exit cannot be copied: a saved proxy." }
3832
+ }
3833
+ }
3834
+ },
3835
+ {
3836
+ name: "bulk_profiles",
3837
+ description: "One action on 1 to 50 saved profiles: close (their open browsers), delete (for good), tag or untag (need tags), favorite or unfavorite. Each id is handled on its own; the answer has one result per id (ok, or an error code such as NOT_FOUND). There is no bulk open.",
3838
+ inputSchema: {
3839
+ type: "object",
3840
+ required: ["ids", "action"],
3841
+ properties: {
3842
+ ids: { type: "array", items: { type: "string" }, minItems: 1, maxItems: 50, description: "Profile ids." },
3843
+ action: { type: "string", enum: ["close", "delete", "tag", "untag", "favorite", "unfavorite"] },
3844
+ tags: TAGS
3845
+ }
3846
+ }
3847
+ }
3848
+ ];
3849
+ function ok2(payload) {
3850
+ return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
3851
+ }
3852
+ function fail2(message, extra) {
3853
+ return { isError: true, content: [{ type: "text", text: JSON.stringify(extra ? { error: message, ...extra } : { error: message }, null, 2) }] };
3854
+ }
3855
+ var seg = (id) => encodeURIComponent(String(id));
3856
+ function profileView(a) {
3857
+ return {
3858
+ profile_id: a.id,
3859
+ name: a.name ?? a.persona ?? "",
3860
+ notes: a.notes ?? "",
3861
+ ...a.tags != null ? { tags: a.tags } : {},
3862
+ ...a.favorite != null ? { favorite: a.favorite } : {},
3863
+ ...a.exit_setting != null ? { exit_setting: a.exit_setting } : {},
3864
+ status: a.status,
3865
+ open_session: a.open_session ?? null,
3866
+ created_at: a.created_at
3867
+ };
3868
+ }
3869
+ function browserView(a) {
3870
+ return {
3871
+ ...profileView(a),
3872
+ cdp_http: a.cdp_http,
3873
+ cdp_url: a.cdp_url,
3874
+ live_url: a.live_url,
3875
+ expires_at: a.expires_at,
3876
+ ...a.cost_credits != null ? { credits_charged: a.cost_credits } : {},
3877
+ ...typeof a.cost_usd === "string" ? { cost_usd: a.cost_usd } : {},
3878
+ note: "Call close_profile with this profile_id when you are done."
3879
+ };
3880
+ }
3881
+ async function callProfiles(name, args) {
3882
+ try {
3883
+ if (!["list_profiles", "create_profile", "bulk_profiles"].includes(name) && !args.profile_id) return fail2("profile_id is required");
3884
+ switch (name) {
3885
+ case "list_profiles": {
3886
+ const q = new URLSearchParams();
3887
+ if (Number(args.limit) > 0) q.set("limit", String(Math.floor(Number(args.limit))));
3888
+ if (args.include_deleted === true) q.set("include_deleted", "true");
3889
+ if (typeof args.tag === "string" && args.tag) q.set("tag", args.tag);
3890
+ if (typeof args.favorite === "boolean") q.set("favorite", String(args.favorite));
3891
+ const s = q.toString();
3892
+ const body = await apiGet(`/v1/profiles${s ? `?${s}` : ""}`);
3893
+ return ok2({ profiles: (body?.agents ?? []).map(profileView) });
3894
+ }
3895
+ case "create_profile": {
3896
+ const body = {};
3897
+ for (const k of ["name", "notes", "tags", "favorite", "country", "os_type", "captcha", "proxy"]) if (args[k] != null) body[k] = args[k];
3898
+ return ok2(browserView(await apiPost("/v1/profiles", body)));
3899
+ }
3900
+ case "open_profile": {
3901
+ const body = {};
3902
+ if (args.start_url != null) body.initial_url = args.start_url;
3903
+ for (const k of ["ttl", "idle_timeout", "country"]) if (args[k] != null) body[k] = args[k];
3904
+ if (args.restart === true) body.restart = true;
3905
+ return ok2(browserView(await apiPost(`/v1/profiles/${seg(args.profile_id)}/sessions`, body)));
3906
+ }
3907
+ case "close_profile": {
3908
+ const r = await apiDelete(`/v1/profiles/${seg(args.profile_id)}/sessions`);
3909
+ return ok2({
3910
+ closed: args.profile_id,
3911
+ closed_sessions: r?.closed_sessions ?? [],
3912
+ ...r?.closed_sessions?.length === 0 ? { note: "nothing was open" } : {}
3913
+ });
3914
+ }
3915
+ case "update_profile": {
3916
+ const body = {};
3917
+ if (typeof args.name === "string") body.name = args.name;
3918
+ if (typeof args.notes === "string") body.notes = args.notes;
3919
+ if (Array.isArray(args.tags)) body.tags = args.tags;
3920
+ if (typeof args.favorite === "boolean") body.favorite = args.favorite;
3921
+ const loc = args.location;
3922
+ if (loc && typeof loc === "object") {
3923
+ if (loc.none === true) body.proxy = null;
3924
+ else if (typeof loc.proxy_id === "string") body.proxy_id = loc.proxy_id;
3925
+ else if (typeof loc.network === "string") body.proxy = { network: loc.network, ...typeof loc.country === "string" ? { country: loc.country } : {} };
3926
+ else if (typeof loc.country === "string") body.country = loc.country;
3927
+ else return fail2("location needs network, proxy_id, none or country");
3928
+ }
3929
+ if (!Object.keys(body).length) return fail2("send name, notes, tags, favorite or location");
3930
+ return ok2(profileView(await apiPatch(`/v1/profiles/${seg(args.profile_id)}`, body)));
3931
+ }
3932
+ case "clone_profile": {
3933
+ const body = {};
3934
+ for (const k of ["name", "tags", "proxy", "proxy_id"]) if (args[k] !== void 0) body[k] = args[k];
3935
+ return ok2(browserView(await apiPost(`/v1/profiles/${seg(args.profile_id)}/clone`, body)));
3936
+ }
3937
+ case "bulk_profiles": {
3938
+ if (!Array.isArray(args.ids) || !args.ids.length) return fail2("ids is required (1 to 50 profile ids)");
3939
+ if (!args.action) return fail2("action is required");
3940
+ const body = { ids: args.ids, action: args.action };
3941
+ if (Array.isArray(args.tags)) body.tags = args.tags;
3942
+ const r = await apiPost("/v1/profiles/bulk", body);
3943
+ return ok2({ results: r?.results ?? [] });
3944
+ }
3945
+ case "delete_profile":
3946
+ await apiDelete(`/v1/profiles/${seg(args.profile_id)}`);
3947
+ return ok2({ deleted: args.profile_id });
3948
+ case "profile_runs": {
3949
+ const lim = Number(args.limit) > 0 ? `?limit=${Math.floor(Number(args.limit))}` : "";
3950
+ const r = await apiGet(`/v1/profiles/${seg(args.profile_id)}/sessions${lim}`);
3951
+ return ok2({ sessions: r?.sessions ?? [], total: r?.total ?? (r?.sessions ?? []).length });
3952
+ }
3953
+ default:
3954
+ return fail2(`unknown tool: ${name}`);
3955
+ }
3956
+ } catch (e) {
3957
+ if (e instanceof BrowsaError3) return fail2(e.message, { code: e.code, status: e.status, request_id: e.requestId });
3958
+ return fail2(e.message || String(e));
3959
+ }
3960
+ }
3961
+
3688
3962
  // src/prompts.ts
3689
3963
  var PROMPTS = [
3690
3964
  {
@@ -3782,7 +4056,8 @@ for (const w of FLAG ? [] : extras.unknown) {
3782
4056
  var tools = [
3783
4057
  ...coreTools.filter((t) => extras.core.has(t.name)),
3784
4058
  ...captchaPageTools.filter((t) => extras.tools.has(t.name)),
3785
- ...legacyTools.filter((t) => extras.tools.has(t.name))
4059
+ ...legacyTools.filter((t) => extras.tools.has(t.name)),
4060
+ ...profileTools.filter((t) => extras.tools.has(t.name))
3786
4061
  ].map((t) => annotate2(t));
3787
4062
  var listed = new Set(tools.map((t) => t.name));
3788
4063
  setReportToolListed(listed.has("report_captcha_result"));
@@ -3820,6 +4095,11 @@ next: take "-core" out of BROWSA_MCP_TOOLS in this server's env and restart it`
3820
4095
  content.push({ type: "text", text: clean(r2.text) });
3821
4096
  return { ...r2.isError ? { isError: true } : {}, content };
3822
4097
  }
4098
+ if (PROFILE_TOOLS.includes(name)) {
4099
+ const r2 = await callProfiles(name, args);
4100
+ for (const c of r2.content ?? []) if (c.type === "text") c.text = clean(c.text);
4101
+ return r2;
4102
+ }
3823
4103
  const r = await callLegacy(name, args);
3824
4104
  for (const c of r.content ?? []) if (c.type === "text") c.text = clean(c.text);
3825
4105
  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.1",
5
+ "version": "0.12.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.1",
3
+ "version": "0.12.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",