desearch-mcp-server 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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0
4
+
5
+ `search-api` returns an optional summary. Tool names are unchanged (39 tools).
6
+
7
+ - `search-api` takes `summary` (a short answer written from the results, with numbered citations; no extra charge), `include_domains` (at most 100), and `exclude_domains` (at most 1,200). The result lists `summary` first (`{ text, citations: [{ index, url, title }] }`, or `null` with `meta.notices` `Summary unavailable.`), then `results`, `meta`, and the billing fields.
8
+ - `search-api` is web search on the Desearch index; the server instructions point web questions to it.
9
+ - `ai-search` covers X posts and web (from the Desearch index) with an optional AI summary. Web results are capped at 20 per request.
10
+ - `web-links-search` is deprecated in favor of `search-api`. It keeps calling `POST /desearch/ai/search/links/web`.
11
+ - Every version (package, `server.json`, the Gemini extension, the plugin manifests, and `SERVER_VERSION`) is 0.11.0.
12
+
3
13
  ## 0.10.0
4
14
 
5
15
  Cost on every tool result, as the hosted server has had since 06a3ec0.
package/README.md CHANGED
@@ -52,7 +52,7 @@ Example output:
52
52
 
53
53
  The tool returns that JSON as pretty-printed text: `{ "content": [{ "type": "text", "text": "<json above>" }] }`.
54
54
 
55
- AI search, X search and web search for AI agents, plus the Search API (ranked pages with the best-matching passage), page extraction, X data tools, public TikTok, Facebook, Instagram, YouTube (videos, transcripts, comments, channels), Reddit, and Threads data, People Search (find people and creators on X, YouTube, LinkedIn, and TikTok), and Company Search (find companies on the web, or enrich domains you have, with their public contacts and leaders). Bring your own Desearch API key. Version 0.10.0 exposes 39 tools.
55
+ AI search, X search and web search for AI agents, plus the Search API (ranked pages with the best-matching passage), page extraction, X data tools, public TikTok, Facebook, Instagram, YouTube (videos, transcripts, comments, channels), Reddit, and Threads data, People Search (find people and creators on X, YouTube, LinkedIn, and TikTok), and Company Search (find companies on the web, or enrich domains you have, with their public contacts and leaders). Bring your own Desearch API key. Version 0.11.0 exposes 39 tools.
56
56
 
57
57
  ## Tools
58
58
 
@@ -60,13 +60,13 @@ The Desearch MCP server includes the following tools.
60
60
 
61
61
  Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destructiveHint: false`, and `openWorldHint: true`. `search-api`, `tiktok`, `facebook`, `instagram`, `youtube`, `reddit`, `threads`, `people-search-status`, `people-search-tasks`, `people-profiles`, and `people-search-export` are lookups too. `people-search` starts a paid job billed to the user's Desearch balance, so `readOnlyHint` is false; it creates a new task and does not delete or overwrite anything, so `destructiveHint` is false. `people-search-pause` and `people-search-resume` change a task's state and undo each other, so `readOnlyHint` and `destructiveHint` are false and `idempotentHint` is true. Pausing loses no data (people found so far stay readable and the search keeps its progress) and changes no billing (nothing is charged or refunded; the reservation stays until the search ends), and resume continues from where the search stopped with no new charge. The caveat: the API cancels a search paused for more than 7 days, and a cancelled search cannot be resumed, so a pause is reversible only within those 7 days. `people-search-cancel` cannot be undone, so `readOnlyHint` is false and `destructiveHint` and `idempotentHint` are true. The Company Search tools follow the same rules: `company-search` and `company-enrich` start paid jobs (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`), `company-search-status` and `company-search-tasks` are lookups, `company-search-pause` and `company-search-resume` set `destructiveHint: false` and `idempotentHint: true` (with the same 7-day caveat), and `company-search-cancel` sets `destructiveHint: true` and `idempotentHint: true`. `openWorldHint` is true on every tool because the call reaches a live external source.
62
62
 
