@browsa/mcp 0.7.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 CHANGED
@@ -7,9 +7,12 @@
7
7
 
8
8
  **Real cloud browsers for any MCP client.** Your model opens a Phantom browser (Browsa's own), 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.
9
9
 
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
+
10
12
  [![npm version](https://img.shields.io/npm/v/@browsa/mcp.svg)](https://www.npmjs.com/package/@browsa/mcp)
13
+ [![CI](https://github.com/browsa-io/browsa/actions/workflows/ci.yml/badge.svg)](https://github.com/browsa-io/browsa/actions/workflows/ci.yml)
11
14
 
12
- You need a Browsa API key: [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys). Replace `agt_live_...` below with it.
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.
13
16
 
14
17
  ## Install
15
18
 
@@ -58,15 +61,78 @@ code --add-mcp '{"name":"browsa","command":"npx","args":["-y","@browsa/mcp"],"en
58
61
 
59
62
  `~/.codeium/windsurf/mcp_config.json`, the same `mcpServers` block as Claude Desktop.
60
63
 
64
+ ### Cline, JetBrains AI Assistant, LM Studio, Gemini CLI
65
+
66
+ Each takes the same `mcpServers` block as Claude Desktop: Cline in `cline_mcp_settings.json` (MCP Servers, Configure), JetBrains under Settings, Tools, AI Assistant, Model Context Protocol, LM Studio in `mcp.json` (Program, Install, Edit mcp.json), Gemini CLI in `~/.gemini/settings.json`.
67
+
68
+ ### Codex CLI
69
+
70
+ `~/.codex/config.toml`:
71
+
72
+ ```toml
73
+ [mcp_servers.browsa]
74
+ command = "npx"
75
+ args = ["-y", "@browsa/mcp"]
76
+ env = { BROWSA_API_KEY = "agt_live_..." }
77
+ ```
78
+
79
+ ### Zed
80
+
81
+ `settings.json`:
82
+
83
+ ```json
84
+ {
85
+ "context_servers": {
86
+ "browsa": { "command": "npx", "args": ["-y", "@browsa/mcp"], "env": { "BROWSA_API_KEY": "agt_live_..." } }
87
+ }
88
+ }
89
+ ```
90
+
61
91
  ### Any other MCP client
62
92
 
63
- Command `npx -y @browsa/mcp`, environment `BROWSA_API_KEY`. Transport: stdio. Registry name: `io.browsa/browsa`.
93
+ Command `npx -y @browsa/mcp`, environment `BROWSA_API_KEY`. Transport: stdio. Registry name: `io.browsa/browsa`. The generic form most clients read:
94
+
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "browsa": {
99
+ "command": "npx",
100
+ "args": ["-y", "@browsa/mcp"],
101
+ "env": { "BROWSA_API_KEY": "agt_live_..." }
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### Only the captcha tools, next to a browser of your own
108
+
109
+ Three tools instead of nine, about 600 tokens of tool definitions, and a spend cap for the session:
110
+
111
+ ```json
112
+ {
113
+ "mcpServers": {
114
+ "browsa-captcha": {
115
+ "command": "npx",
116
+ "args": ["-y", "@browsa/mcp", "--tools=captcha_page,-core"],
117
+ "env": { "BROWSA_API_KEY": "agt_live_...", "BROWSA_CAPTCHA_MAX_CREDITS": "5" }
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ ```bash
124
+ claude mcp add browsa-captcha -e BROWSA_API_KEY=agt_live_... -e BROWSA_MCP_TOOLS=captcha_page,-core -e BROWSA_CAPTCHA_MAX_CREDITS=5 -- npx -y @browsa/mcp
125
+ ```
126
+
127
+ ### One-file bundle (MCPB)
128
+
129
+ `manifest.json` in this package is an [MCP Bundle](https://github.com/modelcontextprotocol/mcpb) manifest. `npm run bundle` stages a self-contained copy in `build/mcpb`, and `npx @anthropic-ai/mcpb pack build/mcpb build/browsa.mcpb` makes the file a desktop client installs with a double click; the key and the tool groups are asked for in its install form.
64
130
 
65
131
  Then ask: *"Open books.toscrape.com and list the first five titles with their prices."*
66
132
 
67
133
  ## Tools
68
134
 
69
- Nine tools are on by default. Their schemas are about 1.2k tokens in total.
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).
70
136
 
71
137
  | Tool | What it does |
72
138
  |---|---|
@@ -129,7 +195,7 @@ flow {op: "run", name: "book-search", params: {query: "travel"}}
129
195
  ### Privacy
130
196
 
131
197
  - Tokens in URLs (query and fragment parameters such as `token`, `key`, `session`, `code`, `signature`) are shown as `***` in every answer. `BROWSA_MCP_REDACT=off` turns this off for debugging.
132
- - The server writes no files. Screenshots and page text come back inline; state (open browsers, a flow being recorded) is kept in memory.
198
+ - 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.
133
199
  - Live links are single use and expire.
134
200
 
135
201
  ## More tools (optional groups)
@@ -143,7 +209,8 @@ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma
143
209
  | `schedules` | `create_schedule`, `list_schedules` |
144
210
  | `webhooks` | `list_webhooks`, `create_webhook`, `delete_webhook` |
145
211
  | `cdp` | `start_browser`, `stop_browser` (a CDP address, to drive the browser from your own code) |
146
- | `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; reports are recorded and used to improve solving) |
212
+ | `captcha_page` | `detect_captcha`, `solve_captcha_on_page`, `captcha_allowance`: captcha solving for a browser of your own, [below](#captchas-in-your-own-browser) |
213
+ | `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) |
147
214
  | `admin` | `credits`, `list_browsers`, `list_identities`, `proxy_network`, `list_llm_keys`, `list_models` |
148
215
  | `all` | every group |
149
216
 
@@ -151,7 +218,113 @@ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma
151
218
  "env": { "BROWSA_API_KEY": "agt_live_...", "BROWSA_MCP_TOOLS": "tasks,robots" }
152
219
  ```
153
220
 
154
- A tool name works too (`BROWSA_MCP_TOOLS=run_task,credits`). Calling a tool whose group is off answers with the setting that turns it on.
221
+ 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 nine browser 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.
222
+
223
+ ### What the tool list costs
224
+
225
+ 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.
226
+
227
+ | Tools listed | `BROWSA_MCP_TOOLS` | Tools | Tokens (chars / 4) |
228
+ |---|---|---|---|
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.
255
+
256
+ ## Captchas in your own browser
257
+
258
+ For an agent that drives a browser Browsa does not host. Turn the group on with `BROWSA_MCP_TOOLS=captcha_page` (add `,-core` to list nothing else). The server never touches your browser: it reads HTML you paste and returns what to run.
259
+
260
+ ```
261
+ detect_captcha {html, url, resources} local, free, no key, nothing sent
262
+ -> {found: 1, captchas: [{kind: "turnstile", type: "AntiTurnstileTaskProxyLess", status: "live",
263
+ solve_with: "solve_captcha_on_page", ready: true,
264
+ params: {websiteURL, websiteKey}, missing: [], credits_per_solve: 0.008, confidence: "high", evidence: [...]}]}
265
+
266
+ solve_captcha_on_page {captcha: <that entry>}
267
+ -> {task_id, type, solution: {token}, seconds: 6.5,
268
+ cost: {charged: true, amount: 0.008, unit: "credits"},
269
+ apply: {how: "evaluate", expression: "(() => { ... })()", steps: [...], valid_seconds: 300},
270
+ allowance: {spent_credits, ...}}
271
+
272
+ (your browser) evaluate apply.expression in the page, submit, read the page's answer
273
+ ```
274
+
275
+ **`detect_captcha`** takes the page's HTML (`document.documentElement.outerHTML`), its address, and optionally the URLs of its frames and scripts (`resources`): a rendered widget often keeps its site key only in its frame's address. For each captcha it gives the catalogue's task type name, the parameters found (site key, action, cdata, invisible, the page's callback), `status` from the type catalogue (`live`, `off`, or `not_in_catalogue`), `solve_with` (which tool takes it), `ready`, and `missing`: what could not be read from the HTML and where to find it. It reports a captcha only when its provider is really in the page (a widget with a site key, the provider's frame or script, or its start call); the word "captcha" in text, class names and code samples give nothing.
276
+
277
+ **`solve_captcha_on_page`** takes one entry from `detect_captcha` (or `{type, params}` you wrote, or `html` + `url` to detect first), runs the task through Browsa's captcha API and waits for it. What it can do:
278
+
279
+ - **Token types** (`kind: token` in the catalogue): the answer is a token, and `apply.expression` is JavaScript for the page's main frame that puts it in the field the widget keeps, calls the page's callback when the widget names one, and returns `{applied, fields, callback}`. For a v3 token there is no field: the expression makes the page's next `grecaptcha.execute()` answer it, then you do the page's own action.
280
+ - **Cookie types**: `apply.cookies` and `apply.user_agent`, with the instruction to set them and re-request the URL through the same proxy, and not to reload the challenge page. These need `proxy`.
281
+
282
+ What it cannot do: click, drag or type in your browser; solve picture puzzles (send the image to `solve_captcha_task` in the `captcha` group: the answer is text, tiles or a distance, and the input is yours to make); solve a type the catalogue lists as `off` or does not list. Each of these is refused before anything is sent, with `charged: false`. A solve is charged only when it succeeds; `cost` is in every answer. How often each type passes is measured and published per type: see the `measured` fields of `list_captcha_types` or <https://browsa.io/captcha>.
283
+
284
+ ### Limits you set
285
+
286
+ Off unless set. They are checked in this process before a request is made, and cover `solve_captcha_on_page` and `solve_captcha_task`.
287
+
288
+ | Var | Limit |
289
+ |---|---|
290
+ | `BROWSA_CAPTCHA_MAX_CREDITS` | Credits one session (one run of this server) may spend on solves. Running solves hold their price until they end. |
291
+ | `BROWSA_CAPTCHA_RATE_PER_MINUTE` | Solves started in any 60 seconds. |
292
+ | `BROWSA_CAPTCHA_CONCURRENCY` | Solves running at once. |
293
+
294
+ A refused call names the limit and says when to retry:
295
+
296
+ ```json
297
+ {"error": "refused by this server's local limit (rate): 2 solves started in the last minute and BROWSA_CAPTCHA_RATE_PER_MINUTE is 2",
298
+ "code": "LOCAL_LIMIT", "limit": "rate", "retry_after_seconds": 45, "retry": "in 45 s", "charged": false, "allowance": {...}}
299
+ ```
300
+
301
+ `retry_after_seconds` is `null` for a spent cap: waiting does not help. `captcha_allowance` reports what is left at any time, and every solve answer carries the same `allowance` block. The workspace's own limits still apply on Browsa's side.
302
+
303
+ ### Prompts
304
+
305
+ Built-in prompts, listed only when their tools are on: **solve_captcha_on_my_page** (detect, solve, apply, verify, in your own browser), **what_captcha_is_this** (detect only, free) and **pass_check_in_browsa_browser** (open, `act solve_captcha`, hand off if it stays).
306
+
307
+ ## Retries and starting offline
308
+
309
+ - A call answered `429`, or refused by the key's per-minute limit, is sent again after a wait: the server's `Retry-After` when it gives one (up to 30 s), otherwise exponential backoff with jitter. A gateway `5xx` or a dropped connection is retried only for calls that change nothing (reads, deletes, a result poll). A call that may have been carried out (create a browser, start a task, create a captcha task) is never sent twice. `BROWSA_MCP_RETRIES` sets the number of retries (default 2, `0` for none).
310
+ - Starting waits on no request. The tool list is built in, and the captcha type list starts from a copy bundled with the package, so a client lists the tools and `detect_captcha` works with the network down. `detect_captcha` says which list it used (`catalogue.source`: `live` or `bundled`, with its date).
311
+
312
+ ## What leaves your machine
313
+
314
+ - `detect_captcha` and `captcha_allowance`: nothing. No request is made.
315
+ - `solve_captcha_on_page`: your key and the task's parameters (type, page address, site key, the optional fields) go to `captcha.browsa.io`. The page's HTML is never sent.
316
+ - The browser tools: your key and each call's arguments go to `browsa.io`.
317
+ - No telemetry: no analytics, usage pings or update checks. The one request no tool asked for is a `GET` of the public captcha type list at startup, with no key and no parameters, and only when a `captcha_page` tool is listed (`BROWSA_CAPTCHA_CATALOGUE=bundled` stops it).
318
+
319
+ The full table is in [SECURITY.md](./SECURITY.md).
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
+
325
+ ## Upgrading from 0.7
326
+
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.
155
328
 
156
329
  ## Upgrading from 0.5
157
330
 
@@ -167,12 +340,15 @@ A tool name works too (`BROWSA_MCP_TOOLS=run_task,credits`). Calling a tool whos
167
340
 
168
341
  | Var | Required | What |
169
342
  |---|---|---|
170
- | `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys) |
171
- | `BROWSA_MCP_TOOLS` | no | Optional groups to turn on, e.g. `tasks,robots`, or `all` |
343
+ | `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys). `detect_captcha` and `list_captcha_types` run without it |
344
+ | `BROWSA_MCP_TOOLS` | no | Optional groups to turn on, e.g. `tasks,robots`, or `all`; `-name` turns one off, `-core` the nine browser tools |
172
345
  | `BROWSA_COUNTRY` | no | Default exit country for `open` (needs a proxy) |
173
346
  | `BROWSA_MCP_REDACT` | no | `off` shows URL tokens (debugging only) |
174
347
  | `BROWSA_LLM`, `BROWSA_LLM_KEY_ID`, `BROWSA_LLM_API_KEY` | no | Model and key for the `tasks` and `schedules` groups. Unset: the workspace's saved key, or Browsa's hosted model |
175
- | `BROWSA_CAPTCHA_URL` | no | Captcha API for `solve_captcha_task` (default `https://captcha.browsa.io`) |
348
+ | `BROWSA_CAPTCHA_MAX_CREDITS`, `BROWSA_CAPTCHA_RATE_PER_MINUTE`, `BROWSA_CAPTCHA_CONCURRENCY` | no | Local limits for captcha solves: session spend, starts per minute, running at once. Unset: no local limit |
349
+ | `BROWSA_CAPTCHA_CATALOGUE` | no | `bundled` uses the captcha type list shipped with the package and never fetches it |
350
+ | `BROWSA_MCP_RETRIES` | no | Retries on `429` and gateway errors (default 2, `0` for none) |
351
+ | `BROWSA_CAPTCHA_URL` | no | Captcha API for the captcha tools (default `https://captcha.browsa.io`) |
176
352
  | `BROWSA_BASE_URL` | no | Another Browsa API (staging) |
177
353
 
178
354
  ## Links
package/SECURITY.md ADDED
@@ -0,0 +1,40 @@
1
+ # Security
2
+
3
+ ## Report a vulnerability
4
+
5
+ Write to <security@browsa.io> with what you found and how to reproduce it. Please do not open a public issue for a vulnerability. Supported: the latest published version of `@browsa/mcp`.
6
+
7
+ ## What leaves your machine
8
+
9
+ The server is a local process started by your MCP client. It talks to two hosts, both Browsa's, over HTTPS, and only when a tool that needs them is called.
10
+
11
+ | When | Where | What is sent |
12
+ |---|---|---|
13
+ | `detect_captcha` | nowhere | Nothing. The HTML, URL and resource list you pass are read in this process and dropped. No key is needed. |
14
+ | `captcha_allowance` | nowhere | Nothing. It reads counters kept in memory. |
15
+ | Startup, only when a tool of the `captcha_page` group is listed | `GET https://captcha.browsa.io/types` | Nothing about you: no key, no parameters. It fetches the public list of captcha types, once, and is not waited for. `BROWSA_CAPTCHA_CATALOGUE=bundled` stops it; the list bundled with the package is used instead. |
16
+ | `solve_captcha_on_page`, `solve_captcha_task` | `https://captcha.browsa.io` | Your API key and the task: the task type, the page's address (`websiteURL`), the site key, and the optional fields you or `detect_captcha` filled in (action, cdata, your proxy, a user agent), or the image for a picture task. The page's HTML is never sent, also when you pass `html` to `solve_captcha_on_page`: detection runs here and only the parameters go out. `solve_captcha_on_page` may also refresh the type list (the `GET` above), at most once an hour. |
17
+ | `list_captcha_types` | `GET https://captcha.browsa.io/types` | No key, no parameters. |
18
+ | `report_captcha_result` | `https://captcha.browsa.io` | Your API key, the task id and whether the site accepted the solution. |
19
+ | The nine core tools and the other groups | `https://browsa.io` | Your API key and the call's arguments (a URL to open, an action, a task text). Pages are loaded by the cloud browser, not by this process. |
20
+
21
+ What the server does not do:
22
+
23
+ - **No telemetry.** No analytics, no usage pings, no crash reports, no update checks. Every request is one of the rows above. Requests carry a `User-Agent` that names this package or the `browsa` SDK and its version, and nothing that identifies the machine.
24
+ - **It never touches your browser.** `solve_captcha_on_page` returns an expression or cookies; your own tools apply them.
25
+ - **It writes no files.** State (open cloud browsers, a flow being recorded, captcha spend and limits) is in memory and ends with the process.
26
+ - **It opens no port.** The transport is stdio.
27
+ - **Secrets by reference.** Saved secrets are typed by Browsa inside the cloud browser; their values never pass through this process or the model.
28
+
29
+ `BROWSA_BASE_URL` and `BROWSA_CAPTCHA_URL` point the server at other hosts (staging); leave them unset for the hosts above.
30
+
31
+ ## The apply expression
32
+
33
+ `solve_captcha_on_page` returns JavaScript for you to evaluate in a page. It is built by this process from a fixed template (`src/captcha/apply.ts`) and three values: the solution token, and the callback name and field name read from the page's own markup. All three are embedded as JSON string literals, never as code. It sets the answer field, calls the page's own callback, and makes the widget's `getResponse` (and, for a v3 token, `execute`) answer the token. It makes no request and reads nothing else from the page. Read it before running it if you like: it is short.
34
+
35
+ ## Keys and limits
36
+
37
+ - The API key is read from the environment and sent only to the two hosts above. It is never written to an answer, a log line or a file.
38
+ - Tokens in URLs (`token`, `key`, `session`, `code`, `signature`, ...) are masked as `***` in every tool answer.
39
+ - `BROWSA_CAPTCHA_MAX_CREDITS`, `BROWSA_CAPTCHA_RATE_PER_MINUTE` and `BROWSA_CAPTCHA_CONCURRENCY` bound what an agent can spend on captcha solves in one session. They are enforced in this process before any request is made. The workspace's own limits (its balance and its monthly spending limit) are enforced by Browsa and still apply.
40
+ - Set the local cap for agents you do not watch: it is the only limit that is per session.