search1api-mcp 0.10.0 → 0.11.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/README.md CHANGED
@@ -233,6 +233,20 @@ Find local businesses and places on Google Maps. Returns one page of up to 20 pl
233
233
  | `page` | No | 1 | Google Maps page, 1-6; each page is a separate call |
234
234
  | `max_results` | No | 20 | Places to return from the page (1-20); fewer places do not lower the price |
235
235
 
236
+ ### deepcrawl
237
+ Read many pages of one site in a single task, such as a documentation section. Finds the site's URLs through its sitemap, keeps those that match the path rules, and returns up to `max_pages` pages as citable results: `title`, `url`, and the page's Markdown in `text`. The result also carries `stats` (discovered, matched, skipped, crawled, failed), `failed` (URLs that could not be read, with the reason), the API `message`, and `result_url`, a JSON file with every page in full. Costs 20 credits per started task, however many pages it reads.
238
+
239
+ The tool waits up to about 45 seconds. If the crawl is still running, it returns `status: "running"` with a `task_id`; call `deepcrawl` again with that `task_id` to collect the pages, which is free and starts no new crawl. Page text is capped at 8,000 characters per page and 80,000 in total; shortened pages have `metadata.truncated: true`, and `result_url` holds the full text.
240
+
241
+ | Parameter | Required | Default | Description |
242
+ |-----------|----------|---------|-------------|
243
+ | `url` | Yes, unless `task_id` is given | - | Site or section to crawl, such as `https://example.com/docs/` |
244
+ | `max_pages` | No | 10 | Most pages to read (1-50), in discovery order after the path rules; the price is the same for any number |
245
+ | `include_paths` | No | - | Up to 20 URL path rules to keep. Without `*` a rule is a path prefix on segment boundaries (`/docs` matches `/docs/api`, not `/docsearch`); with `*` it must match the whole path and `*` also matches `/` |
246
+ | `exclude_paths` | No | - | Up to 20 path rules to skip, same syntax; exclusion wins |
247
+ | `type` | No | sitemap | `sitemap` uses the site's sitemap, or the links on the start page when it has none; `all` uses every link discovered from the start URL |
248
+ | `task_id` | No | - | `task_id` of a crawl that was still running; only checks its status, and the other parameters are ignored |
249
+
236
250
  ### send_feedback
237
251
  Report a wrong, empty or incomplete result, an error you could not resolve, documentation that did not match behavior, or a missing capability to the Search1API team. Free; it spends no credits. When the server has a Search1API credential, the report is linked to that account so the team can follow up. Do not include credentials or private data.
238
252
 
@@ -246,6 +260,7 @@ Report a wrong, empty or incomplete result, an error you could not resolve, docu
246
260
 
247
261
  ## Version History
248
262
 
263
+ - v0.11.0: New `deepcrawl` tool to read up to 50 pages of one site in a single task (20 credits per task; checking a running task is free)
249
264
  - v0.10.0: New `maps` tool for Google Maps place search (3 credits per page of up to 20 places)
250
265
  - v0.7.0: New `ask` tool for agentic search. `search` adds the `bingcn`, `yandex`, and `grokipedia` engines and a `page` parameter; `search` and `news` accept `time_range: "week"` and pass `published_date`, GitHub, and Hacker News fields through in result `metadata`
251
266
 
package/build/api.js CHANGED
@@ -1,5 +1,20 @@
1
1
  import { API_KEY, API_CONFIG } from './config.js';
2
2
  import { log } from './utils.js';
3
+ /**
4
+ * A non-2xx answer from the API. `status` and `body` let a caller tell, for
5
+ * example, a failed deepcrawl task (a task payload sent with HTTP 500) from
6
+ * an outage.
7
+ */
8
+ export class ApiResponseError extends Error {
9
+ status;
10
+ body;
11
+ constructor(message, status, body) {
12
+ super(message);
13
+ this.status = status;
14
+ this.body = body;
15
+ this.name = 'ApiResponseError';
16
+ }
17
+ }
3
18
  /**
4
19
  * Unified API request function
5
20
  * @param endpoint API endpoint
@@ -8,6 +23,16 @@ import { log } from './utils.js';
8
23
  * @returns API response
9
24
  */
