@browsa/mcp 0.8.2 → 0.8.3
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/dist/server.js +44 -9
- package/manifest.json +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -682,7 +682,8 @@ var catalogue_snapshot_default = {
|
|
|
682
682
|
import { BrowsaError } from "browsa";
|
|
683
683
|
|
|
684
684
|
// src/config.ts
|
|
685
|
-
var VERSION = "0.8.
|
|
685
|
+
var VERSION = "0.8.3";
|
|
686
|
+
var USER_AGENT = `browsa-mcp/${VERSION}`;
|
|
686
687
|
var API_KEY = process.env.BROWSA_API_KEY?.trim() || void 0;
|
|
687
688
|
var BASE_URL = (process.env.BROWSA_BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
688
689
|
var BASE_URL_SET = !!process.env.BROWSA_BASE_URL;
|
|
@@ -828,6 +829,7 @@ async function fetchRetry(url, init, opts) {
|
|
|
828
829
|
}
|
|
829
830
|
|
|
830
831
|
// src/captcha/client.ts
|
|
832
|
+
var CAPTCHA_UA = `${USER_AGENT} (captcha)`;
|
|
831
833
|
var CAPTCHA_URL = (process.env.BROWSA_CAPTCHA_URL || (BASE_URL_SET ? `${BASE_URL}/captcha-api` : "https://captcha.browsa.io")).replace(/\/+$/, "");
|
|
832
834
|
var POLL_MS = numEnv("BROWSA_CAPTCHA_POLL_MS", 3e3, 1);
|
|
833
835
|
var WAIT_S = 20;
|
|
@@ -835,9 +837,9 @@ var IDEMPOTENT = /* @__PURE__ */ new Set(["types", "errors", "health", "getTaskR
|
|
|
835
837
|
async function captchaCall(method, payload, opts = {}) {
|
|
836
838
|
const timeoutMs = opts.timeoutMs ?? 3e4;
|
|
837
839
|
const retries = opts.retries ?? RETRIES;
|
|
838
|
-
const init = () => payload === null ? { method: "GET", headers: { Accept: "application/json", "User-Agent":
|
|
840
|
+
const init = () => payload === null ? { method: "GET", headers: { Accept: "application/json", "User-Agent": CAPTCHA_UA }, signal: AbortSignal.timeout(timeoutMs) } : {
|
|
839
841
|
method: "POST",
|
|
840
|
-
headers: { "Content-Type": "application/json", Accept: "application/json", "User-Agent":
|
|
842
|
+
headers: { "Content-Type": "application/json", Accept: "application/json", "User-Agent": CAPTCHA_UA },
|
|
841
843
|
body: JSON.stringify({ clientKey: API_KEY, ...payload }),
|
|
842
844
|
signal: AbortSignal.timeout(timeoutMs)
|
|
843
845
|
};
|
|
@@ -1831,7 +1833,7 @@ function annotate2(tool) {
|
|
|
1831
1833
|
// src/api.ts
|
|
1832
1834
|
import { BrowsaError as BrowsaError3 } from "browsa";
|
|
1833
1835
|
function headers(json) {
|
|
1834
|
-
const h = { "X-API-Key": API_KEY ?? "", Accept: "application/json", "User-Agent":
|
|
1836
|
+
const h = { "X-API-Key": API_KEY ?? "", Accept: "application/json", "User-Agent": USER_AGENT };
|
|
1835
1837
|
if (json) h["Content-Type"] = "application/json";
|
|
1836
1838
|
return h;
|
|
1837
1839
|
}
|
|
@@ -2151,7 +2153,8 @@ var coreTools = [
|
|
|
2151
2153
|
country: { type: "string", description: "Exit country, e.g. us. Needs a proxy." },
|
|
2152
2154
|
profile: { type: "string", description: "Saved identity id: keeps its cookies and logins." },
|
|
2153
2155
|
proxy: { type: "object", description: "{network: datacenter|residential, country?} or your own {server, username?, password?}." },
|
|
2154
|
-
ttl: { type: "string", description: "e.g. 10m (default), 1h." }
|
|
2156
|
+
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." },
|
|
2157
|
+
idle_timeout: { type: "string", description: "Stop after this long with nothing connected, e.g. 10m; off = never." }
|
|
2155
2158
|
}
|
|
2156
2159
|
}
|
|
2157
2160
|
},
|
|
@@ -2374,12 +2377,15 @@ async function open(args) {
|
|
|
2374
2377
|
if (country) body.country = country;
|
|
2375
2378
|
if (args.profile) body.agent_id = args.profile;
|
|
2376
2379
|
if (args.proxy) body.proxy = args.proxy;
|
|
2380
|
+
if (args.idle_timeout) body.idle_timeout = args.idle_timeout;
|
|
2377
2381
|
const a = await apiPost("/v1/agents", body, 12e4);
|
|
2378
2382
|
const id = String(a.id);
|
|
2379
2383
|
const b = stateOf(id);
|
|
2380
2384
|
lastBrowser = id;
|
|
2381
2385
|
const egress = args.proxy?.network ? `Browsa ${args.proxy.network} proxy` : args.proxy ? "your proxy" : "Browsa's address";
|
|
2382
|
-
const
|
|
2386
|
+
const ends = a.until_stopped ? "runs until you close it" : `expires ${a.expires_at ?? "with its ttl"}`;
|
|
2387
|
+
const head = [`ok: browser ${id} is open (Phantom, cloud, ${egress}), ${ends}; close it when done`];
|
|
2388
|
+
for (const w of Array.isArray(a.warnings) ? a.warnings : []) if (/ttl|until/i.test(String(w))) head.push(`note: ${w}`);
|
|
2383
2389
|
if (a.live_url) head.push(`live view (single use, for a person): ${a.live_url}`);
|
|
2384
2390
|
if (!args.url) {
|
|
2385
2391
|
head.push("the page is blank; next: act with action navigate and a url");
|
|
@@ -2813,6 +2819,14 @@ var legacyTools = [
|
|
|
2813
2819
|
type: "boolean",
|
|
2814
2820
|
description: "Set false to stop the run from saving a login it creates as a workspace secret (on by default)."
|
|
2815
2821
|
},
|
|
2822
|
+
keep_open: {
|
|
2823
|
+
type: "string",
|
|
2824
|
+
description: 'Keep the browser open after the task: "15m", "1h", "4h", "8h", "24h", any duration, or "until_stopped"; "none" (the default here) closes it. The result\'s `browser` gives its agent_id, expires_at and live_url, so the user can take over, extend it (POST /v1/agents/{id}/extend) or send a follow-up task on it (POST /v1/sessions/{session_id}/messages). Billed per minute like any browser; over 1h and until_stopped need a workspace that has bought credits.'
|
|
2825
|
+
},
|
|
2826
|
+
idle_timeout: {
|
|
2827
|
+
type: "string",
|
|
2828
|
+
description: 'With keep_open: stop after this long with nothing connected, e.g. "10m"; "off" = never.'
|
|
2829
|
+
},
|
|
2816
2830
|
timeout_minutes: {
|
|
2817
2831
|
type: "integer",
|
|
2818
2832
|
description: "Max wall-clock minutes to wait before returning. Default 10.",
|
|
@@ -2866,7 +2880,8 @@ var legacyTools = [
|
|
|
2866
2880
|
inputSchema: {
|
|
2867
2881
|
type: "object",
|
|
2868
2882
|
properties: {
|
|
2869
|
-
ttl: { type: "string", description: 'How long to keep it, e.g. "5m" or "
|
|
2883
|
+
ttl: { type: "string", description: 'How long to keep it, e.g. "5m", "1h", "8h" (up to 24h) or "until_stopped". Default 10m. Over 1h needs purchased credits.' },
|
|
2884
|
+
idle_timeout: { type: "string", description: 'Stop after this long with nothing connected, e.g. "10m"; "off" = never.' },
|
|
2870
2885
|
country: { type: "string", description: 'ISO-2 country, e.g. "us". Takes effect only with a proxy.' },
|
|
2871
2886
|
os_type: { type: "string", description: 'Operating system the browser presents, e.g. "macos", "windows".' },
|
|
2872
2887
|
profile_id: {
|
|
@@ -3138,7 +3153,7 @@ function llmKeyError(e, choice) {
|
|
|
3138
3153
|
}
|
|
3139
3154
|
async function proxyNetwork() {
|
|
3140
3155
|
const resp = await fetch(`${BASE_URL}/v1/proxy-network`, {
|
|
3141
|
-
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent":
|
|
3156
|
+
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": USER_AGENT }
|
|
3142
3157
|
});
|
|
3143
3158
|
const body = await resp.json().catch(() => ({}));
|
|
3144
3159
|
if (resp.status === 404) return { enabled: false, tiers: [] };
|
|
@@ -3391,6 +3406,8 @@ async function callLegacy(name, args) {
|
|
|
3391
3406
|
// Sent as is (snake_case) and only when given.
|
|
3392
3407
|
secret_ids: Array.isArray(args.secret_ids) && args.secret_ids.length ? args.secret_ids : void 0,
|
|
3393
3408
|
save_secrets: typeof args.save_secrets === "boolean" ? args.save_secrets : void 0,
|
|
3409
|
+
keep_open: typeof args.keep_open === "string" && args.keep_open ? args.keep_open : void 0,
|
|
3410
|
+
idle_timeout: typeof args.idle_timeout === "string" && args.idle_timeout ? args.idle_timeout : void 0,
|
|
3394
3411
|
timeoutMs: (args.timeout_minutes ?? 10) * 6e4
|
|
3395
3412
|
})
|
|
3396
3413
|
);
|
|
@@ -3409,7 +3426,8 @@ async function callLegacy(name, args) {
|
|
|
3409
3426
|
...savedSecretFields(job),
|
|
3410
3427
|
final_result: job.finalResult,
|
|
3411
3428
|
error: job.errorMessage,
|
|
3412
|
-
error_code: job.errorCode
|
|
3429
|
+
error_code: job.errorCode,
|
|
3430
|
+
...keptBrowserFields(job.raw)
|
|
3413
3431
|
});
|
|
3414
3432
|
}
|
|
3415
3433
|
case "get_job": {
|
|
@@ -3440,6 +3458,7 @@ async function callLegacy(name, args) {
|
|
|
3440
3458
|
case "start_browser": {
|
|
3441
3459
|
const a = await client.createAgent({
|
|
3442
3460
|
ttl: args.ttl ?? "10m",
|
|
3461
|
+
idle_timeout: args.idle_timeout,
|
|
3443
3462
|
country: args.country ?? DEFAULT_COUNTRY2,
|
|
3444
3463
|
osType: args.os_type,
|
|
3445
3464
|
agent_id: args.profile_id,
|
|
@@ -3557,6 +3576,22 @@ async function callLegacy(name, args) {
|
|
|
3557
3576
|
return fail(e.message || String(e));
|
|
3558
3577
|
}
|
|
3559
3578
|
}
|
|
3579
|
+
function keptBrowserFields(raw) {
|
|
3580
|
+
const b = raw && typeof raw === "object" ? raw.browser : null;
|
|
3581
|
+
if (!b || typeof b !== "object" || !b.agent_id) return {};
|
|
3582
|
+
return {
|
|
3583
|
+
session_id: raw.session_id ?? b.session_id,
|
|
3584
|
+
browser: {
|
|
3585
|
+
agent_id: b.agent_id,
|
|
3586
|
+
status: b.status,
|
|
3587
|
+
expires_at: b.expires_at,
|
|
3588
|
+
until_stopped: b.until_stopped,
|
|
3589
|
+
live_url: b.live_url,
|
|
3590
|
+
extend_url: b.extend_url,
|
|
3591
|
+
messages_url: b.messages_url
|
|
3592
|
+
}
|
|
3593
|
+
};
|
|
3594
|
+
}
|
|
3560
3595
|
|
|
3561
3596
|
// src/prompts.ts
|
|
3562
3597
|
var PROMPTS = [
|
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.8.
|
|
5
|
+
"version": "0.8.3",
|
|
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.8.
|
|
3
|
+
"version": "0.8.3",
|
|
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",
|