@browsa/mcp 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/server.js +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**Drive real browsers from Claude Desktop, Cursor, Cline, and any MCP-compatible client.**
|
|
9
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
|
|
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.
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/@browsa/mcp)
|
|
13
13
|
|
|
@@ -111,7 +111,7 @@ When the job has them, `run_task` and `get_job` results include `usage` (`input_
|
|
|
111
111
|
| `run_task` | Run a browser-driven task. Returns the final result, `outcome` and steps. Optional `llm`, `reasoning`, `llm_key_id`. |
|
|
112
112
|
| `get_job` | Poll a long-running task. Optional server-side `wait_seconds`. |
|
|
113
113
|
| `cancel_job` | Cancel a running task. |
|
|
114
|
-
| `respond_to_job` | Answer an `input_required` prompt (
|
|
114
|
+
| `respond_to_job` | Answer an `input_required` prompt (a decision, or a CAPTCHA the task could not solve itself: see https://browsa.io/captcha). |
|
|
115
115
|
| `start_browser` | Start a real cloud browser and get its CDP URL, to drive yourself with Playwright or Puppeteer. |
|
|
116
116
|
| `stop_browser` | Stop a browser from `start_browser` and release it. |
|
|
117
117
|
| `proxy_network` | Whether Browsa's built-in proxy network is on, its tiers, countries and price. Read-only and free. |
|
package/dist/server.js
CHANGED
|
@@ -16,17 +16,14 @@ var DEFAULT_LLM_KEY = process.env.BROWSA_LLM_API_KEY || void 0;
|
|
|
16
16
|
var DEFAULT_LLM_KEY_ID = process.env.BROWSA_LLM_KEY_ID || void 0;
|
|
17
17
|
var DEFAULT_COUNTRY = process.env.BROWSA_COUNTRY;
|
|
18
18
|
var LLM_KEYS_URL = "https://app.browsa.io/dashboard/llm-keys";
|
|
19
|
+
var NO_KEY_MESSAGE = "BROWSA_API_KEY is not set. Add it to this MCP server's env (mint one at https://app.browsa.io/dashboard/keys), then restart the server.";
|
|
19
20
|
if (!API_KEY) {
|
|
20
|
-
console.error("[browsa-mcp] BROWSA_API_KEY
|
|
21
|
+
console.error("[browsa-mcp] BROWSA_API_KEY is not set: tools are listed, but every call will fail until it is.");
|
|
21
22
|
console.error(" Mint one at https://app.browsa.io/dashboard/keys");
|
|
22
|
-
process.exit(2);
|
|
23
23
|
}
|
|
24
|
-
var client = new Client({
|
|
25
|
-
apiKey: API_KEY,
|
|
26
|
-
...BASE_URL ? { baseUrl: BASE_URL } : {}
|
|
27
|
-
});
|
|
24
|
+
var client = API_KEY ? new Client({ apiKey: API_KEY, ...BASE_URL ? { baseUrl: BASE_URL } : {} }) : null;
|
|
28
25
|
var server = new Server(
|
|
29
|
-
{ name: "browsa", version: "0.3.
|
|
26
|
+
{ name: "browsa", version: "0.3.3" },
|
|
30
27
|
{ capabilities: { tools: {} } }
|
|
31
28
|
);
|
|
32
29
|
var REASONING_PROP = {
|
|
@@ -37,7 +34,7 @@ var REASONING_PROP = {
|
|
|
37
34
|
var tools = [
|
|
38
35
|
{
|
|
39
36
|
name: "run_task",
|
|
40
|
-
description: "Run a browser-driven AI task on a fresh
|
|
37
|
+
description: "Run a browser-driven AI task on a fresh Phantom cloud browser. Returns the final result, the outcome and the total steps. `status: completed` only means the run ended: read `outcome`. `outcome: failed` with `status: completed` means the agent finished but could not do the task, and `final_result` says what stopped it. 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 Phantom browser with built-in CAPTCHA solving (Turnstile, hCaptcha, reCAPTCHA, ALTCHA, FunCaptcha) and behavioral humanization. Default timeout: 10 minutes.",
|
|
41
38
|
inputSchema: {
|
|
42
39
|
type: "object",
|
|
43
40
|
required: ["task"],
|
|
@@ -377,7 +374,7 @@ function llmKeyError(e, choice) {
|
|
|
377
374
|
async function proxyNetwork() {
|
|
378
375
|
const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
379
376
|
const resp = await fetch(`${base}/v1/proxy-network`, {
|
|
380
|
-
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.
|
|
377
|
+
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.3" }
|
|
381
378
|
});
|
|
382
379
|
const body = await resp.json().catch(() => ({}));
|
|
383
380
|
if (resp.status === 404) return { enabled: false, tiers: [] };
|
|
@@ -402,7 +399,7 @@ function proxyUsage(raw) {
|
|
|
402
399
|
async function apiGet(path) {
|
|
403
400
|
const base = (BASE_URL || "https://browsa.io").replace(/\/+$/, "");
|
|
404
401
|
const resp = await fetch(`${base}${path}`, {
|
|
405
|
-
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.
|
|
402
|
+
headers: { "X-API-Key": API_KEY, Accept: "application/json", "User-Agent": "browsa-mcp/0.3.3" }
|
|
406
403
|
});
|
|
407
404
|
const body = await resp.json().catch(() => ({}));
|
|
408
405
|
if (!resp.ok) {
|
|
@@ -418,7 +415,7 @@ async function apiPost(path, payload, timeoutMs = 9e4) {
|
|
|
418
415
|
"X-API-Key": API_KEY,
|
|
419
416
|
Accept: "application/json",
|
|
420
417
|
"Content-Type": "application/json",
|
|
421
|
-
"User-Agent": "browsa-mcp/0.3.
|
|
418
|
+
"User-Agent": "browsa-mcp/0.3.3"
|
|
422
419
|
},
|
|
423
420
|
body: JSON.stringify(payload),
|
|
424
421
|
signal: AbortSignal.timeout(timeoutMs)
|
|
@@ -488,6 +485,9 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
488
485
|
const name = req.params.name;
|
|
489
486
|
const args = req.params.arguments ?? {};
|
|
490
487
|
let choice = null;
|
|
488
|
+
if (!API_KEY) {
|
|
489
|
+
return { content: [{ type: "text", text: NO_KEY_MESSAGE }], isError: true };
|
|
490
|
+
}
|
|
491
491
|
try {
|
|
492
492
|
switch (name) {
|
|
493
493
|
case "run_task": {
|
package/package.json
CHANGED