10
25
  export async function makeRequest(endpoint, data, apiKey) {
26
+ return request('POST', endpoint, data, apiKey);
27
+ }
28
+ /**
29
+ * GET an API endpoint, such as a task status, with the same credential and
30
+ * error handling as makeRequest.
31
+ */
32
+ export async function makeGetRequest(endpoint, apiKey) {
33
+ return request('GET', endpoint, undefined, apiKey);
34
+ }
35
+ async function request(method, endpoint, data, apiKey) {
11
36
  const key = apiKey || API_KEY;
12
37
  if (!key) {
13
38
  throw new Error("API key is required. Provide SEARCH1API_KEY or pass apiKey explicitly.");
@@ -17,23 +42,25 @@ export async function makeRequest(endpoint, data, apiKey) {
17
42
  const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
18
43
  const url = `${baseUrl}${path}`;
19
44
  // Debug log for request details (excluding sensitive info)
20
- log(`Making request to: ${url}`);
21
- log(`Request data: ${JSON.stringify(data, null, 2)}`);
45
+ log(`Making ${method} request to: ${url}`);
46
+ if (method === 'POST') {
47
+ log(`Request data: ${JSON.stringify(data, null, 2)}`);
48
+ }
22
49
  try {
23
50
  const response = await fetch(url, {
24
- method: 'POST',
51
+ method,
25
52
  headers: {
26
53
  'Authorization': `Bearer ${key}`,
27
- 'Content-Type': 'application/json',
54
+ ...(method === 'POST' && { 'Content-Type': 'application/json' }),
28
55
  },
29
- body: JSON.stringify(data)
56
+ ...(method === 'POST' && { body: JSON.stringify(data) }),
30
57
  });
31
58
  // Log response status only
32
59
  log(`Response status: ${response.status}`);
33
60
  if (!response.ok) {
34
61
  const errorData = await response.json().catch(() => ({}));
35
62
  log(`Error response: ${JSON.stringify(errorData, null, 2)}`);
36
- throw new Error(`API error: ${response.status} ${errorData.message || response.statusText}`);
63
+ throw new ApiResponseError(`API error: ${response.status} ${errorData.message || response.statusText}`, response.status, errorData);
37
64
  }
38
65
  const result = await response.json();
39
66
  const duration = Date.now() - startTime;
package/build/branding.js CHANGED
@@ -10,4 +10,4 @@ export const SERVER_ICONS = [
10
10
  },
11
11
  ];
12
12
  // Same wording as server.json, advertised in the MCP handshake serverInfo.
13
- export const SERVER_DESCRIPTION = "Web search, agentic search, news, page retrieval, sitemaps, and trending topics through Search1API.";
13
+ export const SERVER_DESCRIPTION = "Multi-engine web and platform search, news, Google Maps places, page reading, sitemaps, and trends.";
package/build/config.js CHANGED
@@ -43,7 +43,9 @@ export const API_CONFIG = {
43
43
  NEWS: '/news',
44
44
  TRENDING: '/trending',
45
45
  ASK: '/ask',
46
- MAPS: '/maps'
46
+ MAPS: '/maps',
47
+ DEEPCRAWL: '/deepcrawl',
48
+ DEEPCRAWL_STATUS: '/deepcrawl/status'
47
49
  }
48
50
  };
49
51
  // Agentback project public key for the send_feedback tool. It can only submit
package/build/http.js CHANGED
@@ -225,7 +225,7 @@ export function createHttpApp(options = {}) {
225
225
  name: "Search1API",
226
226
  version: PACKAGE_VERSION,
227
227
  icons: SERVER_ICONS,
228
- description: "Remote MCP server for Search1API. Exposes live web search, agentic search, news, page reading, sitemap discovery, and trending topics as tools for AI agents.",
228
+ description: "Remote MCP server for Search1API. Gives AI agents live search across Google, Bing, and platforms such as GitHub, Reddit, X, arXiv, WeChat, and Bilibili, plus news, Google Maps places, full-page reading, site link discovery, and GitHub and Hacker News trends.",
229
229
  serverUrl: MCP_RESOURCE,
230
230
  tools: ALL_TOOLS.map((tool) => ({
231
231
  name: tool.name,
package/build/server.js CHANGED
@@ -41,7 +41,7 @@ export function createMcpServer(credential) {
41
41
  icons: SERVER_ICONS,
42
42
  websiteUrl: "https://s1.dev",
43
43
  description: SERVER_DESCRIPTION,
44
- }, { instructions: "Use search, news, ask, maps, crawl, sitemap and trending to retrieve data. Call render_results with selected existing results only when the user wants to browse sources or a visual list helps. Rendering never repeats a search or consumes search credits; unsupported UI clients receive a readable text list." });
44
+ }, { instructions: "Use search, news, ask, maps, crawl, deepcrawl, sitemap and trending to retrieve data. Call render_results with selected existing results only when the user wants to browse sources or a visual list helps. Rendering never repeats a search or consumes search credits; unsupported UI clients receive a readable text list." });
45
45
  for (const tool of ALL_TOOLS) {
46
46
  const inputSchema = fromJsonSchema(tool.inputSchema);
47
47
  const outputSchema = tool.outputSchema
@@ -0,0 +1,207 @@
1
+ import { isValidDeepcrawlArgs, } from '../types.js';
2
+ import { ApiResponseError, makeGetRequest, makeRequest } from '../api.js';
3
+ import { formatError, log } from '../utils.js';
4
+ import { API_CONFIG } from '../config.js';
5
+ import { INVALID_PARAMS, ProtocolError, } from "@modelcontextprotocol/server";
6
+ /**
7
+ * How long one deepcrawl call waits for its task. A 20-page crawl usually
8
+ * takes 10-20 s; anything slower is handed back as a task_id so the call
9
+ * stays well inside common client timeouts. Mutable so tests can shorten it.
10
+ */
11
+ export const DEEPCRAWL_POLLING = {
12
+ intervalMs: 2_000,
13
+ timeoutMs: 45_000,
14
+ };
15
+ /** Bounds on the page text returned inline; resultUrl holds the rest. */
16
+ export const DEEPCRAWL_TEXT_LIMITS = {
17
+ perPage: 8_000,
18
+ total: 80_000,
19
+ };
20
+ const RUNNING_STATUSES = new Set(["queued", "waiting", "processing", "running", "unknown"]);
21
+ function errorResult(text) {
22
+ return {
23
+ content: [{ type: "text", text }],
24
+ isError: true,
25
+ };
26
+ }
27
+ function toolResult(structuredContent) {
28
+ return {
29
+ structuredContent,
30
+ content: [{
31
+ type: "text",
32
+ text: JSON.stringify(structuredContent)
33
+ }]
34
+ };
35
+ }
36
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
37
+ /**
38
+ * Read a task's status. A failed task arrives as HTTP 500 and an unknown one
39
+ * as HTTP 404, both with a task payload, so those bodies are statuses too.
40
+ */
41
+ async function checkStatus(taskId, apiKey) {
42
+ try {
43
+ const response = await makeGetRequest(`${API_CONFIG.ENDPOINTS.DEEPCRAWL_STATUS}/${encodeURIComponent(taskId)}`, apiKey);
44
+ return { kind: "status", response };
45
+ }
46
+ catch (error) {
47
+ if (error instanceof ApiResponseError) {
48
+ const body = error.body && typeof error.body === "object" ? error.body : {};
49
+ if (error.status === 404) {
50
+ return { kind: "status", response: { ...body, taskId, status: "not_found" } };
51
+ }
52
+ if (typeof body.status === "string" && body.taskId) {
53
+ return { kind: "status", response: body };
54
+ }
55
+ // Rate limits and server faults can clear up while we wait; a rejected
56
+ // credential or request will not.
57
+ return { kind: "error", error, retryable: error.status === 429 || error.status >= 500 };
58
+ }
59
+ return { kind: "error", error, retryable: true };
60
+ }
61
+ }
62
+ /** Cut at a UTF-16 boundary so a shortened text never ends in half a character. */
63
+ function cutText(text, limit) {
64
+ if (text.length <= limit) {
65
+ return text;
66
+ }
67
+ let cut = text.slice(0, limit);
68
+ const last = cut.charCodeAt(cut.length - 1);
69
+ if (last >= 0xd800 && last <= 0xdbff) {
70
+ cut = cut.slice(0, -1);
71
+ }
72
+ return cut;
73
+ }
74
+ function pagesToResults(pages) {
75
+ let remaining = DEEPCRAWL_TEXT_LIMITS.total;
76
+ let truncated = false;
77
+ const results = pages.map((page, index) => {
78
+ const content = typeof page.content === "string" ? page.content : "";
79
+ const text = cutText(content, Math.min(DEEPCRAWL_TEXT_LIMITS.perPage, remaining));
80
+ remaining -= text.length;
81
+ const cut = text.length < content.length;
82
+ truncated ||= cut;
83
+ return {
84
+ id: page.url,
85
+ title: page.title || page.url,
86
+ url: page.url,
87
+ ...(text && { text }),
88
+ metadata: {
89
+ source: "search1api",
90
+ position: index + 1,
91
+ ...(cut && { truncated: true, content_length: content.length }),
92
+ },
93
+ };
94
+ });
95
+ return { results, truncated };
96
+ }
97
+ function completedResult(taskId, response) {
98
+ const pages = Array.isArray(response.pages) ? response.pages : undefined;
99
+ const { results, truncated } = pagesToResults(pages ?? []);
100
+ const resultUrl = response.resultUrl || undefined;
101
+ let note;
102
+ if (truncated) {
103
+ note = `Page text was shortened to fit this response (at most ${DEEPCRAWL_TEXT_LIMITS.perPage} characters per page and ${DEEPCRAWL_TEXT_LIMITS.total} in total); pages marked truncated in metadata are incomplete.${resultUrl ? " result_url holds every page in full;" : ""} read a single page in full with crawl.`;
104
+ }
105
+ else if (!pages && resultUrl) {
106
+ note = "The result was too large to return inline; result_url holds every page.";
107
+ }
108
+ else if (results.length === 0) {
109
+ note = "The crawl finished without pages; message says why.";
110
+ }
111
+ return toolResult({
112
+ task_id: taskId,
113
+ status: "completed",
114
+ ...(response.message && { message: response.message }),
115
+ results,
116
+ ...(response.stats && { stats: response.stats }),
117
+ failed: Array.isArray(response.failed) ? response.failed : [],
118
+ ...(resultUrl && { result_url: resultUrl }),
119
+ truncated,
120
+ ...(note && { note }),
121
+ });
122
+ }
123
+ function runningResult(taskId, lastError) {
124
+ return toolResult({
125
+ task_id: taskId,
126
+ status: "running",
127
+ results: [],
128
+ note: `The crawl is still running. Call deepcrawl again with {"task_id": "${taskId}"} in a few seconds to collect the pages; checking costs no credits and does not start a new crawl.${lastError ? ` The last status check failed: ${formatError(lastError)}` : ""}`,
129
+ });
130
+ }
131
+ /**
132
+ * Implementation of the deepcrawl tool
133
+ */
134
+ export async function handleDeepcrawl(args, apiKey) {
135
+ if (!isValidDeepcrawlArgs(args)) {
136
+ throw new ProtocolError(INVALID_PARAMS, "Invalid deepcrawl arguments");
137
+ }
138
+ let taskId;
139
+ const resuming = args.task_id !== undefined;
140
+ if (args.task_id !== undefined) {
141
+ taskId = args.task_id.trim();
142
+ log("Checking deepcrawl task:", taskId);
143
+ }
144
+ else {
145
+ log("Starting deepcrawl for:", args.url);
146
+ try {
147
+ const response = await makeRequest(API_CONFIG.ENDPOINTS.DEEPCRAWL, {
148
+ url: args.url,
149
+ ...(args.type !== undefined && { type: args.type }),
150
+ max_pages: args.max_pages ?? 10,
151
+ ...(args.include_paths !== undefined && { include_paths: args.include_paths }),
152
+ ...(args.exclude_paths !== undefined && { exclude_paths: args.exclude_paths }),
153
+ format: "json",
154
+ }, apiKey);
155
+ if (typeof response?.taskId !== "string" || response.taskId.length === 0) {
156
+ throw new Error("the API did not return a task id");
157
+ }
158
+ taskId = response.taskId;
159
+ }
160
+ catch (error) {
161
+ log("Deepcrawl start error:", error);
162
+ return errorResult(`Deepcrawl API error: ${formatError(error)}`);
163
+ }
164
+ }
165
+ const deadline = Date.now() + DEEPCRAWL_POLLING.timeoutMs;
166
+ let lastError;
167
+ // A new task needs a moment before it can finish; an earlier one may already have.
168
+ let waitFirst = !resuming;
169
+ while (true) {
170
+ if (waitFirst) {
171
+ if (Date.now() + DEEPCRAWL_POLLING.intervalMs > deadline) {
172
+ break;
173
+ }
174
+ await sleep(DEEPCRAWL_POLLING.intervalMs);
175
+ }
176
+ waitFirst = true;
177
+ const check = await checkStatus(taskId, apiKey);
178
+ if (check.kind === "error") {
179
+ if (!check.retryable) {
180
+ log("Deepcrawl status error:", check.error);
181
+ return errorResult(`Deepcrawl API error: ${formatError(check.error)} (task_id ${taskId})`);
182
+ }
183
+ lastError = check.error;
184
+ continue;
185
+ }
186
+ lastError = undefined;
187
+ const { response } = check;
188
+ const status = response.status ?? "processing";
189
+ if (status === "completed") {
190
+ return completedResult(taskId, response);
191
+ }
192
+ if (status === "failed") {
193
+ return errorResult(`Deepcrawl task ${taskId} failed: ${response.error || response.message || "no reason given"}`);
194
+ }
195
+ if (status === "not_found") {
196
+ // A task this call just started may not be visible yet; keep waiting.
197
+ if (!resuming) {
198
+ continue;
199
+ }
200
+ return errorResult(`Deepcrawl task ${taskId} was not found; it may have expired. Start a new crawl with url.`);
201
+ }
202
+ if (!RUNNING_STATUSES.has(status)) {
203
+ log(`Unexpected deepcrawl status for ${taskId}: ${status}`);
204
+ }
205
+ }
206
+ return runningResult(taskId, lastError);
207
+ }
@@ -8,7 +8,8 @@ import { handleTrending } from "./trending.js";
8
8
  import { handleRenderResults } from "./render-results.js";
9
9
  import { handleAsk } from "./ask.js";
10
10
  import { handleMaps } from "./maps.js";
11
- import { SEARCH_TOOL, CRAWL_TOOL, SITEMAP_TOOL, NEWS_TOOL, TRENDING_TOOL, ASK_TOOL, MAPS_TOOL, RENDER_RESULTS_TOOL, } from "./index.js";
11
+ import { handleDeepcrawl } from "./deepcrawl.js";
12
+ import { SEARCH_TOOL, CRAWL_TOOL, SITEMAP_TOOL, NEWS_TOOL, TRENDING_TOOL, ASK_TOOL, MAPS_TOOL, DEEPCRAWL_TOOL, RENDER_RESULTS_TOOL, } from "./index.js";
12
13
  /**
13
14
  * Dispatch request based on tool name
14
15
  * @param toolName Name of the tool
@@ -33,6 +34,8 @@ export async function handleToolCall(toolName, args, apiKey) {
33
34
  return await handleAsk(args, apiKey);
34
35
  case MAPS_TOOL.name:
35
36
  return await handleMaps(args, apiKey);
37
+ case DEEPCRAWL_TOOL.name:
38
+ return await handleDeepcrawl(args, apiKey);
36
39
  case RENDER_RESULTS_TOOL.name:
37
40
  return await handleRenderResults(args);
38
41
  default:
@@ -68,7 +68,7 @@ const SEARCH_OUTPUT_SCHEMA = {
68
68
  export const SEARCH_TOOL = {
69
69
  name: "search",
70
70
  title: "Web search",
71
- description: "Search the live public web when the user needs current information, sources, or research. Returns citable results with id, title, URL, and text. Each result includes a URL that can be read in full.",
71
+ description: "Search the live web through one chosen engine: Google, Bing, DuckDuckGo, or Yahoo for the open web, or a specialized source such as GitHub, Reddit, X, YouTube, arXiv, Wikipedia, WeChat, or Bilibili when the user wants results from that platform. Use when the user needs current information, sources, or research. Returns citable results with id, title, URL, and text; read any URL in full with crawl.",
72
72
  ...AUTHENTICATED_READ_ONLY_WEB,
73
73
  inputSchema: {
74
74
  type: "object",
@@ -427,6 +427,119 @@ export const MAPS_TOOL = {
427
427
  required: ["results"],
428
428
  },
429
429
  };
430
+ const DEEPCRAWL_PATH_RULES = {
431
+ type: "array",
432
+ maxItems: 20,
433
+ items: {
434
+ type: "string",
435
+ minLength: 1,
436
+ maxLength: 200,
437
+ },
438
+ };
439
+ // Deepcrawl tool definition
440
+ export const DEEPCRAWL_TOOL = {
441
+ name: "deepcrawl",
442
+ title: "Crawl a website",
443
+ description: "Read many pages of one website in a single task, such as a documentation section, when the user needs content from across a site rather than one page. Finds the site's URLs through its sitemap, keeps those whose path matches the path rules, and returns up to max_pages pages as citable results with title, URL, and Markdown text, plus page counts and the URLs that failed. Costs 20 credits per started task, however many pages it reads. Waits about 45 seconds; if the crawl is still running, the result holds a task_id, and calling deepcrawl again with that task_id collects the pages at no cost. Use crawl for a single page and sitemap for a list of URLs without their content.",
444
+ ...AUTHENTICATED_READ_ONLY_WEB,
445
+ inputSchema: {
446
+ type: "object",
447
+ properties: {
448
+ url: {
449
+ type: "string",
450
+ format: "uri",
451
+ description: "Site or section to crawl, such as https://example.com or https://example.com/docs/; required unless task_id is given",
452
+ },
453
+ max_pages: {
454
+ type: "integer",
455
+ minimum: 1,
456
+ maximum: 50,
457
+ description: "Most pages to read, taken in discovery order after the path rules; the price is the same for any number",
458
+ default: 10,
459
+ },
460
+ include_paths: {
461
+ ...DEEPCRAWL_PATH_RULES,
462
+ description: "Only read URLs whose path matches one of these rules. A rule without * is a path prefix on segment boundaries (\"/docs\" matches /docs/api but not /docsearch); a rule with * must match the whole path, and * also matches / (\"/blog/*\")",
463
+ },
464
+ exclude_paths: {
465
+ ...DEEPCRAWL_PATH_RULES,
466
+ description: "Skip URLs whose path matches one of these rules, with the same syntax as include_paths; exclusion wins over inclusion",
467
+ },
468
+ type: {
469
+ type: "string",
470
+ enum: ["sitemap", "all"],
471
+ description: "Where URLs come from: sitemap uses the site's sitemap, or the links on the start page when it has none; all uses every link discovered from the start URL, which can include other sites",
472
+ default: "sitemap",
473
+ },
474
+ task_id: {
475
+ type: "string",
476
+ minLength: 1,
477
+ maxLength: 200,
478
+ description: "task_id from an earlier deepcrawl result that was still running; collects that crawl for free instead of starting a new one, and the other arguments are ignored",
479
+ },
480
+ },
481
+ },
482
+ outputSchema: {
483
+ type: "object",
484
+ properties: {
485
+ task_id: {
486
+ type: "string",
487
+ description: "Crawl task id; pass it back as task_id while status is running",
488
+ },
489
+ status: {
490
+ type: "string",
491
+ enum: ["completed", "running"],
492
+ description: "completed when the crawl has finished; running when it needs more time and results is empty",
493
+ },
494
+ message: {
495
+ type: "string",
496
+ description: "Summary of the finished crawl, including why nothing was crawled",
497
+ },
498
+ results: {
499
+ type: "array",
500
+ description: "Crawled pages in discovery order; text holds each page's Markdown, shortened when metadata.truncated is true",
501
+ items: CITABLE_RESULT_SCHEMA,
502
+ },
503
+ stats: {
504
+ type: "object",
505
+ description: "Page counts: links discovered, links matching the path rules, matches left out by max_pages, and pages crawled or failed",
506
+ properties: {
507
+ discovered: { type: "integer" },
508
+ matched: { type: "integer" },
509
+ skipped: { type: "integer" },
510
+ crawled: { type: "integer" },
511
+ failed: { type: "integer" },
512
+ },
513
+ },
514
+ failed: {
515
+ type: "array",
516
+ description: "Pages that could not be crawled, with the reason",
517
+ items: {
518
+ type: "object",
519
+ properties: {
520
+ url: { type: "string" },
521
+ error: { type: "string" },
522
+ },
523
+ required: ["url", "error"],
524
+ },
525
+ },
526
+ result_url: {
527
+ type: "string",
528
+ format: "uri",
529
+ description: "JSON file with every crawled page in full",
530
+ },
531
+ truncated: {
532
+ type: "boolean",
533
+ description: "Whether page text was shortened or left out to bound the response",
534
+ },
535
+ note: {
536
+ type: "string",
537
+ description: "What to do next: call again with task_id, or where to find text that was cut",
538
+ },
539
+ },
540
+ required: ["task_id", "status", "results"],
541
+ },
542
+ };
430
543
  export const RENDER_RESULTS_TOOL = {
431
544
  name: "render_results",
432
545
  title: "Render the results",
@@ -450,5 +563,6 @@ export const ALL_TOOLS = [
450
563
  TRENDING_TOOL,
451
564
  ASK_TOOL,
452
565
  MAPS_TOOL,
566
+ DEEPCRAWL_TOOL,
453
567
  RENDER_RESULTS_TOOL,
454
568
  ];
package/build/types.js CHANGED
@@ -191,3 +191,38 @@ export function isValidMapsArgs(args) {
191
191
  }
192
192
  return true;
193
193
  }
194
+ export const DEEPCRAWL_MAX_PAGES = 50;
195
+ function isValidPathRules(rules) {
196
+ return (Array.isArray(rules) &&
197
+ rules.length <= 20 &&
198
+ rules.every((rule) => typeof rule === 'string' && rule.length >= 1 && rule.length <= 200));
199
+ }
200
+ /**
201
+ * Either `task_id` (check an earlier crawl) or `url` (start a new one) is
202
+ * required. With `task_id`, the crawl options are ignored.
203
+ */
204
+ export function isValidDeepcrawlArgs(args) {
205
+ if (typeof args !== 'object' || args === null) {
206
+ return false;
207
+ }
208
+ const { url, task_id, type, max_pages, include_paths, exclude_paths } = args;
209
+ if (task_id !== undefined) {
210
+ return typeof task_id === 'string' && task_id.trim().length > 0 && task_id.length <= 200;
211
+ }
212
+ if (typeof url !== 'string' || url.trim().length === 0) {
213
+ return false;
214
+ }
215
+ if (type !== undefined && type !== 'sitemap' && type !== 'all') {
216
+ return false;
217
+ }
218
+ if (max_pages !== undefined && (!Number.isInteger(max_pages) || max_pages < 1 || max_pages > DEEPCRAWL_MAX_PAGES)) {
219
+ return false;
220
+ }
221
+ if (include_paths !== undefined && !isValidPathRules(include_paths)) {
222
+ return false;
223
+ }
224
+ if (exclude_paths !== undefined && !isValidPathRules(exclude_paths)) {
225
+ return false;
226
+ }
227
+ return true;
228
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "search1api-mcp",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "mcpName": "io.github.superagents-lab/search1api",
5
5
  "description": "A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API",
6
6
  "private": false,
package/server.json CHANGED
@@ -11,12 +11,12 @@
11
11
  ]
12
12
  }
13
13
  ],
14
- "description": "Web search, agentic search, news, page retrieval, sitemaps, and trending topics through Search1API.",
14
+ "description": "Multi-engine web and platform search, news, Google Maps places, page reading, sitemaps, and trends.",
15
15
  "repository": {
16
16
  "url": "https://github.com/superagents-lab/search1api-mcp",
17
17
  "source": "github"
18
18
  },
19
- "version": "0.10.0",
19
+ "version": "0.11.0",
20
20
  "remotes": [
21
21
  {
22
22
  "type": "streamable-http",
@@ -27,7 +27,7 @@
27
27
  {
28
28
  "registryType": "npm",
29
29
  "identifier": "search1api-mcp",
30
- "version": "0.10.0",
30
+ "version": "0.11.0",
31
31
  "transport": {
32
32
  "type": "stdio"
33
33
  },