@browsa/mcp 0.8.0 → 0.8.1
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 +34 -15
- package/dist/server.js +122 -14
- package/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
**Captcha solving for a browser of your own.** An agent that already drives its own browser keeps it: `detect_captcha` finds the captcha in the page's HTML on your machine, `solve_captcha_on_page` returns the solution with the step to apply it in that browser. See [Captchas in your own browser](#captchas-in-your-own-browser).
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/@browsa/mcp)
|
|
13
|
+
[](https://github.com/browsa-io/browsa/actions/workflows/ci.yml)
|
|
13
14
|
|
|
14
|
-
You need a Browsa API key: [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys)
|
|
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
16
|
|
|
16
17
|
## Install
|
|
17
18
|
|
|
@@ -105,7 +106,7 @@ Command `npx -y @browsa/mcp`, environment `BROWSA_API_KEY`. Transport: stdio. Re
|
|
|
105
106
|
|
|
106
107
|
### Only the captcha tools, next to a browser of your own
|
|
107
108
|
|
|
108
|
-
Three tools instead of nine, about
|
|
109
|
+
Three tools instead of nine, about 600 tokens of tool definitions, and a spend cap for the session:
|
|
109
110
|
|
|
110
111
|
```json
|
|
111
112
|
{
|
|
@@ -131,7 +132,7 @@ Then ask: *"Open books.toscrape.com and list the first five titles with their pr
|
|
|
131
132
|
|
|
132
133
|
## Tools
|
|
133
134
|
|
|
134
|
-
Nine tools are on by default. Their
|
|
135
|
+
Nine tools are on by default. Their definitions are about 1.45k tokens in total. Every tool carries MCP annotations (a title, `readOnlyHint`, `destructiveHint`), so a client can tell a read from an action before it asks you: see [Annotations](#annotations).
|
|
135
136
|
|
|
136
137
|
| Tool | What it does |
|
|
137
138
|
|---|---|
|
|
@@ -225,18 +226,32 @@ The tool definitions a client loads before the first message, per setting. Token
|
|
|
225
226
|
|
|
226
227
|
| Tools listed | `BROWSA_MCP_TOOLS` | Tools | Tokens (chars / 4) |
|
|
227
228
|
|---|---|---|---|
|
|
228
|
-
| default | (unset) | 9 | 1,
|
|
229
|
-
| the captcha tools for your own browser | `captcha_page,-core` | 3 |
|
|
230
|
-
| the captcha API tools | `captcha,-core` | 3 |
|
|
231
|
-
| `tasks` | `tasks,-core` | 5 | 1,
|
|
232
|
-
| `robots` | `robots,-core` | 3 |
|
|
233
|
-
| `schedules` | `schedules,-core` | 2 |
|
|
234
|
-
| `webhooks` | `webhooks,-core` | 3 |
|
|
235
|
-
| `cdp` | `cdp,-core` | 2 |
|
|
236
|
-
| `admin` | `admin,-core` | 6 |
|
|
237
|
-
| everything | `all` | 36 |
|
|
238
|
-
|
|
239
|
-
A group adds its row to the default's 1,
|
|
229
|
+
| default | (unset) | 9 | 1,450 |
|
|
230
|
+
| the captcha tools for your own browser | `captcha_page,-core` | 3 | 603 |
|
|
231
|
+
| the captcha API tools | `captcha,-core` | 3 | 765 |
|
|
232
|
+
| `tasks` | `tasks,-core` | 5 | 1,410 |
|
|
233
|
+
| `robots` | `robots,-core` | 3 | 496 |
|
|
234
|
+
| `schedules` | `schedules,-core` | 2 | 505 |
|
|
235
|
+
| `webhooks` | `webhooks,-core` | 3 | 281 |
|
|
236
|
+
| `cdp` | `cdp,-core` | 2 | 691 |
|
|
237
|
+
| `admin` | `admin,-core` | 6 | 575 |
|
|
238
|
+
| everything | `all` | 36 | 6,770 |
|
|
239
|
+
|
|
240
|
+
A group adds its row to the default's 1,450. 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).
|
|
241
|
+
|
|
242
|
+
### Annotations
|
|
243
|
+
|
|
244
|
+
| Hint | Tools |
|
|
245
|
+
|---|---|
|
|
246
|
+
| 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` |
|
|
247
|
+
| 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` |
|
|
248
|
+
| Writes, not destructive | `open`, `handoff`, `respond_to_job`, `create_schedule`, `create_webhook`, `start_browser`, `solve_captcha_task`, `solve_captcha_on_page`, `report_captcha_result` |
|
|
249
|
+
|
|
250
|
+
`detect_captcha` and `captcha_allowance` also say `openWorldHint: false`: they run inside the server process and make no request.
|
|
251
|
+
|
|
252
|
+
### Command line
|
|
253
|
+
|
|
254
|
+
`npx -y @browsa/mcp --help` prints the options and the environment variables, `--version` the version. Both exit at once and need no key; neither starts the server.
|
|
240
255
|
|
|
241
256
|
## Captchas in your own browser
|
|
242
257
|
|
|
@@ -303,6 +318,10 @@ Built-in prompts, listed only when their tools are on: **solve_captcha_on_my_pag
|
|
|
303
318
|
|
|
304
319
|
The full table is in [SECURITY.md](./SECURITY.md).
|
|
305
320
|
|
|
321
|
+
## Upgrading from 0.8.0
|
|
322
|
+
|
|
323
|
+
Nothing to change. 0.8.1 adds annotations on every tool, the server's `instructions`, and the `--help` and `--version` flags. Tool names, arguments and answers are the same.
|
|
324
|
+
|
|
306
325
|
## Upgrading from 0.7
|
|
307
326
|
|
|
308
327
|
Nothing to change. The default tool list is the same nine tools, and every existing tool keeps its name, arguments and answers. New in 0.8: the `captcha_page` group, the three captcha limits, `-name` in `BROWSA_MCP_TOOLS`, prompts, retries on `429` and gateway errors, and `list_captcha_types` and `detect_captcha` working without a key.
|
package/dist/server.js
CHANGED
|
@@ -469,13 +469,54 @@ var catalogue_snapshot_default = {
|
|
|
469
469
|
import { BrowsaError } from "browsa";
|
|
470
470
|
|
|
471
471
|
// src/config.ts
|
|
472
|
-
var VERSION = "0.8.
|
|
472
|
+
var VERSION = "0.8.1";
|
|
473
473
|
var API_KEY = process.env.BROWSA_API_KEY?.trim() || void 0;
|
|
474
474
|
var BASE_URL = (process.env.BROWSA_BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
475
475
|
var BASE_URL_SET = !!process.env.BROWSA_BASE_URL;
|
|
476
476
|
var DEFAULT_COUNTRY = process.env.BROWSA_COUNTRY || void 0;
|
|
477
477
|
var KEYS_URL = "https://app.browsa.io/dashboard/keys";
|
|
478
|
-
var NO_KEY_MESSAGE = "BROWSA_API_KEY is not set.
|
|
478
|
+
var NO_KEY_MESSAGE = "BROWSA_API_KEY is not set. Create a key at " + KEYS_URL + ", add it to this MCP server's env, then restart the server.";
|
|
479
|
+
function cliFlag(argv = process.argv.slice(2)) {
|
|
480
|
+
if (argv.includes("--help") || argv.includes("-h")) return "help";
|
|
481
|
+
if (argv.includes("--version") || argv.includes("-v") || argv.includes("-V")) return "version";
|
|
482
|
+
return void 0;
|
|
483
|
+
}
|
|
484
|
+
var HELP = `browsa-mcp ${VERSION}: MCP server for Browsa (stdio)
|
|
485
|
+
|
|
486
|
+
Cloud browsers (Phantom) for an MCP client, and captcha solving for a browser of your own.
|
|
487
|
+
An MCP client starts this command; it speaks MCP on stdin and stdout.
|
|
488
|
+
|
|
489
|
+
Usage:
|
|
490
|
+
npx -y @browsa/mcp [--tools=<groups>]
|
|
491
|
+
npx -y @browsa/mcp --help | --version
|
|
492
|
+
|
|
493
|
+
Options:
|
|
494
|
+
--tools=<groups> Optional tool groups, comma separated (same as BROWSA_MCP_TOOLS):
|
|
495
|
+
tasks, robots, schedules, webhooks, cdp, captcha, captcha_page, admin, or all.
|
|
496
|
+
-name takes a group or a tool off; -core takes the nine core tools off.
|
|
497
|
+
-h, --help Print this and exit
|
|
498
|
+
-v, --version Print the version and exit
|
|
499
|
+
|
|
500
|
+
Environment:
|
|
501
|
+
BROWSA_API_KEY Your Browsa API key. Create a key at ${KEYS_URL}
|
|
502
|
+
Without it the tools are listed; detect_captcha, captcha_allowance
|
|
503
|
+
and list_captcha_types still answer.
|
|
504
|
+
BROWSA_MCP_TOOLS Optional tool groups, as --tools
|
|
505
|
+
BROWSA_BASE_URL Default https://browsa.io
|
|
506
|
+
BROWSA_COUNTRY Default exit country for open
|
|
507
|
+
BROWSA_LLM, BROWSA_LLM_KEY_ID, BROWSA_LLM_API_KEY Model settings for the tasks group
|
|
508
|
+
BROWSA_CAPTCHA_URL Default https://captcha.browsa.io
|
|
509
|
+
BROWSA_CAPTCHA_MAX_CREDITS, BROWSA_CAPTCHA_RATE_PER_MINUTE, BROWSA_CAPTCHA_CONCURRENCY
|
|
510
|
+
Local limits for captcha solves (off unless set)
|
|
511
|
+
BROWSA_MCP_RETRIES Default 2; 0 for none
|
|
512
|
+
BROWSA_MCP_REDACT=off Show URL tokens (debugging only)
|
|
513
|
+
|
|
514
|
+
Core tools (on by default): open, observe, act, read, screenshot, secrets, handoff, flow, close
|
|
515
|
+
|
|
516
|
+
Docs: https://browsa.io/guides/mcp-server
|
|
517
|
+
Source: https://github.com/browsa-io/browsa/tree/main/browsa-mcp
|
|
518
|
+
`;
|
|
519
|
+
var INSTRUCTIONS = "Browsa gives you a real cloud browser (Phantom) and, for a browser of your own, captcha solving. Browser tools: open a page, observe it as text (one line per element with an id), act on an id, read a container, and close the browser when done; a browser left open keeps running until its ttl. act answers with a status on its first line and, when something stopped, a `next:` line: follow it. Type saved secrets with act secret (their values never reach you); call handoff when a person has to step in. Opening a browser, tasks, robots and captcha solves spend the workspace's credits; reads and lists are free. Tools that are not listed are in optional groups: the error names the BROWSA_MCP_TOOLS setting that turns one on. Without BROWSA_API_KEY only detect_captcha, captcha_allowance and list_captcha_types answer.";
|
|
479
520
|
var REDACT = !/^(0|off|false|no)$/i.test(process.env.BROWSA_MCP_REDACT ?? "");
|
|
480
521
|
var GROUPS = {
|
|
481
522
|
tasks: ["run_task", "get_job", "cancel_job", "respond_to_job", "list_job_files"],
|
|
@@ -1517,6 +1558,63 @@ async function callCaptchaPage(name, args) {
|
|
|
1517
1558
|
}
|
|
1518
1559
|
}
|
|
1519
1560
|
|
|
1561
|
+
// src/annotations.ts
|
|
1562
|
+
var read = (title, extra = {}) => ({ title, readOnlyHint: true, destructiveHint: false, ...extra });
|
|
1563
|
+
var write = (title, extra = {}) => ({ title, readOnlyHint: false, destructiveHint: false, ...extra });
|
|
1564
|
+
var destructive = (title, extra = {}) => ({ title, readOnlyHint: false, destructiveHint: true, ...extra });
|
|
1565
|
+
var ANNOTATIONS = {
|
|
1566
|
+
// core
|
|
1567
|
+
open: write("Open a browser"),
|
|
1568
|
+
observe: read("Read the page as text"),
|
|
1569
|
+
act: destructive("Act on the page"),
|
|
1570
|
+
read: read("Read a container"),
|
|
1571
|
+
screenshot: read("Take a screenshot"),
|
|
1572
|
+
secrets: read("List saved secrets"),
|
|
1573
|
+
handoff: write("Hand over to a person"),
|
|
1574
|
+
flow: destructive("Record or replay a flow"),
|
|
1575
|
+
close: destructive("Close the browser", { idempotentHint: true }),
|
|
1576
|
+
// tasks
|
|
1577
|
+
run_task: destructive("Run an agent task"),
|
|
1578
|
+
get_job: read("Get a job"),
|
|
1579
|
+
cancel_job: destructive("Cancel a job", { idempotentHint: true }),
|
|
1580
|
+
respond_to_job: write("Answer a job's question"),
|
|
1581
|
+
list_job_files: read("List a job's files"),
|
|
1582
|
+
// robots
|
|
1583
|
+
list_robots: read("List robots"),
|
|
1584
|
+
run_robot: destructive("Run a robot"),
|
|
1585
|
+
get_robot_run: read("Get a robot run"),
|
|
1586
|
+
// schedules
|
|
1587
|
+
create_schedule: write("Create a schedule"),
|
|
1588
|
+
list_schedules: read("List schedules"),
|
|
1589
|
+
// webhooks
|
|
1590
|
+
list_webhooks: read("List webhooks"),
|
|
1591
|
+
create_webhook: write("Create a webhook"),
|
|
1592
|
+
delete_webhook: destructive("Delete a webhook", { idempotentHint: true }),
|
|
1593
|
+
// cdp
|
|
1594
|
+
start_browser: write("Start a browser for CDP"),
|
|
1595
|
+
stop_browser: destructive("Stop a browser", { idempotentHint: true }),
|
|
1596
|
+
// captcha
|
|
1597
|
+
solve_captcha_task: write("Solve a captcha task"),
|
|
1598
|
+
list_captcha_types: read("List captcha types"),
|
|
1599
|
+
report_captcha_result: write("Report a captcha result"),
|
|
1600
|
+
// captcha_page
|
|
1601
|
+
detect_captcha: read("Find the captcha in a page", { idempotentHint: true, openWorldHint: false }),
|
|
1602
|
+
solve_captcha_on_page: write("Solve a captcha for your browser"),
|
|
1603
|
+
captcha_allowance: read("Captcha allowance left", { openWorldHint: false }),
|
|
1604
|
+
// admin
|
|
1605
|
+
credits: read("Credit balance"),
|
|
1606
|
+
list_browsers: read("List browsers"),
|
|
1607
|
+
list_identities: read("List identities"),
|
|
1608
|
+
proxy_network: read("Proxy network"),
|
|
1609
|
+
list_llm_keys: read("List saved LLM keys"),
|
|
1610
|
+
list_models: read("List models")
|
|
1611
|
+
};
|
|
1612
|
+
function annotate2(tool) {
|
|
1613
|
+
const a = ANNOTATIONS[tool.name];
|
|
1614
|
+
if (!a) throw new Error(`tool ${tool.name} has no annotations (src/annotations.ts)`);
|
|
1615
|
+
return { ...tool, annotations: a };
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1520
1618
|
// src/api.ts
|
|
1521
1619
|
import { BrowsaError as BrowsaError3 } from "browsa";
|
|
1522
1620
|
function headers(json) {
|
|
@@ -1995,7 +2093,7 @@ next: ${s}`;
|
|
|
1995
2093
|
case code === "STALE":
|
|
1996
2094
|
return next("the page changed; call observe and use the new ids");
|
|
1997
2095
|
case (e.status === 401 || code === "INVALID_API_KEY" || code === "MISSING_API_KEY"):
|
|
1998
|
-
return next(`BROWSA_API_KEY was refused;
|
|
2096
|
+
return next(`BROWSA_API_KEY was refused; create a key at ${KEYS_URL} and restart the server`);
|
|
1999
2097
|
case (e.status === 402 || /CREDIT/.test(code)):
|
|
2000
2098
|
return next("not enough credits; top up at https://app.browsa.io/dashboard/billing");
|
|
2001
2099
|
case e.status === 429:
|
|
@@ -2178,7 +2276,7 @@ flow: ${n}`;
|
|
|
2178
2276
|
function tsv(cells) {
|
|
2179
2277
|
return cells.map((c) => String(c ?? "").replace(/[\t\r\n]+/g, " ")).join(" ");
|
|
2180
2278
|
}
|
|
2181
|
-
async function
|
|
2279
|
+
async function read2(args) {
|
|
2182
2280
|
const b = browserOf(args);
|
|
2183
2281
|
const id = Math.floor(Number(args.id));
|
|
2184
2282
|
if (!id) throw new ToolError("error: id is required\nnext: an id of a container from observe");
|
|
@@ -2421,7 +2519,7 @@ async function callCore(name, args) {
|
|
|
2421
2519
|
case "act":
|
|
2422
2520
|
return { text: await act(args) };
|
|
2423
2521
|
case "read":
|
|
2424
|
-
return { text: await
|
|
2522
|
+
return { text: await read2(args) };
|
|
2425
2523
|
case "screenshot":
|
|
2426
2524
|
return await screenshot(args);
|
|
2427
2525
|
case "secrets":
|
|
@@ -3332,22 +3430,26 @@ function redactUrls(text) {
|
|
|
3332
3430
|
}
|
|
3333
3431
|
|
|
3334
3432
|
// src/server.ts
|
|
3335
|
-
|
|
3433
|
+
var FLAG = cliFlag();
|
|
3434
|
+
if (!FLAG && !API_KEY) {
|
|
3336
3435
|
console.error("[browsa-mcp] BROWSA_API_KEY is not set: tools are listed, but calls that reach Browsa will fail until it is.");
|
|
3337
|
-
console.error(`
|
|
3436
|
+
console.error(` Create a key at ${KEYS_URL}`);
|
|
3338
3437
|
}
|
|
3339
3438
|
var extras = enabledExtras();
|
|
3340
|
-
for (const w of extras.unknown) {
|
|
3439
|
+
for (const w of FLAG ? [] : extras.unknown) {
|
|
3341
3440
|
console.error(`[browsa-mcp] BROWSA_MCP_TOOLS: unknown group or tool "${w}" (groups: ${Object.keys(GROUPS).join(", ")}, all)`);
|
|
3342
3441
|
}
|
|
3343
3442
|
var tools = [
|
|
3344
3443
|
...coreTools.filter((t) => extras.core.has(t.name)),
|
|
3345
3444
|
...captchaPageTools.filter((t) => extras.tools.has(t.name)),
|
|
3346
3445
|
...legacyTools.filter((t) => extras.tools.has(t.name))
|
|
3347
|
-
];
|
|
3446
|
+
].map((t) => annotate2(t));
|
|
3348
3447
|
var listed = new Set(tools.map((t) => t.name));
|
|
3349
3448
|
setReportToolListed(listed.has("report_captcha_result"));
|
|
3350
|
-
var server = new Server(
|
|
3449
|
+
var server = new Server(
|
|
3450
|
+
{ name: "browsa", title: "Browsa", version: VERSION },
|
|
3451
|
+
{ capabilities: { tools: {}, prompts: {} }, instructions: INSTRUCTIONS }
|
|
3452
|
+
);
|
|
3351
3453
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
3352
3454
|
server.setRequestHandler(ListPromptsRequestSchema, async () => ({ prompts: listPrompts(listed) }));
|
|
3353
3455
|
server.setRequestHandler(GetPromptRequestSchema, async (req) => {
|
|
@@ -3388,7 +3490,13 @@ async function main() {
|
|
|
3388
3490
|
if (GROUPS.captcha_page.some((t) => listed.has(t))) void refreshCatalogue();
|
|
3389
3491
|
console.error(`[browsa-mcp] ${VERSION} ready (tools=${tools.length})`);
|
|
3390
3492
|
}
|
|
3391
|
-
|
|
3392
|
-
console.
|
|
3393
|
-
|
|
3394
|
-
|
|
3493
|
+
if (FLAG === "version") {
|
|
3494
|
+
console.log(VERSION);
|
|
3495
|
+
} else if (FLAG === "help") {
|
|
3496
|
+
console.log(HELP);
|
|
3497
|
+
} else {
|
|
3498
|
+
main().catch((e) => {
|
|
3499
|
+
console.error("[browsa-mcp] fatal:", e);
|
|
3500
|
+
process.exit(1);
|
|
3501
|
+
});
|
|
3502
|
+
}
|
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.1",
|
|
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.1",
|
|
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",
|