unbrowse 12.0.0-preview.2 → 12.0.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 +2 -1
- package/SKILL.md +1 -1
- package/dist/cli.js +7 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,8 @@ unbrowse resume <runId> origin=SIN # answer on the same run
|
|
|
18
18
|
| `learn a.har b.har`, `learned [id]` | Teach a site from two recordings |
|
|
19
19
|
| `logins`, `logins remove <origin>` | Saved logins, masked. The CLI never takes a password |
|
|
20
20
|
| `registry [query]`, `site <host>` | Public compiled sites, no account |
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
The CLI is the REST client. The remote MCP is a separate client; see the [install guide](https://github.com/unbrowse-ai/unbrowse-skill/blob/main/docs/install.md).
|
|
22
23
|
|
|
23
24
|
Exit codes: 0 accepted/ok (check status and verified), 1 error, 2 input required, 3 sign-in or saved login needed, 4 not verified.
|
|
24
25
|
Env: `UNBROWSE_API_KEY`, `UNBROWSE_BASE_URL`. Node 18.17+, no dependencies.
|
package/SKILL.md
CHANGED
|
@@ -28,7 +28,7 @@ For automation, supply an API key via `UNBROWSE_API_KEY` using the caller's secr
|
|
|
28
28
|
## Choose the interface
|
|
29
29
|
|
|
30
30
|
- MCP: discovery, runs, page reading, cloud browsing, saved-login requests and live canvas cards.
|
|
31
|
-
- CLI: `unbrowse discover`, `run`, `inspect`, `resume`, `registry
|
|
31
|
+
- CLI: `unbrowse discover`, `run`, `inspect`, `resume`, `registry`. It calls the REST API and is not an MCP client. `unbrowse help` describes the installed version.
|
|
32
32
|
- SDK: REST integration and scripting. Consult the public SDK docs for its supported methods; MCP tools and REST methods are not interchangeable names.
|
|
33
33
|
|
|
34
34
|
Core MCP tools: `unbrowse.discover`, `unbrowse.run`, `unbrowse.inspect`, `unbrowse.resume`, `unbrowse.cancel`, `unbrowse.scrape`, `unbrowse.map`, `unbrowse.sites`, `unbrowse.usage`, `unbrowse.credits`, `unbrowse.forget`, `unbrowse.learn`, `unbrowse.index`, `unbrowse.index.status`, `unbrowse.credentials.list`, `unbrowse.credentials.request`, `unbrowse.credentials.status`, and the cloud browser `unbrowse.browse.open`, `unbrowse.browse.snapshot`, `unbrowse.browse.act`, `unbrowse.browse.finish`, `unbrowse.browse.close`.
|
package/dist/cli.js
CHANGED
|
@@ -47,7 +47,7 @@ async function currentToken(baseUrl, fetchImpl = fetch) {
|
|
|
47
47
|
return;
|
|
48
48
|
if (o.expiresAt && o.refreshToken && Date.now() > o.expiresAt - 60000) {
|
|
49
49
|
try {
|
|
50
|
-
const fresh = await tokenRequest(baseUrl, { grant_type: "refresh_token", refresh_token: o.refreshToken, client_id: o.clientId }, fetchImpl);
|
|
50
|
+
const fresh = await tokenRequest(baseUrl, { grant_type: "refresh_token", refresh_token: o.refreshToken, client_id: o.clientId, resource: apiResource(baseUrl) }, fetchImpl);
|
|
51
51
|
save({ ...stored, oauth: { clientId: o.clientId, ...fresh, refreshToken: fresh.refreshToken ?? o.refreshToken } });
|
|
52
52
|
return fresh.accessToken;
|
|
53
53
|
} catch {
|
|
@@ -71,6 +71,9 @@ function describe(baseUrl) {
|
|
|
71
71
|
function mask(key) {
|
|
72
72
|
return key.length <= 12 ? "…" : `${key.slice(0, 8)}…${key.slice(-4)}`;
|
|
73
73
|
}
|
|
74
|
+
function apiResource(baseUrl) {
|
|
75
|
+
return `${baseUrl.replace(/\/+$/, "")}/api`;
|
|
76
|
+
}
|
|
74
77
|
async function tokenRequest(baseUrl, form, fetchImpl) {
|
|
75
78
|
const res = await fetchImpl(`${baseUrl}/oauth/token`, {
|
|
76
79
|
method: "POST",
|
|
@@ -128,7 +131,7 @@ async function oauthLogin(baseUrl, opts) {
|
|
|
128
131
|
code_challenge_method: "S256",
|
|
129
132
|
state,
|
|
130
133
|
scope: "unbrowse",
|
|
131
|
-
resource:
|
|
134
|
+
resource: apiResource(baseUrl)
|
|
132
135
|
}).toString();
|
|
133
136
|
opts.log(`Opening ${url.origin}/authorize in your browser. If it does not open, visit:
|
|
134
137
|
${url.toString()}`);
|
|
@@ -138,7 +141,7 @@ ${url.toString()}`);
|
|
|
138
141
|
clearTimeout(timer);
|
|
139
142
|
if (!answer.code)
|
|
140
143
|
throw new Error(answer.error ?? "sign-in failed");
|
|
141
|
-
const tokens = await tokenRequest(baseUrl, { grant_type: "authorization_code", code: answer.code, redirect_uri: redirectUri, client_id: client.client_id, code_verifier: verifier }, fetchImpl);
|
|
144
|
+
const tokens = await tokenRequest(baseUrl, { grant_type: "authorization_code", code: answer.code, redirect_uri: redirectUri, client_id: client.client_id, code_verifier: verifier, resource: apiResource(baseUrl) }, fetchImpl);
|
|
142
145
|
save({ baseUrl, oauth: { clientId: client.client_id, ...tokens } });
|
|
143
146
|
} finally {
|
|
144
147
|
server.close();
|
|
@@ -308,16 +311,8 @@ function normalizeHost(site) {
|
|
|
308
311
|
host = new URL(host).hostname;
|
|
309
312
|
return host.replace(/\/.*$/, "").replace(/^www\./, "");
|
|
310
313
|
}
|
|
311
|
-
// ../sdk/src/mcp-install.ts
|
|
312
|
-
function mcpCommands(url) {
|
|
313
|
-
return {
|
|
314
|
-
claudeCode: `claude mcp add --transport http unbrowse ${url}`,
|
|
315
|
-
codex: `codex mcp add unbrowse --url ${url} && codex mcp login unbrowse`,
|
|
316
|
-
json: JSON.stringify({ mcpServers: { unbrowse: { url } } }, null, 2)
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
314
|
// src/cli.ts
|
|
320
|
-
var VERSION = "12.0.
|
|
315
|
+
var VERSION = "12.0.1";
|
|
321
316
|
var DEFAULT_ORIGIN = "https://unbrowse.ai";
|
|
322
317
|
var HELP = `unbrowse ${VERSION} — call websites as APIs through the Unbrowse API
|
|
323
318
|
|
|
@@ -340,7 +335,6 @@ var HELP = `unbrowse ${VERSION} — call websites as APIs through the Unbrowse A
|
|
|
340
335
|
|
|
341
336
|
registry [query] Public compiled sites (no account)
|
|
342
337
|
site <host> One site's tools (no account)
|
|
343
|
-
install Add the Unbrowse MCP to Claude Code, Codex or any client
|
|
344
338
|
|
|
345
339
|
Options: --json (errors as JSON) · --base-url URL · --no-open
|
|
346
340
|
Env: UNBROWSE_API_KEY, UNBROWSE_BASE_URL (default ${DEFAULT_ORIGIN})
|
|
@@ -470,14 +464,6 @@ async function main(argv, io = stdio) {
|
|
|
470
464
|
case "site":
|
|
471
465
|
print(await ub.site(need(rest[0], "site <host>")));
|
|
472
466
|
return 0;
|
|
473
|
-
case "install": {
|
|
474
|
-
const c = mcpCommands(`${origin}/mcp`);
|
|
475
|
-
io.out(`Claude Code: ${c.claudeCode}
|
|
476
|
-
Codex: ${c.codex}
|
|
477
|
-
Other clients:
|
|
478
|
-
${c.json}`);
|
|
479
|
-
return 0;
|
|
480
|
-
}
|
|
481
467
|
default:
|
|
482
468
|
throw new UsageError(`unknown command "${cmd}". Run \`unbrowse help\`.`);
|
|
483
469
|
}
|