63
- - **AI Search** (`ai-search`): Performs AI Twitter and web searches with relevant links and summary. `tools` uses short source ids (`web`, `twitter`, `arxiv`, `wikipedia`, `hackernews`, `reddit`). Older labels such as `Web Search`, `ArXiv Search`, `Wikipedia Search`, `Hacker News Search`, and `Reddit Search` are still accepted and sent as the short id. `youtube` is not accepted. Default is `["web", "twitter"]`.
63
+ - **AI Search** (`ai-search`): X (Twitter) posts and web (from the Desearch index) with relevant links and an optional AI summary. Web results are capped at 20 per request; for web only, use `search-api`. `tools` uses short source ids (`web`, `twitter`, `arxiv`, `wikipedia`, `hackernews`, `reddit`). Older labels such as `Web Search`, `ArXiv Search`, `Wikipedia Search`, `Hacker News Search`, and `Reddit Search` are still accepted and sent as the short id. `youtube` is not accepted. Default is `["web", "twitter"]`.
64
64
  - **X Search** (`x-search`): Tweet search on X. Arguments: `query` (required), `count` (optional, default 20). Sort stays Top. Optional filters: `user`, `start_date`, `end_date` (YYYY-MM-DD), `lang`, `verified`, `blue_verified`, `is_quote`, `is_video`, `is_image`, `min_retweets`, `min_replies`, `min_likes`.
65
65
  - **Search** (`search`): Web search that returns `{ results: [{ id, title, url }] }`. Argument: `query` (required). `id` is the result URL.
66
66
  - **Fetch Page** (`fetch`): Read a public page as text. Argument: `id` (required, an `http` or `https` URL from `search`).
67
67
  - **Web Search** (`web-search`): SERP-style web search. Arguments: `query` (required), `start` (optional pagination offset).
