@mrscraper/mcp 0.1.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 +21 -0
- package/README.md +642 -0
- package/dist/api.d.ts +102 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +203 -0
- package/dist/api.js.map +1 -0
- package/dist/app.d.ts +17 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +123 -0
- package/dist/app.js.map +1 -0
- package/dist/auth.d.ts +7 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +64 -0
- package/dist/auth.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +8 -0
- package/dist/bin.js.map +1 -0
- package/dist/compliance.d.ts +4 -0
- package/dist/compliance.d.ts.map +1 -0
- package/dist/compliance.js +10 -0
- package/dist/compliance.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +19 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +156 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +46 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +24 -0
- package/dist/server.js.map +1 -0
- package/dist/status.d.ts +21 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +62 -0
- package/dist/status.js.map +1 -0
- package/dist/tools.d.ts +122 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +664 -0
- package/dist/tools.js.map +1 -0
- package/package.json +77 -0
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export interface ToolDependencies {
|
|
4
|
+
fetchFn?: typeof fetch;
|
|
5
|
+
now?: () => Date;
|
|
6
|
+
}
|
|
7
|
+
export declare const fetchOutputSchema: z.ZodObject<{
|
|
8
|
+
status_code: z.ZodNullable<z.ZodNumber>;
|
|
9
|
+
data: z.ZodJSONSchema;
|
|
10
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
11
|
+
error: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const scrapeOutputSchema: z.ZodObject<{
|
|
14
|
+
status_code: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
data: z.ZodJSONSchema;
|
|
16
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
17
|
+
error: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const statusOutputSchema: z.ZodObject<{
|
|
20
|
+
kind: z.ZodOptional<z.ZodLiteral<"mrscraper-cli-status-summary">>;
|
|
21
|
+
source_endpoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
status_code: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
data: z.ZodJSONSchema;
|
|
24
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
25
|
+
error: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const fetchInputSchema: z.ZodObject<{
|
|
28
|
+
url: z.ZodURL;
|
|
29
|
+
browser_rendering: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
geo_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
wait_for_selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
home_page: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
block_resources: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
max_retries: z.ZodDefault<z.ZodNumber>;
|
|
35
|
+
token_cap: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
36
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare function fetchTool(token: string, input: z.infer<typeof fetchInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
39
|
+
export declare const scrapeInputSchema: z.ZodObject<{
|
|
40
|
+
url: z.ZodURL;
|
|
41
|
+
prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
+
schema_prompt: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
|
|
43
|
+
agent: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
general: "general";
|
|
45
|
+
listing: "listing";
|
|
46
|
+
map: "map";
|
|
47
|
+
}>>;
|
|
48
|
+
proxy_country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
max_pages: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
50
|
+
max_depth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
51
|
+
limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
52
|
+
include_patterns: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
exclude_patterns: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare function scrapeTool(token: string, input: z.infer<typeof scrapeInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
56
|
+
export declare const serpInputSchema: z.ZodObject<{
|
|
57
|
+
query_or_url: z.ZodString;
|
|
58
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
61
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
html: "html";
|
|
63
|
+
json: "json";
|
|
64
|
+
}>>;
|
|
65
|
+
render_js: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
raw: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
client_timeout: z.ZodDefault<z.ZodNumber>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare function serpTool(token: string, input: z.infer<typeof serpInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
70
|
+
export declare const statusInputSchema: z.ZodObject<{
|
|
71
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
from: z.ZodDefault<z.ZodString>;
|
|
73
|
+
to: z.ZodDefault<z.ZodString>;
|
|
74
|
+
action: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
api_token_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export declare function statusTool(token: string, input: z.infer<typeof statusInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
78
|
+
export declare const rerunInputSchema: z.ZodObject<{
|
|
79
|
+
target: z.ZodString;
|
|
80
|
+
type: z.ZodEnum<{
|
|
81
|
+
ai: "ai";
|
|
82
|
+
manual: "manual";
|
|
83
|
+
}>;
|
|
84
|
+
bulk: z.ZodDefault<z.ZodBoolean>;
|
|
85
|
+
scraper_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
max_depth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
88
|
+
max_pages: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
89
|
+
limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
90
|
+
include_patterns: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
exclude_patterns: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export declare function rerunTool(token: string, input: z.infer<typeof rerunInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
94
|
+
export declare const resultsInputSchema: z.ZodObject<{
|
|
95
|
+
sort_field: z.ZodDefault<z.ZodString>;
|
|
96
|
+
sort_order: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
|
|
97
|
+
asc: "asc";
|
|
98
|
+
desc: "desc";
|
|
99
|
+
}>>>;
|
|
100
|
+
page_size: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
102
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
date_range_column: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
start_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
105
|
+
end_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export declare function resultsTool(token: string, input: z.infer<typeof resultsInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
108
|
+
export declare const resultInputSchema: z.ZodObject<{
|
|
109
|
+
result_id: z.ZodString;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export declare function resultTool(token: string, input: z.infer<typeof resultInputSchema>, dependencies?: ToolDependencies): Promise<Record<string, unknown>>;
|
|
112
|
+
export declare const TOOL_DESCRIPTIONS: {
|
|
113
|
+
readonly fetch: "Use this when you already know one page URL and need its page response through Web Unblocker, including pages that reject ordinary HTTP requests. Use scrape instead for AI-extracted fields or records, and serp when you first need to discover URLs with Google. The url argument is required. Enable browser_rendering for JavaScript-driven content; wait_for_selector then waits for a CSS selector. geo_code changes proxy location, while home_page, block_resources, max_retries, token_cap, and timeout tune loading and retry behavior.";
|
|
114
|
+
readonly scrape: "Use this when you know a starting URL and need AI-extracted fields, repeated listing records, or a map of site URLs. Choose agent=general for defined fields on a page, agent=listing for repeated records across pages, or agent=map for URL discovery. The general and listing modes require prompt and optionally accept schema_prompt guidance and proxy_country; max_pages applies to listing and map, while max_depth, limit, include_patterns, and exclude_patterns are map-only. A successful run creates a saved scraper and returns scraperId, which rerun can reuse on the same or another URL. Use fetch instead when the page response itself is sufficient.";
|
|
115
|
+
readonly serp: "Use this when the task starts with a Google query or Google search URL and you need to discover relevant result pages before fetching or extracting them. The query_or_url argument is required; region, language, and page control localization and pagination. format=json returns parsed results, format=html returns result-page HTML, render_js includes dynamic features, and client_timeout only controls how long this MCP request waits. raw is a deprecated alias for format=html. Follow useful result URLs with fetch or scrape.";
|
|
116
|
+
readonly status: "Use this to check the current MrScraper account's subscription and usage before or after web-data work. With no arguments it returns the account summary. Supply domain only when request-outcome analytics are also needed; from and to select that analytics window, while action and api_token_name narrow those domain outcomes. This tool reports account and request health, not scrape-job progress; use result for a known asynchronous result ID.";
|
|
117
|
+
readonly rerun: "Use this only when you already have a saved scraper UUID and want to apply that configuration to the same or new target URLs. Set type=ai for a scraper created by scrape; type=manual selects a dashboard-built step workflow and requires the conversation's compliance acknowledgment. For one URL, leave bulk=false and pass target with scraper_id. A single AI rerun also accepts max_depth, max_pages, limit, include_patterns, and exclude_patterns; manual and bulk reruns reject those controls. For multiple URLs, set bulk=true, pass comma- or newline-separated target URLs and id; bulk jobs are asynchronous, so retain bulkResultId and inspect it with result until completion. Use scrape to create a new AI configuration.";
|
|
118
|
+
readonly results: "Use this to browse or locate stored scrape results when you do not yet know the exact result UUID. sort_field and sort_order control ordering; page_size and page control pagination; search narrows the list; and date_range_column with start_at or end_at applies a date window. This returns a result list rather than one complete record. Once an ID is known, use result for that record.";
|
|
119
|
+
readonly result: "Use this when you already know the exact stored result UUID and need the complete record or current job state. Pass that UUID as result_id; this may also be the bulkResultId returned by an asynchronous bulk rerun. Call result again as needed until an asynchronous job completes. Use results first when the UUID is unknown.";
|
|
120
|
+
};
|
|
121
|
+
export declare function registerTools(server: McpServer, getToken: () => string, dependencies?: ToolDependencies): void;
|
|
122
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAwBD,eAAO,MAAM,iBAAiB;;;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;iBAI7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;iBAY3B,CAAC;AAuEL,eAAO,MAAM,gBAAgB;;;;;;;;;;iBA6D3B,CAAC;AAEH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACvC,YAAY,GAAE,gBAAqB,GAClC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiBlC;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;iBAwE5B,CAAC;AAEH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,EACxC,YAAY,GAAE,gBAAqB,GAClC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqDlC;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;iBAwD1B,CAAC;AAEH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,CAAC,KA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