mcp-scraper 0.3.9 → 0.3.10
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 +4 -3
- package/dist/bin/api-server.cjs +109 -1
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +1 -1
- package/dist/bin/browser-agent-stdio-server.cjs +97 -25
- package/dist/bin/browser-agent-stdio-server.cjs.map +1 -1
- package/dist/bin/browser-agent-stdio-server.js +2 -2
- package/dist/bin/mcp-scraper-cli.cjs +1 -1
- package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-combined-stdio-server.cjs +103 -31
- package/dist/bin/mcp-scraper-combined-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-scraper-combined-stdio-server.js +4 -4
- package/dist/bin/mcp-scraper-install.cjs +7 -7
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +2 -2
- package/dist/bin/mcp-stdio-server.cjs +1 -1
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +2 -2
- package/dist/{chunk-KDKQ5Y7V.js → chunk-CED7X4WB.js} +2 -2
- package/dist/{chunk-ELI6NDEG.js → chunk-KPXMPAJ3.js} +7 -7
- package/dist/chunk-KPXMPAJ3.js.map +1 -0
- package/dist/chunk-NEGW2ZEJ.js +7 -0
- package/dist/chunk-NEGW2ZEJ.js.map +1 -0
- package/dist/{chunk-BRUVQRJK.js → chunk-QPFF3V2R.js} +98 -26
- package/dist/chunk-QPFF3V2R.js.map +1 -0
- package/dist/{server-ZSHE4R5Z.js → server-QTV2EUKA.js} +111 -3
- package/dist/{server-ZSHE4R5Z.js.map → server-QTV2EUKA.js.map} +1 -1
- package/docs/mcp-tool-craft-lint.generated.md +3 -2
- package/docs/mcp-tool-manifest.generated.json +43 -13
- package/package.json +1 -1
- package/dist/chunk-7VNTN4Q7.js +0 -7
- package/dist/chunk-7VNTN4Q7.js.map +0 -1
- package/dist/chunk-BRUVQRJK.js.map +0 -1
- package/dist/chunk-ELI6NDEG.js.map +0 -1
- /package/dist/{chunk-KDKQ5Y7V.js.map → chunk-CED7X4WB.js.map} +0 -0
|
@@ -99,7 +99,7 @@ import {
|
|
|
99
99
|
harvestTimeoutBudget,
|
|
100
100
|
liveWebToolAnnotations,
|
|
101
101
|
outputBaseDir
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-CED7X4WB.js";
|
|
103
103
|
import {
|
|
104
104
|
CaptchaError,
|
|
105
105
|
RECAPTCHA_INSTRUCTIONS,
|
|
@@ -132,7 +132,7 @@ import {
|
|
|
132
132
|
RawMapsOverviewSchema,
|
|
133
133
|
RawMapsReviewStatsSchema
|
|
134
134
|
} from "./chunk-LFATOGDF.js";
|
|
135
|
-
import "./chunk-
|
|
135
|
+
import "./chunk-NEGW2ZEJ.js";
|
|
136
136
|
|
|
137
137
|
// src/api/outbound-sanitize.ts
|
|
138
138
|
var KEY_RENAMES = {
|
|
@@ -14301,10 +14301,68 @@ async function ensureProfile(k, name) {
|
|
|
14301
14301
|
if (!isProfileConflict(err)) throw err;
|
|
14302
14302
|
}
|
|
14303
14303
|
}
|
|
14304
|
+
function profileConnectionMatches(connection, profileName, domain) {
|
|
14305
|
+
if (!connection || typeof connection !== "object") return false;
|
|
14306
|
+
const data = connection;
|
|
14307
|
+
return data.profile_name === profileName && data.domain === domain;
|
|
14308
|
+
}
|
|
14309
|
+
async function findProfileConnection(k, profileName, domain) {
|
|
14310
|
+
for await (const connection of k.auth.connections.list({ profile_name: profileName, domain })) {
|
|
14311
|
+
if (profileConnectionMatches(connection, profileName, domain)) return connection;
|
|
14312
|
+
}
|
|
14313
|
+
return null;
|
|
14314
|
+
}
|
|
14315
|
+
async function findOrCreateProfileConnection(k, opts) {
|
|
14316
|
+
try {
|
|
14317
|
+
return await k.auth.connections.create({
|
|
14318
|
+
domain: opts.domain,
|
|
14319
|
+
profile_name: opts.profileName,
|
|
14320
|
+
...opts.loginUrl ? { login_url: opts.loginUrl } : {}
|
|
14321
|
+
});
|
|
14322
|
+
} catch (err) {
|
|
14323
|
+
if (!isProfileConflict(err)) throw err;
|
|
14324
|
+
const existing = await findProfileConnection(k, opts.profileName, opts.domain);
|
|
14325
|
+
if (existing) return existing;
|
|
14326
|
+
throw err;
|
|
14327
|
+
}
|
|
14328
|
+
}
|
|
14329
|
+
function profileOnboardResult(connection, hostedUrl = null, liveViewUrl = null) {
|
|
14330
|
+
return {
|
|
14331
|
+
connectionId: String(connection.id),
|
|
14332
|
+
profileName: String(connection.profile_name),
|
|
14333
|
+
domain: String(connection.domain),
|
|
14334
|
+
status: String(connection.status),
|
|
14335
|
+
flowStatus: typeof connection.flow_status === "string" ? connection.flow_status : null,
|
|
14336
|
+
flowStep: typeof connection.flow_step === "string" ? connection.flow_step : null,
|
|
14337
|
+
flowExpiresAt: typeof connection.flow_expires_at === "string" ? connection.flow_expires_at : null,
|
|
14338
|
+
hostedUrl: hostedUrl ?? (typeof connection.hosted_url === "string" ? connection.hosted_url : null),
|
|
14339
|
+
liveViewUrl: liveViewUrl ?? (typeof connection.live_view_url === "string" ? connection.live_view_url : null),
|
|
14340
|
+
browserSessionId: typeof connection.browser_session_id === "string" ? connection.browser_session_id : null,
|
|
14341
|
+
postLoginUrl: typeof connection.post_login_url === "string" ? connection.post_login_url : null
|
|
14342
|
+
};
|
|
14343
|
+
}
|
|
14304
14344
|
function explicitProxyId(value) {
|
|
14305
14345
|
const trimmed = value?.trim();
|
|
14306
14346
|
return trimmed || void 0;
|
|
14307
14347
|
}
|
|
14348
|
+
async function startProfileOnboarding(opts) {
|
|
14349
|
+
const k = client();
|
|
14350
|
+
const connection = await findOrCreateProfileConnection(k, opts);
|
|
14351
|
+
const login = await k.auth.connections.login(connection.id);
|
|
14352
|
+
const state = await k.auth.connections.retrieve(connection.id);
|
|
14353
|
+
return profileOnboardResult(state, login.hosted_url ?? null, login.live_view_url ?? null);
|
|
14354
|
+
}
|
|
14355
|
+
async function getProfileOnboardingStatus(input) {
|
|
14356
|
+
const k = client();
|
|
14357
|
+
let connection = null;
|
|
14358
|
+
if (input.connectionId) {
|
|
14359
|
+
connection = await k.auth.connections.retrieve(input.connectionId);
|
|
14360
|
+
} else if (input.profileName && input.domain) {
|
|
14361
|
+
connection = await findProfileConnection(k, input.profileName, input.domain);
|
|
14362
|
+
}
|
|
14363
|
+
if (!connection) throw new Error("profile auth connection not found");
|
|
14364
|
+
return profileOnboardResult(connection);
|
|
14365
|
+
}
|
|
14308
14366
|
async function createSession(opts = {}) {
|
|
14309
14367
|
const k = client();
|
|
14310
14368
|
const resolvedProxyId = explicitProxyId(opts.proxyId);
|
|
@@ -14698,6 +14756,56 @@ function buildBrowserAgentRoutes() {
|
|
|
14698
14756
|
return next();
|
|
14699
14757
|
});
|
|
14700
14758
|
app2.use("*", auth);
|
|
14759
|
+
app2.post("/profiles/onboard", async (c) => {
|
|
14760
|
+
const body = await c.req.json().catch(() => ({}));
|
|
14761
|
+
const profileName = typeof body.profile === "string" ? body.profile.trim() : "";
|
|
14762
|
+
const domain = typeof body.domain === "string" ? body.domain.trim().replace(/^https?:\/\//, "").replace(/\/.*$/, "") : "chatgpt.com";
|
|
14763
|
+
const loginUrl = typeof body.login_url === "string" ? body.login_url.trim() : void 0;
|
|
14764
|
+
if (!profileName) return c.json({ error: "profile is required" }, 400);
|
|
14765
|
+
if (!domain) return c.json({ error: "domain is required" }, 400);
|
|
14766
|
+
try {
|
|
14767
|
+
const result = await startProfileOnboarding({ profileName, domain, loginUrl });
|
|
14768
|
+
return c.json({
|
|
14769
|
+
connection_id: result.connectionId,
|
|
14770
|
+
profile: result.profileName,
|
|
14771
|
+
domain: result.domain,
|
|
14772
|
+
status: result.status,
|
|
14773
|
+
flow_status: result.flowStatus,
|
|
14774
|
+
flow_step: result.flowStep,
|
|
14775
|
+
flow_expires_at: result.flowExpiresAt,
|
|
14776
|
+
hosted_url: result.hostedUrl,
|
|
14777
|
+
live_view_url: result.liveViewUrl,
|
|
14778
|
+
browser_session_id: result.browserSessionId,
|
|
14779
|
+
post_login_url: result.postLoginUrl
|
|
14780
|
+
});
|
|
14781
|
+
} catch (err) {
|
|
14782
|
+
return c.json(failure(err), 502);
|
|
14783
|
+
}
|
|
14784
|
+
});
|
|
14785
|
+
app2.post("/profiles/status", async (c) => {
|
|
14786
|
+
const body = await c.req.json().catch(() => ({}));
|
|
14787
|
+
const connectionId = typeof body.connection_id === "string" ? body.connection_id.trim() : void 0;
|
|
14788
|
+
const profileName = typeof body.profile === "string" ? body.profile.trim() : void 0;
|
|
14789
|
+
const domain = typeof body.domain === "string" ? body.domain.trim().replace(/^https?:\/\//, "").replace(/\/.*$/, "") : void 0;
|
|
14790
|
+
try {
|
|
14791
|
+
const result = await getProfileOnboardingStatus({ connectionId, profileName, domain });
|
|
14792
|
+
return c.json({
|
|
14793
|
+
connection_id: result.connectionId,
|
|
14794
|
+
profile: result.profileName,
|
|
14795
|
+
domain: result.domain,
|
|
14796
|
+
status: result.status,
|
|
14797
|
+
flow_status: result.flowStatus,
|
|
14798
|
+
flow_step: result.flowStep,
|
|
14799
|
+
flow_expires_at: result.flowExpiresAt,
|
|
14800
|
+
hosted_url: result.hostedUrl,
|
|
14801
|
+
live_view_url: result.liveViewUrl,
|
|
14802
|
+
browser_session_id: result.browserSessionId,
|
|
14803
|
+
post_login_url: result.postLoginUrl
|
|
14804
|
+
});
|
|
14805
|
+
} catch (err) {
|
|
14806
|
+
return c.json(failure(err), 404);
|
|
14807
|
+
}
|
|
14808
|
+
});
|
|
14701
14809
|
app2.post("/sessions", async (c) => {
|
|
14702
14810
|
const user = c.get("user");
|
|
14703
14811
|
if (Number(user.balance_mc ?? 0) < BROWSER_OPEN_MIN_BALANCE_MC) {
|
|
@@ -16452,4 +16560,4 @@ app.get("/blog/:slug/", (c) => {
|
|
|
16452
16560
|
export {
|
|
16453
16561
|
app
|
|
16454
16562
|
};
|
|
16455
|
-
//# sourceMappingURL=server-
|
|
16563
|
+
//# sourceMappingURL=server-QTV2EUKA.js.map
|