68
- - **Search API** (`search-api`): Ranked web pages, each with its title, URL, publication date when known, and the passage that best matches the query (`POST /search`). Arguments: `query` (required, 1–2000 characters), `mode` (optional, `fast` or `balanced`, API default `balanced`), `count` (optional, 10, 15, or 20), `start_date` and `end_date` (optional, YYYY-MM-DD), `highlights` (optional, default `true`), `page_text` (optional, default `false`; adds each page's full text). Returns `results` plus `cost_usd`, `usage_count`, `service`, and `currency`.
69
- - **Web Links Search** (`web-links-search`): Web link search. Arguments: `prompt` (required), `tools` (optional, only `web`, default `["web"]`; `Web Search` is accepted and rewritten to `web`), `count` (optional, 10–200). The links/web API rejects other sources, so they are not in the enum.
68
+ - **Search API** (`search-api`): Web search on the Desearch index (`POST /search`): ranked pages, each with its title, URL, publication date when known, and the passage that best matches the query, plus an optional short answer with numbered citations. Arguments: `query` (required, 1–2000 characters), `mode` (optional, `fast` or `balanced`, API default `balanced`), `count` (optional, 10, 15, or 20), `start_date` and `end_date` (optional, YYYY-MM-DD), `highlights` (optional, default `true`), `page_text` (optional, default `false`; adds each page's full text), `include_domains` (optional, at most 100), `exclude_domains` (optional, at most 1,200; wins over `include_domains`), `summary` (optional, default `false`). Returns `summary` first when requested (`{ text, citations: [{ index, url, title }] }`; `[n]` in `text` refers to `citations[].index`; `null` with `meta.notices` `Summary unavailable.` when it could not be written), then `results`, `meta` (`latency_ms`, `notices`), `cost_usd`, `usage_count`, `service`, and `currency`. The summary has no extra charge.
69
+ - **Web Links Search** (`web-links-search`): Deprecated; use `search-api`. Web link search on `POST /desearch/ai/search/links/web`. Arguments: `prompt` (required), `tools` (optional, only `web`, default `["web"]`; `Web Search` is accepted and rewritten to `web`), `count` (optional, 10–200). The links/web API rejects other sources, so they are not in the enum.
70
70
  - **Extract** (`extract`): Read a public URL as text or HTML. Preferred over crawl. Arguments: `url` (required), `format` (optional, `text`, `markdown` or `html`), `js` (optional), `wait` (optional milliseconds), `full_page` (optional, `text` only: every visible section of the page instead of its main content). Errors carry an `error_code`: `js_required` (retry with `js: true`), `blocked` (the site refused or showed a bot check), `page_not_found`.
71
71
  - **Web Crawl** (`web-crawl`): Same arguments as `extract`, on the legacy `/web/crawl` route. The SDK marks `webCrawl` deprecated in favor of `extract`; this tool stays so that route remains reachable. Prefer `extract` for new integrations.
72
72
  - **X Links Search** (`x-links-search`): AI search for X post links. Arguments: `prompt` (required), `count` (optional, 10–200).
package/build/http.d.ts CHANGED
@@ -14,12 +14,15 @@ export interface RunningHttpServer {
14
14
  * the rewritten URL (`/api/mcp`) rather than the public path (`/mcp`).
15
15
  */
16
16
  export declare function requestWithPathname(request: Request, pathname: string): Request;
17
+ /** Public docs page that browsers and crawlers land on when they open /mcp without a key. */
18
+ export declare const MCP_DOCS_URL = "https://www.desearch.ai/docs/guide/sdk/mcp";
17
19
  /**
18
20
  * Stateless Streamable HTTP handler.
19
21
  * Each POST builds a fresh MCP server tied to that request's API key.
20
22
  * JSON responses (not a long-lived SSE session) so the same handler runs
21
23
  * in a local Node process and in a Vercel function.
22
24
  * GET and DELETE return 405: this server does not push messages or store sessions.
25
+ * A keyless browser GET (Accept: text/html) is sent to the public MCP docs page instead.
23
26
  */
24
27
  export declare function handleMcpHttpRequest(request: Request): Promise<Response>;
25
28
  export declare function startHttpServer(options?: HttpListenOptions): Promise<RunningHttpServer>;
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../http.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAoBjC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAa/E;AAiOD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAgL9E;AA8DD,wBAAgB,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiD3F"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../http.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAoBjC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAa/E;AAuED,6FAA6F;AAC7F,eAAO,MAAM,YAAY,+CAA+C,CAAC;AAwLzE;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoL9E;AA8DD,wBAAgB,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiD3F"}
package/build/http.js CHANGED
@@ -101,6 +101,34 @@ const LOGIN_CHALLENGE = {
101
101
  error: "insufficient_scope",
102
102
  error_description: "You need to login to continue",
103
103
  };
104
+ /** Public docs page that browsers and crawlers land on when they open /mcp without a key. */
105
+ export const MCP_DOCS_URL = "https://www.desearch.ai/docs/guide/sdk/mcp";
106
+ /**
107
+ * A plain page view of /mcp: GET or HEAD, Accept asks for HTML, and nothing
108
+ * marks it as an MCP client (no SSE Accept, no MCP session or protocol header).
109
+ * MCP clients send `Accept: text/event-stream` on GET, so they keep the 401
110
+ * challenge that drives their OAuth or key prompt.
111
+ */
112
+ function isBrowserPageView(request) {
113
+ if (request.method !== "GET" && request.method !== "HEAD") {
114
+ return false;
115
+ }
116
+ const accept = (request.headers.get("accept") ?? "").toLowerCase();
117
+ if (!accept.includes("text/html") || accept.includes("text/event-stream")) {
118
+ return false;
119
+ }
120
+ return !request.headers.has("mcp-session-id") && !request.headers.has("mcp-protocol-version");
121
+ }
122
+ function docsRedirect() {
123
+ return new Response(null, {
124
+ status: 301,
125
+ headers: {
126
+ Location: MCP_DOCS_URL,
127
+ Vary: "Accept",
128
+ "Cache-Control": "no-store",
129
+ },
130
+ });
131
+ }
104
132
  const UNAUTHORIZED_MESSAGE = "Unauthorized. Send your Desearch API key in the Authorization: Bearer <key> header or the x-api-key header.";
105
133
  function challengeHeader(request, challenge) {
106
134
  try {
@@ -248,6 +276,7 @@ function requestWithJsonBody(request, body) {
248
276
  * JSON responses (not a long-lived SSE session) so the same handler runs
249
277
  * in a local Node process and in a Vercel function.
250
278
  * GET and DELETE return 405: this server does not push messages or store sessions.
279
+ * A keyless browser GET (Accept: text/html) is sent to the public MCP docs page instead.
251
280
  */
252
281
  export async function handleMcpHttpRequest(request) {
253
282
  if (request.method === "OPTIONS") {
@@ -364,6 +393,9 @@ export async function handleMcpHttpRequest(request) {
364
393
  if (credential.kind === "unavailable") {
365
394
  return withCors(jsonRpcError(500, -32603, "Authorization storage is unavailable."));
366
395
  }
396
+ if (credential.kind === "anonymous" && isBrowserPageView(request)) {
397
+ return withCors(docsRedirect());
398
+ }
367
399
  if (request.method === "GET" || request.method === "DELETE") {
368
400
  if (credential.kind !== "key") {
369
401
  return withCors(unauthorized(request, credential.kind === "unauthorized"));
package/build/server.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type Icon } from "@modelcontextprotocol/sdk/types.js";
3
3
  import { type PeopleClient } from "./people.js";
4
4
  import { type CompanyClient } from "./companies.js";
5
5
  export declare const SERVER_NAME = "Desearch";
6
- export declare const SERVER_VERSION = "0.10.0";
6
+ export declare const SERVER_VERSION = "0.11.0";
7
7
  export declare const SERVER_TITLE = "Desearch";
8
8
  export declare const SERVER_WEBSITE_URL = "https://www.desearch.ai";
9
9
  export declare const MCP_PUBLIC_BASE_URL: string;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAKH,KAAK,IAAI,EAEZ,MAAM,oCAAoC,CAAC;AAK5C,OAAO,EAqBH,KAAK,YAAY,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAeH,KAAK,aAAa,EACrB,MAAM,gBAAgB,CAAC;AAIxB,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,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AC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7F,OAAO,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AA4YD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAuCvD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYzD;AA4JD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,cAAc,EACvB,YAAY,CAAC,EAAE,YAAY,EAC3B,aAAa,CAAC,EAAE,aAAa,GAC9B,SAAS,CA08CX"}
package/build/server.js CHANGED
@@ -9,7 +9,7 @@ import { COMPANY_COUNTRIES_MAX, COMPANY_DOMAINS_MAX, COMPANY_EXCLUDE_MAX, COMPAN
9
9
  import { runSocialAction, socialActionNames } from "./social.js";
10
10
  import { AI_SEARCH_TOOLS, WEB_LINK_TOOLS, toolIdSchema } from "./tool-sources.js";
11
11
  export const SERVER_NAME = "Desearch";
12
- export const SERVER_VERSION = "0.10.0";
12
+ export const SERVER_VERSION = "0.11.0";
13
13
  export const SERVER_TITLE = "Desearch";
14
14
  export const SERVER_WEBSITE_URL = "https://www.desearch.ai";
15
15
  // Public origin of the hosted server, which serves the icons below.
@@ -395,6 +395,13 @@ export function presentSearchBody(value) {
395
395
  message: NO_LINKS_MESSAGE,
396
396
  };
397
397
  }
398
+ function summaryFirst(value) {
399
+ if (!isPlainObject(value) || !("summary" in value)) {
400
+ return value;
401
+ }
402
+ const { summary, ...rest } = value;
403
+ return { summary, ...rest };
404
+ }
398
405
  function ok(value) {
399
406
  return {
400
407
  content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
@@ -529,9 +536,9 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
529
536
  icons: SERVER_ICONS,
530
537
  };
531
538
  const server = new McpServer(serverInfo, {
532
- instructions: "Search the public web and X with Desearch. Use search for titles and links, then fetch with a result URL to read the page. search-api returns ranked pages with the passage that best matches the query. Other tools cover AI search, X posts, and page extraction. tiktok, facebook, instagram, youtube, reddit, and threads read public social data (posts, profiles, comments, hashtags, YouTube transcripts and channels, subreddits); list actions return next_cursor for the next page where the platform has one. People Search finds people and creators on X, YouTube, LinkedIn, and TikTok: people-search starts a paid job billed to the user's Desearch balance, people-search-status reads progress, people-search-pause, people-search-resume, and people-search-cancel pause, resume, or cancel it, and people-search-export returns the people found as CSV or JSON Lines. Company Search finds companies on the web from a description and Company Enrich reads the domains you send; both collect public emails, phones, social profiles, and leaders (CEO, founders, CTO, CFO): company-search and company-enrich start paid jobs billed to the user's Desearch balance, company-search-status reads progress and the companies, and company-search-pause, company-search-resume, and company-search-cancel pause, resume, or cancel a task. Set company-search's max_cost_usd only when the user agreed to that budget: it bills search effort even when few companies are found. Calls need a Desearch API key.",
539
+ instructions: "Search the public web and X with Desearch. Use search for titles and links, then fetch with a result URL to read the page. search-api is web search on the Desearch index: ranked pages with the passage that best matches the query, and with summary: true a short answer with numbered citations. ai-search covers X posts and web with an optional AI summary. Other tools cover X posts and page extraction. tiktok, facebook, instagram, youtube, reddit, and threads read public social data (posts, profiles, comments, hashtags, YouTube transcripts and channels, subreddits); list actions return next_cursor for the next page where the platform has one. People Search finds people and creators on X, YouTube, LinkedIn, and TikTok: people-search starts a paid job billed to the user's Desearch balance, people-search-status reads progress, people-search-pause, people-search-resume, and people-search-cancel pause, resume, or cancel it, and people-search-export returns the people found as CSV or JSON Lines. Company Search finds companies on the web from a description and Company Enrich reads the domains you send; both collect public emails, phones, social profiles, and leaders (CEO, founders, CTO, CFO): company-search and company-enrich start paid jobs billed to the user's Desearch balance, company-search-status reads progress and the companies, and company-search-pause, company-search-resume, and company-search-cancel pause, resume, or cancel a task. Set company-search's max_cost_usd only when the user agreed to that budget: it bills search effort even when few companies are found. Calls need a Desearch API key.",
533
540
  });
534
- registerTool(server, apiKey, "ai-search", "AI Search", "AI search and analysis on web using Desearch AI", {
541
+ registerTool(server, apiKey, "ai-search", "AI Search", "AI Search over X (Twitter) posts and web (from the Desearch index), with an optional AI summary. Web results are capped at 20 per request. For web-only search, use search-api.", {
535
542
  prompt: z.string().describe("Question, example: 'What is the latest news on AI?'"),
536
543
  tools: z
537
544
  .array(toolIdSchema(AI_SEARCH_TOOLS))
@@ -664,7 +671,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
664
671
  return fail("Web Search error", error);
665
672
  }
666
673
  });
667
- registerTool(server, apiKey, "web-links-search", "Web Links Search", "Search the web for links using Desearch. Only the web source is accepted.", {
674
+ registerTool(server, apiKey, "web-links-search", "Web Links Search", "Deprecated: use search-api. Search the web for links using Desearch (POST /desearch/ai/search/links/web). Only the web source is accepted.", {
668
675
  prompt: z
669
676
  .string()
670
677
  .describe("Search query prompt, example: 'open source browser automation tools'"),
@@ -820,7 +827,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
820
827
  return fail("X Trends error", error);
821
828
  }
822
829
  });
823
- registerTool(server, apiKey, "search-api", "Search API", "Search the web with the Desearch Search API and return ranked pages, each with its title, URL, publication date when known, and the passage that best matches the query. Set page_text to add each page's full text. Returns { results, cost_usd, usage_count, service, currency }. Use search for titles and links only, and web-search for SERP-style snippets.", {
830
+ registerTool(server, apiKey, "search-api", "Search API", "Web search on the Desearch index (POST /search). Returns ranked pages, each with its title, URL, publication date when known, and the passage that best matches the query. Set summary: true for a short answer written from the results with numbered citations; [n] in summary.text refers to summary.citations[].index. Set page_text to add each page's full text. Returns { summary, results, meta, cost_usd, usage_count, service, currency }, with summary first when requested; summary is null and meta.notices says 'Summary unavailable.' when it could not be written. Use search for titles and links only, and web-search for SERP-style snippets.", {
824
831
  query: z.string().min(1).max(2000).describe("Search query, example: 'Who won the 2024 Nobel Prize in Physics?'"),
825
832
  mode: z
826
833
  .enum(["fast", "balanced"])
@@ -849,10 +856,37 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
849
856
  .optional()
850
857
  .describe("Include the passage that best matches the query (API default true)."),
851
858
  page_text: z.boolean().optional().describe("Include each page's full text (API default false)."),
852
- }, async ({ query, mode, count, start_date, end_date, highlights, page_text }) => {
859
+ include_domains: z
860
+ .array(z.string())
861
+ .max(100)
862
+ .optional()
863
+ .describe("Only pages on these domains or their subdomains (at most 100), example: ['bbc.com', 'reuters.com']"),
864
+ exclude_domains: z
865
+ .array(z.string())
866
+ .max(1200)
867
+ .optional()
868
+ .describe("Never pages on these domains or their subdomains (at most 1,200). Wins over include_domains and site:."),
869
+ summary: z
870
+ .boolean()
871
+ .optional()
872
+ .describe("Also return a short answer written from the results, with numbered citations (API default false). No extra charge."),
873
+ }, async ({ query, mode, count, start_date, end_date, highlights, page_text, include_domains, exclude_domains, summary, }) => {
853
874
  try {
854
- const body = { query, ...definedFields({ mode, count, start_date, end_date, highlights, page_text }) };
855
- return ok((await api("POST", "/search", { body })).data);
875
+ const body = {
876
+ query,
877
+ ...definedFields({
878
+ mode,
879
+ count,
880
+ start_date,
881
+ end_date,
882
+ highlights,
883
+ page_text,
884
+ include_domains,
885
+ exclude_domains,
886
+ summary,
887
+ }),
888
+ };
889
+ return ok(summaryFirst((await api("POST", "/search", { body })).data));
856
890
  }
857
891
  catch (error) {
858
892
  return fail("Search API error", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desearch-mcp-server",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "mcpName": "io.github.Desearch-ai/mcp-desearch",
5
5
  "description": "AI search (web, Reddit, Hacker News, arXiv, Wikipedia, and Twitter), X (Twitter) search, web search, the Search API, public TikTok, Facebook, Instagram, YouTube (including transcripts), Reddit, and Threads data, People Search exports, page extraction, X data, People Search (find people and creators on X, YouTube, LinkedIn, and TikTok), and Company Search (find companies and their public contacts and leaders, or enrich domains you send) tools for AI agents. Includes 39 tools.",
6
6
  "license": "MIT",