@browsa/mcp 0.5.0 → 0.7.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.
Files changed (3) hide show
  1. package/README.md +128 -89
  2. package/dist/server.js +1160 -160
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -5,28 +5,28 @@
5
5
 
6
6
  # @browsa/mcp
7
7
 
8
- **Drive real browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client.**
9
-
10
- MCP (Model Context Protocol) server for [Browsa](https://browsa.io): turn any LLM into a real-browser agent with one config line. The agent gets a fresh cloud browser running Phantom, Browsa's own browser, and a live view link so you can watch it work.
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.
11
9
 
12
10
  [![npm version](https://img.shields.io/npm/v/@browsa/mcp.svg)](https://www.npmjs.com/package/@browsa/mcp)
13
11
 
14
- ## What this is
12
+ You need a Browsa API key: [app.browsa.io/dashboard/keys](https://app.browsa.io/dashboard/keys). Replace `agt_live_...` below with it.
13
+
14
+ ## Install
15
15
 
16
- Most "AI agent" setups stop at the LLM. We give the LLM a real browser. Through MCP, Claude can now:
17
- - Navigate, fill forms, click, scroll, scrape
18
- - Return results as structured JSON
19
- - Use your own HTTP or SOCKS5 proxy per browser (free), or Browsa's built-in proxy network: datacenter or residential, billed per GB from credits (see `proxy_network`)
20
- - Stay logged in across calls via persistent identities
21
- - Run your robots (saved browser jobs) and read their rows
16
+ [![Add to Cursor](https://img.shields.io/badge/Cursor-Add_Browsa-111111?style=for-the-badge)](https://cursor.com/en/install-mcp?name=browsa&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBicm93c2EvbWNwIl0sImVudiI6eyJCUk9XU0FfQVBJX0tFWSI6ImFndF9saXZlXy4uLiJ9fQ==)
17
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Browsa-0098FF?style=for-the-badge)](https://insiders.vscode.dev/redirect/mcp/install?name=browsa&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40browsa%2Fmcp%22%5D%2C%22env%22%3A%7B%22BROWSA_API_KEY%22%3A%22agt_live_...%22%7D%7D)
22
18
 
23
- No code from you: just configure Claude Desktop (or Cursor / Cline / Zed) once, and ask in natural language.
19
+ After a one-click install, put your key in place of `agt_live_...` in the client's MCP settings.
24
20
 
25
- ## Install
21
+ ### Claude Code
22
+
23
+ ```bash
24
+ claude mcp add browsa -e BROWSA_API_KEY=agt_live_... -- npx -y @browsa/mcp
25
+ ```
26
26
 
27
27
  ### Claude Desktop
28
28
 
29
- Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
29
+ Settings, Developer, Edit Config (`claude_desktop_config.json`):
30
30
 
31
31
  ```json
32
32
  {
@@ -34,113 +34,152 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
34
34
  "browsa": {
35
35
  "command": "npx",
36
36
  "args": ["-y", "@browsa/mcp"],
37
- "env": {
38
- "BROWSA_API_KEY": "agt_live_..."
39
- }
37
+ "env": { "BROWSA_API_KEY": "agt_live_..." }
40
38
  }
41
39
  }
42
40
  }
43
41
  ```
44
42
 
45
- No LLM secret goes in the config: save your Anthropic, OpenAI or Google key once at [app.browsa.io/dashboard/llm-keys](https://app.browsa.io/dashboard/llm-keys) and tasks use the workspace's default saved key. (Prefer to keep it local? Add `"BROWSA_LLM_API_KEY": "sk-ant-..."` instead.)
46
-
47
- Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top story title."*
43
+ Restart Claude Desktop.
48
44
 
49
45
  ### Cursor
50
46
 
51
- `~/.cursor/mcp.json`:
47
+ The button above, the link `cursor://anysphere.cursor-deeplink/mcp/install?name=browsa&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBicm93c2EvbWNwIl0sImVudiI6eyJCUk9XU0FfQVBJX0tFWSI6ImFndF9saXZlXy4uLiJ9fQ==`, or the same `mcpServers` block as Claude Desktop in `~/.cursor/mcp.json`.
52
48
 
53
- ```json
54
- {
55
- "mcpServers": {
56
- "browsa": {
57
- "command": "npx",
58
- "args": ["-y", "@browsa/mcp"],
59
- "env": { "BROWSA_API_KEY": "agt_live_..." }
60
- }
61
- }
62
- }
49
+ ### VS Code
50
+
51
+ The button above, or:
52
+
53
+ ```bash
54
+ code --add-mcp '{"name":"browsa","command":"npx","args":["-y","@browsa/mcp"],"env":{"BROWSA_API_KEY":"agt_live_..."}}'
63
55
  ```
64
56
 
65
- ### Cline / Continue / Zed
57
+ ### Windsurf
66
58
 
67
- Any MCP-spec-compliant client. Point at `npx -y @browsa/mcp` and set `BROWSA_API_KEY`.
59
+ `~/.codeium/windsurf/mcp_config.json`, the same `mcpServers` block as Claude Desktop.
68
60
 
69
- ## Env
61
+ ### Any other MCP client
70
62
 
71
- | Var | Required | What |
72
- |---|---|---|
73
- | `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [browsa.io → Keys](https://app.browsa.io/dashboard/keys) |
74
- | `BROWSA_LLM_KEY_ID` | no | Id of a saved LLM key to use by default (see `list_llm_keys`). Without it, the workspace's default saved key for the model's provider is used |
75
- | `BROWSA_LLM_API_KEY` | no | A per-task LLM provider key sent with every task. Not needed once a key is saved at [dashboard/llm-keys](https://app.browsa.io/dashboard/llm-keys). Wins over `BROWSA_LLM_KEY_ID` |
76
- | `BROWSA_LLM` | no | Default LLM, e.g. `anthropic:claude-sonnet-5-5`, or a hosted tier such as `browsa-fast`. Unset: the saved key's provider default model (`claude-opus-5-5` with `BROWSA_LLM_API_KEY`) |
77
- | `BROWSA_COUNTRY` | no | Default egress country (e.g. `US`) |
78
- | `BROWSA_BASE_URL` | no | Override prod URL (staging / self-hosted) |
79
- | `BROWSA_CAPTCHA_URL` | no | Captcha API for `solve_captcha_task`. Default: https://captcha.browsa.io (`BROWSA_BASE_URL` + `/captcha-api` when that is set) |
63
+ Command `npx -y @browsa/mcp`, environment `BROWSA_API_KEY`. Transport: stdio. Registry name: `io.browsa/browsa`.
64
+
65
+ Then ask: *"Open books.toscrape.com and list the first five titles with their prices."*
80
66
 
81
- ### Which LLM key a task uses
67
+ ## Tools
82
68
 
83
- Per call, first match wins: a hosted tier (`llm: "browsa"`, `"browsa-fast"` or `"browsa-smart"`: no key, see [Models](#models)), then `llm_api_key`, then `llm_key_id`, then `BROWSA_LLM_API_KEY`, then `BROWSA_LLM_KEY_ID`. With none of these, no key is sent and the server uses the workspace's default saved key for the provider of `llm` (with `llm` unset: the first default in the order anthropic, openai, google).
69
+ Nine tools are on by default. Their schemas are about 1.2k tokens in total.
84
70
 
85
- If no key is saved at all:
71
+ | Tool | What it does |
72
+ |---|---|
73
+ | `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). |
74
+ | `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. |
75
+ | `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. |
76
+ | `read` | The full content of one container, with no model: `as: text`, `table` (TSV) or `links`. |
77
+ | `screenshot` | A JPEG of the viewport, the full page (`full`) or one element (`id`). |
78
+ | `secrets` | Your saved secrets: names, kinds, the sites each may be typed on, and whether it has a one-time code. Never values. |
79
+ | `handoff` | A single-use live link for a person to take over: a captcha the solver gave up on, a login, a decision. The next `observe` or `act` says when the page moved on. |
80
+ | `flow` | `start` records your `act` and `read` steps, `save` stores them as a Browsa recipe, `run` replays it with no model calls, `list` shows them. |
81
+ | `close` | Closes the browser. |
86
82
 
87
- - **No model named** (no `llm` argument, no `BROWSA_LLM`): `run_task` and `create_schedule` still work with zero config. They retry once on Browsa's hosted model (which adds credits per task) and the result has a `note` saying so: *"No saved LLM key found, so this ran on Browsa's hosted model (adds credits per task; see list_models). Save a key at https://app.browsa.io/dashboard/llm-keys to use your own."* The same happens if the server has saved keys turned off (`LLM_KEYS_UNAVAILABLE`). A schedule created this way stays on the hosted model; create it again after saving a key.
88
- - **A model named**: there is no fallback. The tool returns an error (code `LLM_KEY_REQUIRED`) that says to save a key at [app.browsa.io/dashboard/llm-keys](https://app.browsa.io/dashboard/llm-keys), set `BROWSA_LLM_API_KEY`, or pass `llm: "browsa"`.
83
+ `browser_id` is optional everywhere: it defaults to the last browser used.
89
84
 
90
- ## Models
85
+ ### What an answer looks like
91
86
 
92
- `run_task` and `create_schedule` take `llm` and `reasoning`:
87
+ The first line of every `act` answer is one of `ok`, `failed`, `blocked`, `challenge`, `stale`, `dialog` or `secret_origin`, and when something stopped it says what to do next:
93
88
 
94
- | `llm` | What it is |
95
- |---|---|
96
- | `"browsa"` | The default hosted model |
97
- | `"browsa-fast"` | Fastest and lightest |
98
- | `"browsa-smart"` | For harder tasks |
99
- | anything else, e.g. `"anthropic:claude-sonnet-5-5"` | A provider model, run with your own key (saved, or `llm_api_key`) |
89
+ ```
90
+ ok
91
+ after: type [3] "poetry", then Enter
92
+ ~ [3] searchbox "Search" value "poetry"
93
+ settled after 180 ms, 1 request (GET /search → 200)
94
+ ```
95
+
96
+ ```
97
+ stale: the page changed and those ids are gone; nothing was done. Fresh view:
98
+ page "Results" https://books.toscrape.com/...
99
+ ```
100
+
101
+ ```
102
+ challenge: turnstile check appeared; next: act solve_captcha, and if it stays, handoff
103
+ ```
104
+
105
+ Errors work the same way: `error: AGENT_NOT_RUNNING: agent is destroyed` is followed by `next: this browser is gone (it expired or was closed); call open for a new one`.
106
+
107
+ ### Secrets by reference
108
+
109
+ Save logins, one-time-code seeds and keys once in the dashboard (Secrets). The model sees only names:
100
110
 
101
- Hosted tiers need no LLM key and add a flat number of credits per task. Which model each tier runs on, and what it costs, are server settings that can change: the `list_models` tool returns them (free, read-only), along with the providers you can bring a key for.
111
+ ```
112
+ secrets: 1 (values are never shown; type one with act {action: "type", id, secret: REF})
113
+ GITHUB login on github.com and subdomains refs GITHUB:username, GITHUB:password, TOTP:GITHUB one-time code
114
+ ```
115
+
116
+ `act {"action": "type", "id": 14, "secret": "GITHUB:password"}` sends only the reference. Browsa types the value inside the browser, only when the page and the field are on the secret's sites (otherwise the answer is `secret_origin` and nothing is typed), writes an audit row, and shows `<secret>GITHUB:password</secret>` wherever the value would appear. The value never passes through this MCP server or the model.
117
+
118
+ ### Flows: record once, replay with no model
119
+
120
+ ```
121
+ flow {op: "start"}
122
+ act ... / read ... (do the task once)
123
+ flow {op: "save", name: "book-search", params: {query: "poetry"}}
124
+ flow {op: "run", name: "book-search", params: {query: "travel"}}
125
+ ```
102
126
 
103
- `reasoning` is `"low"`, `"medium"` or `"high"`; leave it out for the tier's or the provider's default. Ask in plain language, for example: *"Use browsa-smart with high reasoning to compare the pricing pages of these three sites."*
127
+ `params` on save names the values you typed that should change between runs: each example value becomes `{{query}}`. Secrets you typed are saved as references. A run costs the flow's `price_credits` when it succeeds; failed runs are free. When the site changed, `run` answers `site_changed` with the step that broke: redo it with `act` and save the flow again.
104
128
 
105
- `run_task` and `get_job` results carry `status` and `outcome`. `status: completed` only means the run ended; `outcome: failed` with it means the agent finished but could not do the task, and `outcome_message` and `final_result` say why. `signals` lists what was seen on the way (a bot check, a proxy failure) when there is any.
129
+ ### Privacy
106
130
 
107
- When the job has them, `run_task` and `get_job` results include `usage` (`input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_write_tokens`, `requests`), `llm_tier`, `reasoning` (the level that was applied) and `llm_cost_usd`. `llm_cost_usd` is an estimate from public list prices for runs with your own key; it is `null` when unknown and always `null` for hosted runs, which are paid in credits.
131
+ - 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.
133
+ - Live links are single use and expire.
108
134
 
109
- ## Tools exposed
135
+ ## More tools (optional groups)
110
136
 
111
- | Tool | What |
137
+ Everything else from 0.5 is in groups you turn on with `BROWSA_MCP_TOOLS` (comma separated) or the argument `--tools=...`:
138
+
139
+ | Group | Tools |
112
140
  |---|---|
113
- | `run_task` | Run a browser-driven task. Returns the final result, `outcome` and steps. Optional `llm`, `reasoning`, `llm_key_id`. |
114
- | `get_job` | Poll a long-running task. Optional server-side `wait_seconds`. |
115
- | `cancel_job` | Cancel a running task. |
116
- | `respond_to_job` | Answer an `input_required` prompt (a decision, or a CAPTCHA the task could not solve itself: see https://browsa.io/captcha). |
117
- | `start_browser` | Start a real cloud browser and get its CDP URL, to drive yourself with Playwright or Puppeteer. |
118
- | `stop_browser` | Stop a browser from `start_browser` and release it. |
119
- | `proxy_network` | Whether Browsa's built-in proxy network is on, its tiers, countries and price. Read-only and free. |
120
- | `observe` | Read the page of a browser from `start_browser` as compact text with element ids. No Playwright needed. |
121
- | `act` | One action in that browser (click, type, press, select, scroll, navigate, wait and more); returns what changed. |
122
- | `list_browsers` | List this workspace's browsers and their status. |
123
- | `credits` | Show credit balance + top-up packs. |
124
- | `list_webhooks` / `create_webhook` / `delete_webhook` | Webhook CRUD. |
125
- | `list_identities` | List persistent browser identities (use one via `profile_id` to reuse warmed cookies). |
126
- | `create_schedule` / `list_schedules` | Recurring tasks. `create_schedule` takes `llm`, `reasoning` and `llm_key_id`; the schedule stores only the key's id. |
127
- | `list_job_files` | Output files a task wrote. |
128
- | `list_llm_keys` | Saved LLM keys: id, provider, masked key, default flag, status. Read-only; never returns a secret. |
129
- | `list_models` | Hosted tiers (model, default reasoning, credits per task) and own-key providers. Read-only and free. |
130
- | `list_robots` | Your robots: input rows, schedule, settings, health, last run and `price_credits` (per successful row; failed rows are free). |
131
- | `run_robot` | Run a robot on its saved rows or on rows you pass. Optional `wait_seconds` (up to 300) returns the rows. |
132
- | `get_robot_run` | One robot run: status, credits, and a row per input with its output or typed error. |
133
- | `solve_captcha_task` | Solve one captcha through Browsa's captcha API (`createTask` / `getTaskResult`): a reCAPTCHA or Turnstile token, image text or grid tiles, for code outside a Browsa browser. Charged only when solved. Measured types: https://browsa.io/captcha |
134
-
135
- ## Why MCP-first matters
136
-
137
- Most agent platforms gate distribution behind "write code → deploy → call our API." We gate it behind "paste config → ask Claude." For an AI agent platform, **the prospect's first 30 seconds is the make-or-break moment.** With this MCP server, the first 30 seconds is a working browser doing what they asked.
138
-
139
- ## Source + Issues
141
+ | `tasks` | `run_task`, `get_job`, `cancel_job`, `respond_to_job`, `list_job_files` |
142
+ | `robots` | `list_robots`, `run_robot`, `get_robot_run` |
143
+ | `schedules` | `create_schedule`, `list_schedules` |
144
+ | `webhooks` | `list_webhooks`, `create_webhook`, `delete_webhook` |
145
+ | `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) |
147
+ | `admin` | `credits`, `list_browsers`, `list_identities`, `proxy_network`, `list_llm_keys`, `list_models` |
148
+ | `all` | every group |
149
+
150
+ ```json
151
+ "env": { "BROWSA_API_KEY": "agt_live_...", "BROWSA_MCP_TOOLS": "tasks,robots" }
152
+ ```
153
+
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.
155
+
156
+ ## Upgrading from 0.5
157
+
158
+ 0.6 lists nine tools instead of 25, so a model spends far fewer tokens on tool definitions before it starts.
159
+
160
+ - **To keep every 0.5 tool**, set `BROWSA_MCP_TOOLS=all`. Nothing else changes for them: same names, same arguments, same JSON answers.
161
+ - `start_browser` and `stop_browser` move to the `cdp` group. Use `open` and `close` instead: `open` also navigates and returns the first view.
162
+ - `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.
163
+ - `run_task` and the other task tools are in the `tasks` group; robots in `robots`; credits, models, keys and identities in `admin`.
164
+ - The task tools still read `BROWSA_LLM`, `BROWSA_LLM_KEY_ID` and `BROWSA_LLM_API_KEY`.
165
+
166
+ ## Env
167
+
168
+ | Var | Required | What |
169
+ |---|---|---|
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` |
172
+ | `BROWSA_COUNTRY` | no | Default exit country for `open` (needs a proxy) |
173
+ | `BROWSA_MCP_REDACT` | no | `off` shows URL tokens (debugging only) |
174
+ | `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`) |
176
+ | `BROWSA_BASE_URL` | no | Another Browsa API (staging) |
177
+
178
+ ## Links
140
179
 
141
180
  - Docs: <https://browsa.io/docs>
181
+ - MCP guide: <https://browsa.io/guides/mcp-server>
142
182
  - Support: <mailto:support@browsa.io>
143
- - API reference: <https://browsa.io/docs>
144
183
 
145
184
  ## License
146
185