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
package/dist/bin/api-server.js
CHANGED
|
@@ -17,7 +17,7 @@ loadDotEnv();
|
|
|
17
17
|
async function main() {
|
|
18
18
|
const [{ serve }, { app }, { startWorker }, { migrate }] = await Promise.all([
|
|
19
19
|
import("@hono/node-server"),
|
|
20
|
-
import("../server-
|
|
20
|
+
import("../server-QTV2EUKA.js"),
|
|
21
21
|
import("../worker-56IXWOQU.js"),
|
|
22
22
|
import("../db-BE4JVB3V.js")
|
|
23
23
|
]);
|
|
@@ -27,7 +27,7 @@ function browserServiceProfileSaveChanges() {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// src/version.ts
|
|
30
|
-
var PACKAGE_VERSION = "0.3.
|
|
30
|
+
var PACKAGE_VERSION = "0.3.10";
|
|
31
31
|
|
|
32
32
|
// src/mcp/browser-agent-tool-schemas.ts
|
|
33
33
|
var import_zod = require("zod");
|
|
@@ -53,10 +53,17 @@ var BrowserOpenInputSchema = {
|
|
|
53
53
|
var BrowserProfileOnboardInputSchema = {
|
|
54
54
|
email: import_zod.z.string().optional().describe("Optional account email used to derive a stable MCP Scraper profile name. This does not import cookies or browser state."),
|
|
55
55
|
profile: import_zod.z.string().optional().describe("Optional saved MCP Scraper hosted browser profile name to create or load. If omitted, email is used to derive one."),
|
|
56
|
-
|
|
56
|
+
domain: import_zod.z.string().optional().describe("Authenticated site domain to connect to the profile. Defaults to chatgpt.com for AI visibility fan-out tracking."),
|
|
57
|
+
login_url: import_zod.z.string().url().optional().describe("Optional login URL for the target domain. Defaults to https://chatgpt.com/ when domain is omitted."),
|
|
58
|
+
url: import_zod.z.string().url().optional().describe("Deprecated alias for login_url. Use login_url for the target site login page."),
|
|
57
59
|
label: import_zod.z.string().optional().describe("Optional human label for this setup session."),
|
|
58
60
|
timeout_seconds: import_zod.z.number().int().min(60).max(259200).optional().describe("How long the direct no-proxy setup session may live before auto-termination. Defaults to 600.")
|
|
59
61
|
};
|
|
62
|
+
var BrowserProfileStatusInputSchema = {
|
|
63
|
+
connection_id: import_zod.z.string().optional().describe("Auth connection id returned by browser_profile_onboard. Prefer this when available."),
|
|
64
|
+
profile: import_zod.z.string().optional().describe("Saved hosted profile name to check when connection_id is unavailable."),
|
|
65
|
+
domain: import_zod.z.string().optional().describe("Authenticated site domain to check with profile. Defaults to chatgpt.com when omitted.")
|
|
66
|
+
};
|
|
60
67
|
var BrowserSessionInputSchema = {
|
|
61
68
|
session_id: import_zod.z.string().describe("The session id returned by browser_open or browser_list_sessions. Use only a returned session_id; do not construct one yourself.")
|
|
62
69
|
};
|
|
@@ -228,15 +235,36 @@ var BrowserOpenOutputSchema = {
|
|
|
228
235
|
var BrowserProfileOnboardOutputSchema = {
|
|
229
236
|
ok: import_zod.z.boolean(),
|
|
230
237
|
tool: import_zod.z.literal("browser_profile_onboard"),
|
|
231
|
-
session_id:
|
|
238
|
+
session_id: NullableString,
|
|
239
|
+
auth_connection_id: import_zod.z.string(),
|
|
232
240
|
watch_url: import_zod.z.string(),
|
|
233
241
|
live_view_url: NullableString,
|
|
234
242
|
profile: import_zod.z.string(),
|
|
243
|
+
domain: import_zod.z.string(),
|
|
235
244
|
setup_url: import_zod.z.string(),
|
|
236
245
|
account_email: NullableString,
|
|
246
|
+
status: import_zod.z.string(),
|
|
247
|
+
flow_status: NullableString,
|
|
248
|
+
flow_step: NullableString,
|
|
249
|
+
flow_expires_at: NullableString,
|
|
250
|
+
post_login_url: NullableString,
|
|
237
251
|
next_steps: import_zod.z.array(import_zod.z.string()),
|
|
238
252
|
raw: BrowserRawObject.optional()
|
|
239
253
|
};
|
|
254
|
+
var BrowserProfileStatusOutputSchema = {
|
|
255
|
+
ok: import_zod.z.boolean(),
|
|
256
|
+
tool: import_zod.z.literal("browser_profile_status"),
|
|
257
|
+
session_id: NullableString,
|
|
258
|
+
auth_connection_id: import_zod.z.string(),
|
|
259
|
+
profile: import_zod.z.string(),
|
|
260
|
+
domain: import_zod.z.string(),
|
|
261
|
+
status: import_zod.z.string(),
|
|
262
|
+
flow_status: NullableString,
|
|
263
|
+
flow_step: NullableString,
|
|
264
|
+
flow_expires_at: NullableString,
|
|
265
|
+
post_login_url: NullableString,
|
|
266
|
+
raw: BrowserRawObject.optional()
|
|
267
|
+
};
|
|
240
268
|
var BrowserScreenshotOutputSchema = {
|
|
241
269
|
...BrowserBaseOutput,
|
|
242
270
|
tool: import_zod.z.literal("browser_screenshot"),
|
|
@@ -643,10 +671,16 @@ function replayFilePath(sessionId, replayId, filename) {
|
|
|
643
671
|
const name = requested ? safeFilePart(requested).replace(/\.mp4$/i, "") : `${stamp}-${safeFilePart(sessionId)}-${safeFilePart(replayId)}`;
|
|
644
672
|
return (0, import_node_path2.join)(outputBaseDir(), "browser-replays", `${name}.mp4`);
|
|
645
673
|
}
|
|
646
|
-
function
|
|
647
|
-
const
|
|
674
|
+
function slugPart(value) {
|
|
675
|
+
const trimmed = value?.trim().toLowerCase();
|
|
676
|
+
if (!trimmed) return null;
|
|
677
|
+
return trimmed.replace(/^https?:\/\//, "").replace(/^www\./, "").replace(/\/.*$/, "").replace(/[^a-z0-9._-]+/g, "-").replace(/[._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
678
|
+
}
|
|
679
|
+
function savedProfileNameFromEmail(email, domain) {
|
|
680
|
+
const value = slugPart(email);
|
|
648
681
|
if (!value) return null;
|
|
649
|
-
|
|
682
|
+
const domainPart = slugPart(domain);
|
|
683
|
+
return `${value}${domainPart ? `-${domainPart}` : ""}`.slice(0, 80) || null;
|
|
650
684
|
}
|
|
651
685
|
function annotatedReplayFilePath(sessionId, replayId, filename) {
|
|
652
686
|
const requested = filename?.trim();
|
|
@@ -737,45 +771,83 @@ function registerBrowserAgentMcpTools(server2, opts) {
|
|
|
737
771
|
"browser_profile_onboard",
|
|
738
772
|
{
|
|
739
773
|
title: "Connect Hosted Browser Profile",
|
|
740
|
-
description: "Create or load a saved MCP Scraper hosted browser profile and
|
|
774
|
+
description: "Create or load a saved MCP Scraper hosted browser profile auth connection and return a user takeover login URL. This is the customer auth setup and reconnect flow for AI visibility tracking: give the user the watch_url, let them complete login for the target domain, then call browser_profile_status until status is AUTHENTICATED. If a saved profile later shows login controls, run this same setup flow again.",
|
|
741
775
|
inputSchema: BrowserProfileOnboardInputSchema,
|
|
742
776
|
outputSchema: BrowserProfileOnboardOutputSchema,
|
|
743
777
|
annotations: annotations("Connect Hosted Browser Profile")
|
|
744
778
|
},
|
|
745
779
|
async (input) => {
|
|
746
|
-
const
|
|
780
|
+
const domain = slugPart(input.domain) || "chatgpt.com";
|
|
781
|
+
const setupUrl = input.login_url ?? input.url ?? (domain === "chatgpt.com" ? "https://chatgpt.com/" : `https://${domain}/`);
|
|
782
|
+
const profile = input.profile?.trim() || savedProfileNameFromEmail(input.email, domain) || browserServiceProfileName();
|
|
747
783
|
if (!profile) {
|
|
748
784
|
return errorResult("browser_profile_onboard", {
|
|
749
785
|
error: "profile or email is required when BROWSER_AGENT_PROFILE_NAME is not available"
|
|
750
786
|
});
|
|
751
787
|
}
|
|
752
|
-
const
|
|
753
|
-
const open = await req("POST", "/agent/sessions", {
|
|
788
|
+
const open = await req("POST", "/agent/profiles/onboard", {
|
|
754
789
|
label: input.label ?? `Profile setup: ${profile}`,
|
|
755
790
|
profile,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
timeout_seconds: input.timeout_seconds,
|
|
759
|
-
url: setupUrl
|
|
791
|
+
domain,
|
|
792
|
+
login_url: setupUrl
|
|
760
793
|
});
|
|
761
794
|
if (!open.ok) return errorResult("browser_profile_onboard", open.data);
|
|
762
|
-
const session = open.data;
|
|
763
795
|
return structuredResult({
|
|
764
796
|
ok: true,
|
|
765
797
|
tool: "browser_profile_onboard",
|
|
766
|
-
session_id:
|
|
767
|
-
|
|
768
|
-
|
|
798
|
+
session_id: null,
|
|
799
|
+
auth_connection_id: open.data.connection_id,
|
|
800
|
+
watch_url: open.data.hosted_url,
|
|
801
|
+
live_view_url: open.data.live_view_url ?? null,
|
|
769
802
|
profile,
|
|
803
|
+
domain,
|
|
770
804
|
setup_url: setupUrl,
|
|
771
805
|
account_email: input.email?.trim() || null,
|
|
806
|
+
status: open.data.status ?? null,
|
|
807
|
+
flow_status: open.data.flow_status ?? null,
|
|
808
|
+
flow_step: open.data.flow_step ?? null,
|
|
809
|
+
flow_expires_at: open.data.flow_expires_at ?? null,
|
|
810
|
+
post_login_url: open.data.post_login_url ?? null,
|
|
772
811
|
next_steps: [
|
|
773
|
-
"Open the watch_url and let the user
|
|
774
|
-
"
|
|
775
|
-
"
|
|
776
|
-
"
|
|
812
|
+
"Open the watch_url and let the user complete login for the target domain.",
|
|
813
|
+
"Call browser_profile_status with auth_connection_id until status is AUTHENTICATED.",
|
|
814
|
+
"After authentication, call browser_open with this profile name and the target site URL.",
|
|
815
|
+
"If the saved profile later shows login controls or disconnects, repeat browser_profile_onboard."
|
|
777
816
|
],
|
|
778
|
-
raw:
|
|
817
|
+
raw: open.data
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
server2.registerTool(
|
|
822
|
+
"browser_profile_status",
|
|
823
|
+
{
|
|
824
|
+
title: "Check Browser Profile Auth Status",
|
|
825
|
+
description: "Check whether a hosted browser profile auth connection is authenticated after browser_profile_onboard. Use auth_connection_id when available. Once status is AUTHENTICATED, use browser_open with the returned profile.",
|
|
826
|
+
inputSchema: BrowserProfileStatusInputSchema,
|
|
827
|
+
outputSchema: BrowserProfileStatusOutputSchema,
|
|
828
|
+
annotations: annotations("Check Browser Profile Auth Status", true)
|
|
829
|
+
},
|
|
830
|
+
async (input) => {
|
|
831
|
+
const domain = slugPart(input.domain) || "chatgpt.com";
|
|
832
|
+
const res = await req("POST", "/agent/profiles/status", {
|
|
833
|
+
...input.connection_id ? { connection_id: input.connection_id } : {},
|
|
834
|
+
...input.profile ? { profile: input.profile } : {},
|
|
835
|
+
domain
|
|
836
|
+
});
|
|
837
|
+
if (!res.ok) return errorResult("browser_profile_status", res.data);
|
|
838
|
+
return structuredResult({
|
|
839
|
+
ok: true,
|
|
840
|
+
tool: "browser_profile_status",
|
|
841
|
+
session_id: null,
|
|
842
|
+
auth_connection_id: res.data.connection_id,
|
|
843
|
+
profile: res.data.profile,
|
|
844
|
+
domain: res.data.domain,
|
|
845
|
+
status: res.data.status,
|
|
846
|
+
flow_status: res.data.flow_status ?? null,
|
|
847
|
+
flow_step: res.data.flow_step ?? null,
|
|
848
|
+
flow_expires_at: res.data.flow_expires_at ?? null,
|
|
849
|
+
post_login_url: res.data.post_login_url ?? null,
|
|
850
|
+
raw: res.data
|
|
779
851
|
});
|
|
780
852
|
}
|
|
781
853
|
);
|
|
@@ -783,7 +855,7 @@ function registerBrowserAgentMcpTools(server2, opts) {
|
|
|
783
855
|
"browser_open",
|
|
784
856
|
{
|
|
785
857
|
title: "Open Browser Session",
|
|
786
|
-
description: "Open a direct no-proxy hosted browser session you can drive. Pass a saved profile name to load an authenticated session for a site. For customer login setup or reconnects, use browser_profile_onboard first
|
|
858
|
+
description: "Open a direct no-proxy hosted browser session you can drive. Pass a saved profile name to load an authenticated session for a site. For customer login setup or reconnects, use browser_profile_onboard first, then call browser_profile_status until status is AUTHENTICATED. Returns a session_id used by all other browser_* tools.",
|
|
787
859
|
inputSchema: BrowserOpenInputSchema,
|
|
788
860
|
outputSchema: BrowserOpenOutputSchema,
|
|
789
861
|
annotations: annotations("Open Browser Session")
|
|
@@ -1205,7 +1277,7 @@ function registerBrowserAgentMcpTools(server2, opts) {
|
|
|
1205
1277
|
"browser_capture_fanout",
|
|
1206
1278
|
{
|
|
1207
1279
|
title: "Capture AI Search Fan-Out",
|
|
1208
|
-
description: `Capture the query fan-out behind a ChatGPT or Claude web-search answer for Answer Engine Optimization (AEO): the exact sub-queries the model issued, every researched URL split into cited vs browsed-only (with citation frequency and snippet), each source tagged by category (First-party/vendor, News/media, Reddit, Social/video, Encyclopedia, Review site, Docs, Blog), plus top sourced sites and citation order. This returns the raw structured data; YOU analyze it \u2014 classify each sub-query by funnel stage (Problem-aware, Solution-aware, Decision-aware, Retention) and type (BoFu, Branded, Comparison, How-to, Search operator), name the brands the model researched, and give AEO insights. Sample asks: "capture the fan-out for this ChatGPT answer", "what did Claude search and cite for best CRM", "show the sub-queries and sources behind this AI answer". WRITE NOTE: passing prompt submits a real message in the user's logged-in account (a new conversation turn) \u2014 only send when the user wants that; omit prompt to capture a prompt the user just ran. Setup, if not already connected or if the profile disconnected: call browser_profile_onboard, give the user the watch_url, let them
|
|
1280
|
+
description: `Capture the query fan-out behind a ChatGPT or Claude web-search answer for Answer Engine Optimization (AEO): the exact sub-queries the model issued, every researched URL split into cited vs browsed-only (with citation frequency and snippet), each source tagged by category (First-party/vendor, News/media, Reddit, Social/video, Encyclopedia, Review site, Docs, Blog), plus top sourced sites and citation order. This returns the raw structured data; YOU analyze it \u2014 classify each sub-query by funnel stage (Problem-aware, Solution-aware, Decision-aware, Retention) and type (BoFu, Branded, Comparison, How-to, Search operator), name the brands the model researched, and give AEO insights. Sample asks: "capture the fan-out for this ChatGPT answer", "what did Claude search and cite for best CRM", "show the sub-queries and sources behind this AI answer". WRITE NOTE: passing prompt submits a real message in the user's logged-in account (a new conversation turn) \u2014 only send when the user wants that; omit prompt to capture a prompt the user just ran. Setup, if not already connected or if the profile disconnected: call browser_profile_onboard, give the user the watch_url, let them complete login, then call browser_profile_status until status is AUTHENTICATED. After that, browser_open the saved direct no-proxy profile and go to chatgpt.com or claude.ai. Fan-out is captured only as it streams, so the session must be open when the prompt runs. NOT for Google AI Overview citations \u2014 use harvest_paa for those; this tool is ChatGPT and Claude only.`,
|
|
1209
1281
|
inputSchema: BrowserCaptureFanoutInputSchema,
|
|
1210
1282
|
outputSchema: BrowserCaptureFanoutOutputSchema,
|
|
1211
1283
|
annotations: annotations("Capture AI Search Fan-Out")
|