@browsa/mcp 0.10.1 → 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 +29 -11
- package/dist/server.js +203 -8
- package/manifest.json +1 -1
- package/package.json +1 -1
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
|
|
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`: [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,49 @@ 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 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
|
+
|
|
226
243
|
### What the tool list costs
|
|
227
244
|
|
|
228
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.
|
|
229
246
|
|
|
230
247
|
| Tools listed | `BROWSA_MCP_TOOLS` | Tools | Tokens (chars / 4) |
|
|
231
248
|
|---|---|---|---|
|
|
232
|
-
| default | (unset) | 10 | 1,
|
|
249
|
+
| default | (unset) | 10 | 1,903 |
|
|
233
250
|
| the captcha tools for your own browser | `captcha_page,-core` | 3 | 603 |
|
|
234
251
|
| the captcha API tools | `captcha,-core` | 3 | 765 |
|
|
235
|
-
| `tasks` | `tasks,-core` | 5 | 1,
|
|
252
|
+
| `tasks` | `tasks,-core` | 5 | 1,598 |
|
|
236
253
|
| `robots` | `robots,-core` | 3 | 496 |
|
|
237
254
|
| `schedules` | `schedules,-core` | 2 | 505 |
|
|
238
255
|
| `webhooks` | `webhooks,-core` | 3 | 281 |
|
|
239
|
-
| `cdp` | `cdp,-core` | 2 |
|
|
240
|
-
| `
|
|
241
|
-
|
|
|
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 |
|
|
242
260
|
|
|
243
|
-
A group adds its row to the default's 1,
|
|
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).
|
|
244
262
|
|
|
245
263
|
### Annotations
|
|
246
264
|
|
|
247
265
|
| Hint | Tools |
|
|
248
266
|
|---|---|
|
|
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` |
|
|
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` |
|
|
252
270
|
|
|
253
271
|
`detect_captcha` and `captcha_allowance` also say `openWorldHint: false`: they run inside the server process and make no request.
|
|
254
272
|
|
|
@@ -340,7 +358,7 @@ Nothing to change. The default tool list is the same nine tools, and every exist
|
|
|
340
358
|
- **To keep every 0.5 tool**, set `BROWSA_MCP_TOOLS=all`. Nothing else changes for them: same names, same arguments, same JSON answers.
|
|
341
359
|
- `start_browser` and `stop_browser` move to the `cdp` group. Use `open` and `close` instead: `open` also navigates and returns the first view.
|
|
342
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.
|
|
343
|
-
- `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and
|
|
361
|
+
- `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and profiles in `admin`.
|
|
344
362
|
- The task tools still read `BROWSA_LLM`, `BROWSA_LLM_KEY_ID` and `BROWSA_LLM_API_KEY`.
|
|
345
363
|
|
|
346
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.
|
|
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
|
|
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
|
|
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
|
|
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",
|
|
@@ -2955,7 +2971,7 @@ var legacyTools = [
|
|
|
2955
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.' },
|
|
2956
2972
|
profile_id: {
|
|
2957
2973
|
type: "string",
|
|
2958
|
-
description: "Reuse a saved
|
|
2974
|
+
description: "Reuse a saved profile (see list_identities) so the browser starts with its cookies and logins."
|
|
2959
2975
|
},
|
|
2960
2976
|
proxy: {
|
|
2961
2977
|
type: "object",
|
|
@@ -2990,7 +3006,7 @@ var legacyTools = [
|
|
|
2990
3006
|
},
|
|
2991
3007
|
{
|
|
2992
3008
|
name: "list_browsers",
|
|
2993
|
-
description: "List this workspace's browsers (burners and saved
|
|
3009
|
+
description: "List this workspace's browsers (burners and saved profiles) with their status.",
|
|
2994
3010
|
inputSchema: { type: "object", properties: {} }
|
|
2995
3011
|
},
|
|
2996
3012
|
{
|
|
@@ -3030,7 +3046,7 @@ var legacyTools = [
|
|
|
3030
3046
|
},
|
|
3031
3047
|
{
|
|
3032
3048
|
name: "list_identities",
|
|
3033
|
-
description: "
|
|
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.",
|
|
3034
3050
|
inputSchema: { type: "object", properties: {} }
|
|
3035
3051
|
},
|
|
3036
3052
|
{
|
|
@@ -3685,6 +3701,179 @@ function keptBrowserFields(raw) {
|
|
|
3685
3701
|
};
|
|
3686
3702
|
}
|
|
3687
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
|
+
|
|
3688
3877
|
// src/prompts.ts
|
|
3689
3878
|
var PROMPTS = [
|
|
3690
3879
|
{
|
|
@@ -3782,7 +3971,8 @@ for (const w of FLAG ? [] : extras.unknown) {
|
|
|
3782
3971
|
var tools = [
|
|
3783
3972
|
...coreTools.filter((t) => extras.core.has(t.name)),
|
|
3784
3973
|
...captchaPageTools.filter((t) => extras.tools.has(t.name)),
|
|
3785
|
-
...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))
|
|
3786
3976
|
].map((t) => annotate2(t));
|
|
3787
3977
|
var listed = new Set(tools.map((t) => t.name));
|
|
3788
3978
|
setReportToolListed(listed.has("report_captcha_result"));
|
|
@@ -3820,6 +4010,11 @@ next: take "-core" out of BROWSA_MCP_TOOLS in this server's env and restart it`
|
|
|
3820
4010
|
content.push({ type: "text", text: clean(r2.text) });
|
|
3821
4011
|
return { ...r2.isError ? { isError: true } : {}, content };
|
|
3822
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
|
+
}
|
|
3823
4018
|
const r = await callLegacy(name, args);
|
|
3824
4019
|
for (const c of r.content ?? []) if (c.type === "text") c.text = clean(c.text);
|
|
3825
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.
|
|
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.
|
|
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",
|