@browsa/mcp 0.2.0 → 0.3.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/LICENSE +1 -1
- package/README.md +58 -16
- package/dist/server.js +395 -55
- package/package.json +12 -5
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
<!-- mcp-name: io.browsa/browsa -->
|
|
2
|
+
<p align="center">
|
|
3
|
+
<a href="https://browsa.io"><img src="https://browsa.io/browsa-logo-lockup.png" alt="Browsa" width="340"></a>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
1
6
|
# @browsa/mcp
|
|
2
7
|
|
|
3
|
-
**Drive
|
|
8
|
+
**Drive real browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client.**
|
|
4
9
|
|
|
5
|
-
MCP (Model Context Protocol) server for [Browsa](https://browsa.io)
|
|
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 Chromium on Browsa's own build, and a live view link so you can watch it work.
|
|
6
11
|
|
|
7
12
|
[](https://www.npmjs.com/package/@browsa/mcp)
|
|
8
13
|
|
|
@@ -10,11 +15,11 @@ MCP (Model Context Protocol) server for [Browsa](https://browsa.io) — turn any
|
|
|
10
15
|
|
|
11
16
|
Most "AI agent" setups stop at the LLM. We give the LLM a real browser. Through MCP, Claude can now:
|
|
12
17
|
- Navigate, fill forms, click, scroll, scrape
|
|
13
|
-
-
|
|
14
|
-
-
|
|
18
|
+
- Return results as structured JSON
|
|
19
|
+
- Use your own HTTP or SOCKS5 proxy per browser (Browsa supplies no proxies)
|
|
15
20
|
- Stay logged in across calls via persistent identities
|
|
16
21
|
|
|
17
|
-
No code from you
|
|
22
|
+
No code from you: just configure Claude Desktop (or Cursor / Cline / Zed) once, and ask in natural language.
|
|
18
23
|
|
|
19
24
|
## Install
|
|
20
25
|
|
|
@@ -29,14 +34,15 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
|
|
|
29
34
|
"command": "npx",
|
|
30
35
|
"args": ["-y", "@browsa/mcp"],
|
|
31
36
|
"env": {
|
|
32
|
-
"BROWSA_API_KEY": "agt_live_..."
|
|
33
|
-
"BROWSA_LLM_API_KEY": "sk-ant-..."
|
|
37
|
+
"BROWSA_API_KEY": "agt_live_..."
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
```
|
|
39
43
|
|
|
44
|
+
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.)
|
|
45
|
+
|
|
40
46
|
Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top story title."*
|
|
41
47
|
|
|
42
48
|
### Cursor
|
|
@@ -49,7 +55,7 @@ Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top st
|
|
|
49
55
|
"browsa": {
|
|
50
56
|
"command": "npx",
|
|
51
57
|
"args": ["-y", "@browsa/mcp"],
|
|
52
|
-
"env": { "BROWSA_API_KEY": "agt_live_..."
|
|
58
|
+
"env": { "BROWSA_API_KEY": "agt_live_..." }
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
@@ -57,29 +63,65 @@ Restart Claude Desktop. Ask: *"Go to news.ycombinator.com and tell me the top st
|
|
|
57
63
|
|
|
58
64
|
### Cline / Continue / Zed
|
|
59
65
|
|
|
60
|
-
Any MCP-spec-compliant client. Point at `npx -y @browsa/mcp` and set
|
|
66
|
+
Any MCP-spec-compliant client. Point at `npx -y @browsa/mcp` and set `BROWSA_API_KEY`.
|
|
61
67
|
|
|
62
|
-
##
|
|
68
|
+
## Env
|
|
63
69
|
|
|
64
70
|
| Var | Required | What |
|
|
65
71
|
|---|---|---|
|
|
66
|
-
| `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [browsa.io → Keys](https://browsa.io/dashboard/keys) |
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
72
|
+
| `BROWSA_API_KEY` | yes | Your `agt_live_*` key from [browsa.io → Keys](https://app.browsa.io/dashboard/keys) |
|
|
73
|
+
| `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 |
|
|
74
|
+
| `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` |
|
|
75
|
+
| `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`) |
|
|
69
76
|
| `BROWSA_COUNTRY` | no | Default egress country (e.g. `US`) |
|
|
70
77
|
| `BROWSA_BASE_URL` | no | Override prod URL (staging / self-hosted) |
|
|
71
78
|
|
|
79
|
+
### Which LLM key a task uses
|
|
80
|
+
|
|
81
|
+
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).
|
|
82
|
+
|
|
83
|
+
If no key is saved at all:
|
|
84
|
+
|
|
85
|
+
- **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.
|
|
86
|
+
- **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"`.
|
|
87
|
+
|
|
88
|
+
## Models
|
|
89
|
+
|
|
90
|
+
`run_task` and `create_schedule` take `llm` and `reasoning`:
|
|
91
|
+
|
|
92
|
+
| `llm` | What it is |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `"browsa"` | The default hosted model |
|
|
95
|
+
| `"browsa-fast"` | Fastest and lightest |
|
|
96
|
+
| `"browsa-smart"` | For harder tasks |
|
|
97
|
+
| anything else, e.g. `"anthropic:claude-sonnet-5-5"` | A provider model, run with your own key (saved, or `llm_api_key`) |
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
`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."*
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
72
105
|
## Tools exposed
|
|
73
106
|
|
|
74
107
|
| Tool | What |
|
|
75
108
|
|---|---|
|
|
76
|
-
| `run_task` | Run a browser-driven task. Returns final result + live noVNC URL. |
|
|
109
|
+
| `run_task` | Run a browser-driven task. Returns final result + live noVNC URL. Optional `llm`, `reasoning`, `llm_key_id`. |
|
|
77
110
|
| `get_job` | Poll a long-running task. Optional server-side `wait_seconds`. |
|
|
78
111
|
| `cancel_job` | Cancel a running task. |
|
|
79
112
|
| `respond_to_job` | Answer an `input_required` prompt (CAPTCHA, decision). |
|
|
113
|
+
| `start_browser` | Start a real cloud browser and get its CDP URL, to drive yourself with Playwright or Puppeteer. |
|
|
114
|
+
| `stop_browser` | Stop a browser from `start_browser` and release it. |
|
|
115
|
+
| `observe` | Read the page of a browser from `start_browser` as compact text with element ids. No Playwright needed. |
|
|
116
|
+
| `act` | One action in that browser (click, type, press, select, scroll, navigate, wait and more); returns what changed. |
|
|
117
|
+
| `list_browsers` | List this workspace's browsers and their status. |
|
|
80
118
|
| `credits` | Show credit balance + top-up packs. |
|
|
81
119
|
| `list_webhooks` / `create_webhook` / `delete_webhook` | Webhook CRUD. |
|
|
82
120
|
| `list_identities` | List persistent browser identities (use one via `profile_id` to reuse warmed cookies). |
|
|
121
|
+
| `create_schedule` / `list_schedules` | Recurring tasks. `create_schedule` takes `llm`, `reasoning` and `llm_key_id`; the schedule stores only the key's id. |
|
|
122
|
+
| `list_job_files` | Output files a task wrote. |
|
|
123
|
+
| `list_llm_keys` | Saved LLM keys: id, provider, masked key, default flag, status. Read-only; never returns a secret. |
|
|
124
|
+
| `list_models` | Hosted tiers (model, default reasoning, credits per task) and own-key providers. Read-only and free. |
|
|
83
125
|
|
|
84
126
|
## Why MCP-first matters
|
|
85
127
|
|
|
@@ -87,8 +129,8 @@ Most agent platforms gate distribution behind "write code → deploy → call ou
|
|
|
87
129
|
|
|
88
130
|
## Source + Issues
|
|
89
131
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
132
|
+
- Docs: <https://browsa.io/docs>
|
|
133
|
+
- Support: <mailto:support@browsa.io>
|
|
92
134
|
- API reference: <https://browsa.io/docs>
|
|
93
135
|
|
|
94
136
|
## License
|
package/dist/server.js
CHANGED
|
@@ -9,13 +9,16 @@ import {
|
|
|
9
9
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
10
|
import { Client, BrowsaError } from "browsa";
|
|
11
11
|
var API_KEY = process.env.BROWSA_API_KEY;
|
|
12
|
-
var BASE_URL = process.env.BROWSA_BASE_URL
|
|
13
|
-
var DEFAULT_LLM = process.env.BROWSA_LLM
|
|
14
|
-
var
|
|
15
|
-
var
|
|
12
|
+
var BASE_URL = process.env.BROWSA_BASE_URL;
|
|
13
|
+
var DEFAULT_LLM = process.env.BROWSA_LLM || void 0;
|
|
14
|
+
var BYOK_DEFAULT_LLM = "claude-opus-5-5";
|
|
15
|
+
var DEFAULT_LLM_KEY = process.env.BROWSA_LLM_API_KEY || void 0;
|
|
16
|
+
var DEFAULT_LLM_KEY_ID = process.env.BROWSA_LLM_KEY_ID || void 0;
|
|
17
|
+
var DEFAULT_COUNTRY = process.env.BROWSA_COUNTRY;
|
|
18
|
+
var LLM_KEYS_URL = "https://app.browsa.io/dashboard/llm-keys";
|
|
16
19
|
if (!API_KEY) {
|
|
17
20
|
console.error("[browsa-mcp] BROWSA_API_KEY env var is required");
|
|
18
|
-
console.error(" Mint one at https://browsa.io/dashboard/keys");
|
|
21
|
+
console.error(" Mint one at https://app.browsa.io/dashboard/keys");
|
|
19
22
|
process.exit(2);
|
|
20
23
|
}
|
|
21
24
|
var client = new Client({
|
|
@@ -23,13 +26,18 @@ var client = new Client({
|
|
|
23
26
|
...BASE_URL ? { baseUrl: BASE_URL } : {}
|
|
24
27
|
});
|
|
25
28
|
var server = new Server(
|
|
26
|
-
{ name: "browsa", version: "0.
|
|
29
|
+
{ name: "browsa", version: "0.3.0" },
|
|
27
30
|
{ capabilities: { tools: {} } }
|
|
28
31
|
);
|
|
32
|
+
var REASONING_PROP = {
|
|
33
|
+
type: "string",
|
|
34
|
+
enum: ["low", "medium", "high"],
|
|
35
|
+
description: "How much the model reasons. Omit for the tier's or the provider's default."
|
|
36
|
+
};
|
|
29
37
|
var tools = [
|
|
30
38
|
{
|
|
31
39
|
name: "run_task",
|
|
32
|
-
description: "Run a browser-driven AI task on a fresh
|
|
40
|
+
description: "Run a browser-driven AI task on a fresh real Chromium burner. Returns the final result, total steps, and a live noVNC URL the user can open to watch the browser drive in real time. Use this when the user asks for anything web-shaped: scrape, fill, click, extract, login, place an order, search, summarize a page, etc. The browser is a real macOS-Chrome-fingerprinted Chromium with built-in CAPTCHA solving (Turnstile, hCaptcha, reCAPTCHA, ALTCHA, FunCaptcha) and behavioral humanization. Default timeout: 10 minutes.",
|
|
33
41
|
inputSchema: {
|
|
34
42
|
type: "object",
|
|
35
43
|
required: ["task"],
|
|
@@ -40,11 +48,16 @@ var tools = [
|
|
|
40
48
|
},
|
|
41
49
|
llm: {
|
|
42
50
|
type: "string",
|
|
43
|
-
description: `LLM identifier (default: ${DEFAULT_LLM}).
|
|
51
|
+
description: `LLM identifier, e.g. anthropic:claude-sonnet-5-5, openai:gpt-4o, google:gemini-2.5-flash${DEFAULT_LLM ? ` (default: ${DEFAULT_LLM})` : ""}. Omit to use the workspace's default saved key with its provider's default model; if no key is saved at all, the task runs on Browsa's hosted model and the result says so. Hosted tiers need no LLM key and add a flat credit surcharge per task (see list_models): "browsa" (default hosted model), "browsa-fast" (fastest and lightest), "browsa-smart" (for harder tasks). When you name a model, there is no hosted fallback.`
|
|
52
|
+
},
|
|
53
|
+
reasoning: REASONING_PROP,
|
|
54
|
+
llm_key_id: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: `Id of a saved LLM key of this workspace (see list_llm_keys). Default: ${DEFAULT_LLM_KEY_ID ? "BROWSA_LLM_KEY_ID" : "none"}. Usually not needed: with no key given, the workspace's default saved key for the provider of llm is used.`
|
|
44
57
|
},
|
|
45
58
|
llm_api_key: {
|
|
46
59
|
type: "string",
|
|
47
|
-
description: "LLM provider
|
|
60
|
+
description: "Per-task LLM provider key. Rarely needed: prefer a saved key (llm_key_id, or the workspace default) so the secret never passes through the chat. Overrides llm_key_id."
|
|
48
61
|
},
|
|
49
62
|
country: {
|
|
50
63
|
type: "string",
|
|
@@ -58,7 +71,7 @@ var tools = [
|
|
|
58
71
|
},
|
|
59
72
|
profile_id: {
|
|
60
73
|
type: "string",
|
|
61
|
-
description: "
|
|
74
|
+
description: "Id of a persistent identity (agt_..., from list_identities). If set, reuses that browser identity (cookies, history, fingerprint stay sticky). Omit for a fresh burner."
|
|
62
75
|
},
|
|
63
76
|
timeout_minutes: {
|
|
64
77
|
type: "integer",
|
|
@@ -71,7 +84,7 @@ var tools = [
|
|
|
71
84
|
},
|
|
72
85
|
{
|
|
73
86
|
name: "get_job",
|
|
74
|
-
description: "Fetch the current state of a previously-submitted job by UUID. Returns status (queued|running|completed|failed|cancelled
|
|
87
|
+
description: "Fetch the current state of a previously-submitted job by UUID. Returns status (queued|running|completed|failed|input_required; a cancelled job is failed with error_code CANCELLED), step count, final_result text if terminal, and the live_url of the browser's live view while it runs. Cheap \u2014 call repeatedly to poll a long-running job started by run_task.",
|
|
75
88
|
inputSchema: {
|
|
76
89
|
type: "object",
|
|
77
90
|
required: ["job_id"],
|
|
@@ -88,7 +101,7 @@ var tools = [
|
|
|
88
101
|
},
|
|
89
102
|
{
|
|
90
103
|
name: "cancel_job",
|
|
91
|
-
description: "Cancel a running job.
|
|
104
|
+
description: "Cancel a queued or running job. The job ends as failed with error_code CANCELLED and keeps its browser charge. A job that already finished returns an error with code JOB_NOT_CANCELLABLE.",
|
|
92
105
|
inputSchema: {
|
|
93
106
|
type: "object",
|
|
94
107
|
required: ["job_id"],
|
|
@@ -107,6 +120,106 @@ var tools = [
|
|
|
107
120
|
}
|
|
108
121
|
}
|
|
109
122
|
},
|
|
123
|
+
{
|
|
124
|
+
name: "start_browser",
|
|
125
|
+
description: "Start a real cloud browser and return its CDP URL, so you can drive it yourself with Playwright or Puppeteer (connect_over_cdp) instead of handing the work to run_task. Use this when you want to write the browser steps, or need the page open across several of your own tool calls. Billed per browser; always call stop_browser when you are done. Without a proxy the browser uses Browsa's data-center IP.",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
ttl: { type: "string", description: 'How long to keep it, e.g. "5m" or "1h". Default 10m.' },
|
|
130
|
+
country: { type: "string", description: 'ISO-2 country, e.g. "us". Takes effect only with a proxy.' },
|
|
131
|
+
os_type: { type: "string", description: 'Operating system the browser presents, e.g. "macos", "windows".' },
|
|
132
|
+
profile_id: {
|
|
133
|
+
type: "string",
|
|
134
|
+
description: "Reuse a saved identity (see list_identities) so the browser starts with its cookies and logins."
|
|
135
|
+
},
|
|
136
|
+
proxy: {
|
|
137
|
+
type: "object",
|
|
138
|
+
description: `One of two forms. Your own proxy: give host and port, or server as "host:port" / "socks5://host:port", plus username and password when it needs them. Or a tier of Browsa's built-in proxy network, billed per GB from credits: {"network": "datacenter"} or {"network": "residential", "country": "us"}, with nothing else next to network. The built-in network works only when the proxy_network tool reports enabled: call it first for the tiers, their countries and the price per GB.`,
|
|
139
|
+
properties: {
|
|
140
|
+
network: { type: "string", enum: ["datacenter", "residential"], description: "Built-in network tier. Not together with host, port, server, username, password or type." },
|
|
141
|
+
country: { type: "string", description: 'Lowercase ISO alpha-2 exit country, e.g. "us". Optional.' },
|
|
142
|
+
type: { type: "string", enum: ["http", "https", "socks5"], description: "Own proxy only." },
|
|
143
|
+
host: { type: "string", description: "Own proxy only." },
|
|
144
|
+
port: { type: "integer", description: "Own proxy only." },
|
|
145
|
+
server: { type: "string", description: 'Own proxy only: "host:port" or "scheme://host:port".' },
|
|
146
|
+
username: { type: "string", description: "Own proxy only." },
|
|
147
|
+
password: { type: "string", description: "Own proxy only." }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "proxy_network",
|
|
155
|
+
description: `Say whether Browsa's built-in proxy network is enabled on this server and, when it is, list its tiers (datacenter, residential) with the exit countries of each and the price per GB in credits. Call this before passing proxy {"network": ...} to start_browser. When enabled is false, only your own proxy can be used.`,
|
|
156
|
+
inputSchema: { type: "object", properties: {} }
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "stop_browser",
|
|
160
|
+
description: "Stop a browser started with start_browser and release it. Always call this when finished; an unused browser keeps running until its ttl expires.",
|
|
161
|
+
inputSchema: {
|
|
162
|
+
type: "object",
|
|
163
|
+
required: ["browser_id"],
|
|
164
|
+
properties: { browser_id: { type: "string", description: "The id returned by start_browser." } }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "observe",
|
|
169
|
+
description: 'Read the page of a browser started with start_browser, as compact text: one line per element, [id] role "name" state, inside a token budget. Use the ids with the act tool. No Playwright or CDP needed, and no extra charge. Ids stay valid across observe and act calls until the page loads a new document. On a full-page bot check nothing is read and the first lines say so.',
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: "object",
|
|
172
|
+
required: ["browser_id"],
|
|
173
|
+
properties: {
|
|
174
|
+
browser_id: { type: "string", description: "The id returned by start_browser." },
|
|
175
|
+
scope: { type: "string", enum: ["viewport", "page"], description: "viewport (default): what is in the viewport, the rest counted. page: the whole page." },
|
|
176
|
+
budget: { type: "integer", description: "Approximate tokens for the view. Default 2000." },
|
|
177
|
+
expand: { type: "integer", description: "Id of a container, table, list or select to list in full." },
|
|
178
|
+
tab: { type: "string", description: "Tab id, from the tabs line of an earlier observe. Default: the tab used last." }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "act",
|
|
184
|
+
description: "Perform one action in a browser started with start_browser and get back what changed (~ changed, + added, - removed), or a new view after a navigation. Input is sent as real mouse and key events. Name the element by id from observe, or by role and name, or click a point with x and y. The first line of the answer says failed, blocked, challenge or stale when the action did not go through. stale: the ids are from a view that no longer exists, nothing was done, and a new view follows.",
|
|
185
|
+
inputSchema: {
|
|
186
|
+
type: "object",
|
|
187
|
+
required: ["browser_id", "action"],
|
|
188
|
+
properties: {
|
|
189
|
+
browser_id: { type: "string", description: "The id returned by start_browser." },
|
|
190
|
+
action: {
|
|
191
|
+
type: "string",
|
|
192
|
+
enum: ["click", "type", "press", "select", "check", "uncheck", "hover", "scroll", "navigate", "back", "forward", "reload", "wait", "upload", "dialog"]
|
|
193
|
+
},
|
|
194
|
+
id: { type: "integer", description: "Target element id, from observe." },
|
|
195
|
+
role: { type: "string", description: "With name: the first element with this role and name, instead of id." },
|
|
196
|
+
name: { type: "string" },
|
|
197
|
+
x: { type: "number", description: "click: a viewport point instead of an element (with y)." },
|
|
198
|
+
y: { type: "number" },
|
|
199
|
+
text: { type: "string", description: "type: the text. wait for text: the text. dialog: the prompt answer." },
|
|
200
|
+
clear: { type: "boolean", description: "type: empty the field first." },
|
|
201
|
+
submit: { type: "boolean", description: "type: press Enter afterwards." },
|
|
202
|
+
keys: { type: "string", description: 'press: Enter, Escape, Control+A, or a sequence such as "Tab Tab Enter".' },
|
|
203
|
+
option: { type: "string", description: "select: option text or value." },
|
|
204
|
+
double: { type: "boolean", description: "click: double click." },
|
|
205
|
+
right: { type: "boolean", description: "click: right button." },
|
|
206
|
+
dy: { type: "integer", description: "scroll: pixels, positive is down." },
|
|
207
|
+
to: { type: "string", enum: ["top", "bottom"], description: "scroll." },
|
|
208
|
+
url: { type: "string", description: "navigate." },
|
|
209
|
+
ms: { type: "integer", description: "wait: a fixed time in milliseconds, at most 30000." },
|
|
210
|
+
for: { type: "string", enum: ["text", "id-gone", "url-change"], description: "wait: for text to appear, an element to go, or the URL to change." },
|
|
211
|
+
timeout: { type: "integer", description: "wait: milliseconds, default 10000, at most 30000." },
|
|
212
|
+
files: { type: "array", items: { type: "string" }, description: "upload: file paths on the browser's machine." },
|
|
213
|
+
accept: { type: "boolean", description: "dialog: accept (true) or dismiss." },
|
|
214
|
+
tab: { type: "string", description: "Tab id. Default: the tab used last." }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "list_browsers",
|
|
220
|
+
description: "List this workspace's browsers (burners and saved identities) with their status.",
|
|
221
|
+
inputSchema: { type: "object", properties: {} }
|
|
222
|
+
},
|
|
110
223
|
{
|
|
111
224
|
name: "credits",
|
|
112
225
|
description: "Get the current credit balance + available top-up packs.",
|
|
@@ -149,7 +262,7 @@ var tools = [
|
|
|
149
262
|
},
|
|
150
263
|
{
|
|
151
264
|
name: "create_schedule",
|
|
152
|
-
description: `Schedule a browser task to run automatically on a fixed interval (min 1 hour). Each run is a normal billed task.
|
|
265
|
+
description: `Schedule a browser task to run automatically on a fixed interval (min 1 hour). Each run is a normal billed task. LLM key: same rules as run_task (the workspace's default saved key unless llm_key_id is given); the schedule stores only the saved key's id. With no llm and no saved key, the schedule runs on Browsa's hosted model and the result says so. Pass llm "browsa", "browsa-fast" or "browsa-smart" to choose a hosted tier.`,
|
|
153
266
|
inputSchema: {
|
|
154
267
|
type: "object",
|
|
155
268
|
required: ["task", "interval_seconds"],
|
|
@@ -157,8 +270,16 @@ var tools = [
|
|
|
157
270
|
task: { type: "string", description: "Plain-English task instructions (same as run_task)." },
|
|
158
271
|
interval_seconds: { type: "integer", description: "Run interval in seconds. 3600 (1h) \u2013 2592000 (30d).", minimum: 3600, maximum: 2592e3 },
|
|
159
272
|
name: { type: "string", description: "Optional label for the schedule." },
|
|
160
|
-
llm: {
|
|
161
|
-
|
|
273
|
+
llm: {
|
|
274
|
+
type: "string",
|
|
275
|
+
description: `LLM id${DEFAULT_LLM ? ` (default ${DEFAULT_LLM})` : ""}. Omit to use the workspace's default saved key (hosted model if none is saved). Hosted tiers: "browsa", "browsa-fast", "browsa-smart".`
|
|
276
|
+
},
|
|
277
|
+
reasoning: REASONING_PROP,
|
|
278
|
+
llm_key_id: { type: "string", description: "Id of a saved LLM key (see list_llm_keys). Optional." },
|
|
279
|
+
llm_api_key: {
|
|
280
|
+
type: "string",
|
|
281
|
+
description: "Per-schedule LLM key. Rarely needed: prefer a saved key. Overrides llm_key_id."
|
|
282
|
+
},
|
|
162
283
|
country: { type: "string", description: "2-letter egress country." },
|
|
163
284
|
max_steps: { type: "integer", description: "Max agent steps per run." },
|
|
164
285
|
initial_url: { type: "string", description: "Optional pre-navigation URL." }
|
|
@@ -170,6 +291,16 @@ var tools = [
|
|
|
170
291
|
description: "List this workspace's scheduled tasks (id, task, interval, next run, run count). Secrets redacted.",
|
|
171
292
|
inputSchema: { type: "object", properties: {} }
|
|
172
293
|
},
|
|
294
|
+
{
|
|
295
|
+
name: "list_llm_keys",
|
|
296
|
+
description: "List the LLM provider keys saved in this workspace: id, name, provider, masked key (prefix + last 4), whether it is the default for its provider, and its status (valid, invalid or unchecked). Never returns a secret. Pass an id as llm_key_id to run_task or create_schedule. Keys are added at " + LLM_KEYS_URL + ".",
|
|
297
|
+
inputSchema: { type: "object", properties: {} }
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "list_models",
|
|
301
|
+
description: "List the hosted tiers (browsa, browsa-fast, browsa-smart: the model each runs on, its default reasoning and credits per task) and the providers a saved or per-task LLM key can be for. Read-only and free.",
|
|
302
|
+
inputSchema: { type: "object", properties: {} }
|
|
303
|
+
},
|
|
173
304
|
{
|
|
174
305
|
name: "list_job_files",
|
|
175
306
|
description: "List the output files a task wrote \u2014 extracted data + a session.gif recording. Returns name + size per file.",
|
|
@@ -193,39 +324,198 @@ function fail(message, extra) {
|
|
|
193
324
|
content: [{ type: "text", text: JSON.stringify(body, null, 2) }]
|
|
194
325
|
};
|
|
195
326
|
}
|
|
327
|
+
function chooseLlm(args) {
|
|
328
|
+
const llm = args.llm ?? DEFAULT_LLM;
|
|
329
|
+
const tier = String(llm ?? "").trim().toLowerCase();
|
|
330
|
+
if (tier === "browsa" || tier.startsWith("browsa-")) return { llm: tier, source: "hosted" };
|
|
331
|
+
if (args.llm_api_key) return { llm: llm ?? BYOK_DEFAULT_LLM, llmApiKey: args.llm_api_key, source: "per_task" };
|
|
332
|
+
if (args.llm_key_id) return { llm, llmKeyId: args.llm_key_id, source: "saved" };
|
|
333
|
+
if (DEFAULT_LLM_KEY) return { llm: llm ?? BYOK_DEFAULT_LLM, llmApiKey: DEFAULT_LLM_KEY, source: "per_task" };
|
|
334
|
+
if (DEFAULT_LLM_KEY_ID) return { llm, llmKeyId: DEFAULT_LLM_KEY_ID, source: "saved" };
|
|
335
|
+
return { llm, source: "default" };
|
|
336
|
+
}
|
|
337
|
+
var HOSTED = { llm: "browsa", source: "hosted" };
|
|
338
|
+
var NO_KEY_HELP = `No LLM key for this task: the workspace has no default saved key for this model's provider. Save a key at ${LLM_KEYS_URL} (the first key of a provider becomes its default), or set BROWSA_LLM_API_KEY in the MCP env, or pass llm:"browsa" to run on Browsa's hosted model.`;
|
|
339
|
+
var HOSTED_FALLBACK_TASK_NOTE = `No saved LLM key found, so this ran on Browsa's hosted model (adds credits per task; see list_models). Save a key at ${LLM_KEYS_URL} to use your own.`;
|
|
340
|
+
var HOSTED_FALLBACK_SCHEDULE_NOTE = `No saved LLM key found, so this schedule runs on Browsa's hosted model (adds credits per run; see list_models). Save a key at ${LLM_KEYS_URL} and create the schedule again to use your own.`;
|
|
341
|
+
function canFallBackToHosted(e, choice) {
|
|
342
|
+
if (choice.source !== "default" || choice.llm !== void 0) return false;
|
|
343
|
+
return e.status === 400 && e.code === "LLM_KEY_REQUIRED" || e.status === 503 && e.code === "LLM_KEYS_UNAVAILABLE";
|
|
344
|
+
}
|
|
345
|
+
async function submitWithHostedFallback(choice, submit) {
|
|
346
|
+
try {
|
|
347
|
+
return { result: await submit(choice), fellBack: false };
|
|
348
|
+
} catch (e) {
|
|
349
|
+
if (e instanceof BrowsaError && canFallBackToHosted(e, choice)) {
|
|
350
|
+
return { result: await submit(HOSTED), fellBack: true };
|
|
351
|
+
}
|
|
352
|
+
throw e;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function llmKeyError(e, choice) {
|
|
356
|
+
const extra = { code: e.code, status: e.status, request_id: e.requestId, server_error: e.message };
|
|
357
|
+
if (choice.source === "hosted" || choice.source === "per_task") return null;
|
|
358
|
+
switch (e.code) {
|
|
359
|
+
case "LLM_KEY_REQUIRED":
|
|
360
|
+
return fail(NO_KEY_HELP, extra);
|
|
361
|
+
case "LLM_KEY_NOT_FOUND":
|
|
362
|
+
return fail(`Saved LLM key ${choice.llmKeyId} was not found in this workspace. Call list_llm_keys to see the saved keys.`, extra);
|
|
363
|
+
case "LLM_KEY_REJECTED":
|
|
364
|
+
return fail(`The provider rejected the saved LLM key. Rotate it at ${LLM_KEYS_URL}, or pick another key with llm_key_id.`, extra);
|
|
365
|
+
case "LLM_KEY_PROVIDER_MISMATCH":
|
|
366
|
+
return fail("The saved LLM key is for a different provider than llm. Omit llm to use the key's default model, or pick a matching model.", extra);
|
|
367
|
+
case "LLM_MODEL_REQUIRED":
|
|
368
|
+
return fail("This saved key is an OpenAI-compatible key, so the model must be named: pass llm with the model id your endpoint serves.", extra);
|
|
369
|
+
case "LLM_KEYS_UNAVAILABLE":
|
|
370
|
+
return fail(
|
|
371
|
+
`Saved LLM keys are not available on this Browsa server. Set BROWSA_LLM_API_KEY in the MCP env, pass llm_api_key, or pass llm:"browsa" to run on Browsa's hosted model.`,
|
|
372
|
+
extra
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
async function proxyNetwork() {
|
|
378
|
+
const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
379
|
+
const resp = await fetch(`${base}/v1/proxy-network`, {
|
|
380
|
+
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.0" }
|
|
381
|
+
});
|
|
382
|
+
const body = await resp.json().catch(() => ({}));
|
|
383
|
+
if (resp.status === 404) return { enabled: false, tiers: [] };
|
|
384
|
+
if (!resp.ok) {
|
|
385
|
+
throw new BrowsaError(body?.error || `HTTP ${resp.status}`, { code: body?.code, requestId: body?.request_id, status: resp.status });
|
|
386
|
+
}
|
|
387
|
+
const tiers = body?.enabled === true && Array.isArray(body?.tiers) ? body.tiers : [];
|
|
388
|
+
return {
|
|
389
|
+
enabled: body?.enabled === true,
|
|
390
|
+
tiers: tiers.map((t) => ({
|
|
391
|
+
network: t?.network,
|
|
392
|
+
credits_per_gb: t?.credits_per_gb,
|
|
393
|
+
mb_per_credit: t?.mb_per_credit,
|
|
394
|
+
countries: Array.isArray(t?.countries) ? t.countries : []
|
|
395
|
+
}))
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
function proxyUsage(raw) {
|
|
399
|
+
if (!raw || typeof raw.proxy_network !== "string" || !raw.proxy_network) return {};
|
|
400
|
+
return { proxy_network: raw.proxy_network, proxy_bytes: raw.proxy_bytes ?? 0, proxy_credits: raw.proxy_credits ?? 0 };
|
|
401
|
+
}
|
|
402
|
+
async function apiGet(path) {
|
|
403
|
+
const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
404
|
+
const resp = await fetch(`${base}${path}`, {
|
|
405
|
+
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.0" }
|
|
406
|
+
});
|
|
407
|
+
const body = await resp.json().catch(() => ({}));
|
|
408
|
+
if (!resp.ok) {
|
|
409
|
+
throw new BrowsaError(body?.error || `HTTP ${resp.status}`, { code: body?.code, requestId: body?.request_id, status: resp.status });
|
|
410
|
+
}
|
|
411
|
+
return body;
|
|
412
|
+
}
|
|
413
|
+
async function apiPost(path, payload, timeoutMs = 9e4) {
|
|
414
|
+
const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
415
|
+
const resp = await fetch(`${base}${path}`, {
|
|
416
|
+
method: "POST",
|
|
417
|
+
headers: {
|
|
418
|
+
"X-API-Key": API_KEY,
|
|
419
|
+
Accept: "application/json",
|
|
420
|
+
"Content-Type": "application/json",
|
|
421
|
+
"User-Agent": "browsa-mcp/0.3.0"
|
|
422
|
+
},
|
|
423
|
+
body: JSON.stringify(payload),
|
|
424
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
425
|
+
});
|
|
426
|
+
const body = await resp.json().catch(() => ({}));
|
|
427
|
+
if (!resp.ok) {
|
|
428
|
+
throw new BrowsaError(body?.error || `HTTP ${resp.status}`, { code: body?.code, requestId: body?.request_id, status: resp.status });
|
|
429
|
+
}
|
|
430
|
+
return body;
|
|
431
|
+
}
|
|
432
|
+
var pageSessions = /* @__PURE__ */ new Map();
|
|
433
|
+
async function pageCall(route, args) {
|
|
434
|
+
const { browser_id, ...body } = args;
|
|
435
|
+
const seen = pageSessions.get(browser_id);
|
|
436
|
+
const session = seen ? seen.tabs.get(body.tab ?? seen.last) : void 0;
|
|
437
|
+
if (session) body.session = session;
|
|
438
|
+
const r = await apiPost(`/v1/agents/${encodeURIComponent(browser_id)}/${route}`, body);
|
|
439
|
+
if (r?.tab && r?.session) {
|
|
440
|
+
const next = seen ?? { last: "", tabs: /* @__PURE__ */ new Map() };
|
|
441
|
+
next.last = r.tab;
|
|
442
|
+
next.tabs.set(r.tab, r.session);
|
|
443
|
+
pageSessions.set(browser_id, next);
|
|
444
|
+
}
|
|
445
|
+
let text = r?.text ?? "";
|
|
446
|
+
if (Array.isArray(r?.tabs) && r.tabs.length > 1) {
|
|
447
|
+
text += "\ntabs: " + r.tabs.map((t) => `${t.id} ${JSON.stringify(t.title || t.url || "")}${t.active ? " (this one)" : ""}`).join(" | ");
|
|
448
|
+
}
|
|
449
|
+
return text;
|
|
450
|
+
}
|
|
451
|
+
async function listModels() {
|
|
452
|
+
const body = await apiGet("/v1/models");
|
|
453
|
+
return { hosted: body?.hosted ?? [], own_key: body?.own_key ?? {} };
|
|
454
|
+
}
|
|
455
|
+
function llmResultFields(job) {
|
|
456
|
+
const r = job.raw?.result;
|
|
457
|
+
if (!r || typeof r !== "object") return {};
|
|
458
|
+
return { llm_tier: r.llm_tier, reasoning: r.reasoning, usage: r.usage, llm_cost_usd: r.llm_cost_usd };
|
|
459
|
+
}
|
|
460
|
+
async function listLlmKeys() {
|
|
461
|
+
const body = await apiGet("/v1/llm-keys");
|
|
462
|
+
return {
|
|
463
|
+
llm_keys: (body?.llm_keys ?? []).map((k) => ({
|
|
464
|
+
id: k.id,
|
|
465
|
+
name: k.name,
|
|
466
|
+
provider: k.provider,
|
|
467
|
+
masked: k.masked,
|
|
468
|
+
base_url: k.base_url ?? null,
|
|
469
|
+
is_default: !!k.is_default,
|
|
470
|
+
status: k.status,
|
|
471
|
+
status_detail: k.status_detail,
|
|
472
|
+
status_message: k.status_message,
|
|
473
|
+
last_validated_at: k.last_validated_at ?? null,
|
|
474
|
+
last_used_at: k.last_used_at ?? null
|
|
475
|
+
})),
|
|
476
|
+
limit: body?.limit,
|
|
477
|
+
manage_at: LLM_KEYS_URL
|
|
478
|
+
};
|
|
479
|
+
}
|
|
196
480
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
197
481
|
const name = req.params.name;
|
|
198
482
|
const args = req.params.arguments ?? {};
|
|
483
|
+
let choice = null;
|
|
199
484
|
try {
|
|
200
485
|
switch (name) {
|
|
201
486
|
case "run_task": {
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
});
|
|
487
|
+
choice = chooseLlm(args);
|
|
488
|
+
const { result: job, fellBack } = await submitWithHostedFallback(
|
|
489
|
+
choice,
|
|
490
|
+
(c) => client.runTask({
|
|
491
|
+
task: args.task,
|
|
492
|
+
// Omitted fields are dropped from the request body.
|
|
493
|
+
llm: c.llm,
|
|
494
|
+
llmApiKey: c.llmApiKey,
|
|
495
|
+
llmKeyId: c.llmKeyId,
|
|
496
|
+
reasoning: args.reasoning,
|
|
497
|
+
country: args.country ?? DEFAULT_COUNTRY,
|
|
498
|
+
maxSteps: args.max_steps,
|
|
499
|
+
initialUrl: args.initial_url,
|
|
500
|
+
ja3Profile: args.ja3_profile,
|
|
501
|
+
profileId: args.profile_id,
|
|
502
|
+
timeoutMs: (args.timeout_minutes ?? 10) * 6e4
|
|
503
|
+
})
|
|
504
|
+
);
|
|
221
505
|
return ok({
|
|
506
|
+
...fellBack ? { note: HOSTED_FALLBACK_TASK_NOTE, llm: "browsa" } : {},
|
|
222
507
|
job_id: job.id,
|
|
223
508
|
status: job.status,
|
|
224
509
|
steps: `${job.stepCount}/${job.progressTotal}`,
|
|
225
510
|
live_url: job.liveUrl,
|
|
226
511
|
credits_charged: job.creditsCharged,
|
|
512
|
+
...proxyUsage(job.raw),
|
|
513
|
+
llm_key_masked: job.raw?.llm_key_masked,
|
|
514
|
+
llm_key_source: job.raw?.llm_key_source,
|
|
515
|
+
...llmResultFields(job),
|
|
227
516
|
final_result: job.finalResult,
|
|
228
|
-
error: job.errorMessage
|
|
517
|
+
error: job.errorMessage,
|
|
518
|
+
error_code: job.errorCode
|
|
229
519
|
});
|
|
230
520
|
}
|
|
231
521
|
case "get_job": {
|
|
@@ -236,8 +526,11 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
236
526
|
steps: `${job.stepCount}/${job.progressTotal}`,
|
|
237
527
|
live_url: job.liveUrl,
|
|
238
528
|
input_question: job.inputQuestion,
|
|
529
|
+
...llmResultFields(job),
|
|
239
530
|
final_result: job.finalResult,
|
|
240
|
-
error: job.errorMessage
|
|
531
|
+
error: job.errorMessage,
|
|
532
|
+
error_code: job.errorCode,
|
|
533
|
+
...proxyUsage(job.raw)
|
|
241
534
|
});
|
|
242
535
|
}
|
|
243
536
|
case "cancel_job": {
|
|
@@ -248,6 +541,38 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
248
541
|
const job = await client.respondToJob(args.job_id, args.response);
|
|
249
542
|
return ok({ job_id: job.id, status: job.status });
|
|
250
543
|
}
|
|
544
|
+
case "start_browser": {
|
|
545
|
+
const a = await client.createAgent({
|
|
546
|
+
ttl: args.ttl ?? "10m",
|
|
547
|
+
country: args.country ?? DEFAULT_COUNTRY,
|
|
548
|
+
osType: args.os_type,
|
|
549
|
+
agent_id: args.profile_id,
|
|
550
|
+
proxy: args.proxy
|
|
551
|
+
});
|
|
552
|
+
return ok({
|
|
553
|
+
browser_id: a.id,
|
|
554
|
+
status: a.status,
|
|
555
|
+
// Connect with playwright.chromium.connect_over_cdp(cdp_http,
|
|
556
|
+
// headers={"X-API-Key": <your key>}); cdp_url is the page socket.
|
|
557
|
+
cdp_http: a.cdp_http,
|
|
558
|
+
cdp_url: a.cdp_url,
|
|
559
|
+
live_url: a.live_url,
|
|
560
|
+
expires_at: a.expires_at,
|
|
561
|
+
credits_charged: a.cost_credits,
|
|
562
|
+
...proxyUsage(a),
|
|
563
|
+
egress: args.proxy?.network ? `Browsa ${args.proxy.network} proxy network` : args.proxy ? "your proxy" : "Browsa's data-center IP",
|
|
564
|
+
note: "Call stop_browser with this browser_id when you are done."
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
case "stop_browser":
|
|
568
|
+
await client.destroyAgent(args.browser_id);
|
|
569
|
+
return ok({ stopped: args.browser_id });
|
|
570
|
+
case "observe":
|
|
571
|
+
return ok(await pageCall("observe", args));
|
|
572
|
+
case "act":
|
|
573
|
+
return ok(await pageCall("act", args));
|
|
574
|
+
case "list_browsers":
|
|
575
|
+
return ok(await client.listIdentities());
|
|
251
576
|
case "credits":
|
|
252
577
|
return ok(await client.credits());
|
|
253
578
|
case "list_webhooks":
|
|
@@ -258,27 +583,33 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
258
583
|
await client.deleteWebhook(args.webhook_id);
|
|
259
584
|
return ok({ deleted: args.webhook_id });
|
|
260
585
|
case "list_identities":
|
|
261
|
-
return ok(await client.listIdentities());
|
|
586
|
+
return ok((await client.listIdentities()).filter((a) => a.mode === "persistent"));
|
|
262
587
|
case "create_schedule": {
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
588
|
+
choice = chooseLlm(args);
|
|
589
|
+
const { result: s, fellBack } = await submitWithHostedFallback(
|
|
590
|
+
choice,
|
|
591
|
+
(c) => client.createSchedule({
|
|
592
|
+
name: args.name,
|
|
593
|
+
task: args.task,
|
|
594
|
+
llm: c.llm,
|
|
595
|
+
llmApiKey: c.llmApiKey,
|
|
596
|
+
llmKeyId: c.llmKeyId,
|
|
597
|
+
reasoning: args.reasoning,
|
|
598
|
+
intervalSeconds: args.interval_seconds,
|
|
599
|
+
country: args.country ?? DEFAULT_COUNTRY,
|
|
600
|
+
maxSteps: args.max_steps,
|
|
601
|
+
initialUrl: args.initial_url
|
|
602
|
+
})
|
|
603
|
+
);
|
|
604
|
+
return ok({
|
|
605
|
+
...fellBack ? { note: HOSTED_FALLBACK_SCHEDULE_NOTE, llm: "browsa" } : {},
|
|
606
|
+
id: s.id,
|
|
607
|
+
name: s.name,
|
|
608
|
+
interval_seconds: s.intervalSeconds,
|
|
609
|
+
enabled: s.enabled,
|
|
610
|
+
next_run_at: s.nextRunAt,
|
|
611
|
+
llm_key_id: s.raw?.llm_key_id
|
|
280
612
|
});
|
|
281
|
-
return ok({ id: s.id, name: s.name, interval_seconds: s.intervalSeconds, enabled: s.enabled, next_run_at: s.nextRunAt });
|
|
282
613
|
}
|
|
283
614
|
case "list_schedules":
|
|
284
615
|
return ok(
|
|
@@ -287,6 +618,7 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
287
618
|
name: s.name,
|
|
288
619
|
task: s.task,
|
|
289
620
|
llm: s.llm,
|
|
621
|
+
reasoning: s.raw?.reasoning ?? void 0,
|
|
290
622
|
interval_seconds: s.intervalSeconds,
|
|
291
623
|
enabled: s.enabled,
|
|
292
624
|
next_run_at: s.nextRunAt,
|
|
@@ -295,11 +627,19 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
295
627
|
);
|
|
296
628
|
case "list_job_files":
|
|
297
629
|
return ok(await client.listJobFiles(args.job_id));
|
|
630
|
+
case "list_llm_keys":
|
|
631
|
+
return ok(await listLlmKeys());
|
|
632
|
+
case "proxy_network":
|
|
633
|
+
return ok(await proxyNetwork());
|
|
634
|
+
case "list_models":
|
|
635
|
+
return ok(await listModels());
|
|
298
636
|
default:
|
|
299
637
|
return fail(`unknown tool: ${name}`);
|
|
300
638
|
}
|
|
301
639
|
} catch (e) {
|
|
302
640
|
if (e instanceof BrowsaError) {
|
|
641
|
+
const keyErr = choice ? llmKeyError(e, choice) : null;
|
|
642
|
+
if (keyErr) return keyErr;
|
|
303
643
|
return fail(e.message, {
|
|
304
644
|
code: e.code,
|
|
305
645
|
status: e.status,
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browsa/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"mcpName": "io.browsa/browsa",
|
|
5
|
+
"description": "MCP server for Browsa: drive real cloud browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"author": "Browsa <support@browsa.io>",
|
|
7
8
|
"homepage": "https://browsa.io",
|
|
8
9
|
"bugs": {
|
|
10
|
+
"url": "https://github.com/browsa-io/browsa/issues",
|
|
9
11
|
"email": "support@browsa.io"
|
|
10
12
|
},
|
|
11
13
|
"keywords": [
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
"cursor",
|
|
16
18
|
"anthropic",
|
|
17
19
|
"browser-automation",
|
|
18
|
-
"
|
|
20
|
+
"real-browser",
|
|
19
21
|
"ai-agents",
|
|
20
22
|
"browser-use"
|
|
21
23
|
],
|
|
@@ -39,12 +41,17 @@
|
|
|
39
41
|
"start": "node dist/server.js"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|
|
42
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
43
|
-
"browsa": "^0.
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
45
|
+
"browsa": "^0.3.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@types/node": "^20",
|
|
47
49
|
"tsup": "^8",
|
|
48
50
|
"typescript": "^5"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/browsa-io/browsa.git",
|
|
55
|
+
"directory": "browsa-mcp"
|
|
49
56
|
}
|
|
50
57
|
}
|