desearch-mcp-server 0.8.0 → 0.9.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 +13 -0
- package/README.md +12 -5
- package/build/companies.d.ts +25 -8
- package/build/companies.d.ts.map +1 -1
- package/build/companies.js +58 -4
- package/build/server.d.ts +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +23 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
Company Search: a search budget (`max_cost_usd`) and continuing an ended search (`continue_from`), the two optional `POST /desearch/companies/search` fields of desearch-public-api #624. Both wait for that API release; until then the API answers 422 to them.
|
|
6
|
+
|
|
7
|
+
- `company-search` takes `max_cost_usd` (a number, more than 0, up to 100) and `continue_from` (a Company Search `task_id`) and sends them only when set. `company-enrich` takes neither.
|
|
8
|
+
- `max_cost_usd`: the whole budget is reserved (`reserved_cost_usd`), and the search goes on until it delivers `count` or spends it, instead of stopping at `cost_limit` once it costs more than the companies it found pay for. Its search effort is billed where the companies delivered do not cover it, up to the budget, even when it finds few companies or none. A budget below what `count` reserves is an HTTP 422 from the API. The argument, the tool description, and the server instructions tell the agent to set it only when the user agreed to that amount.
|
|
9
|
+
- `continue_from`: the new search leaves out every company the ended search delivered, held for review, or was told to exclude. The description says to send the same query and filters with the count still wanted, and that the API answers 409 while that task has not ended and 404 when it is not the caller's Company Search.
|
|
10
|
+
- The `query` argument and the `company-search` description name the form that checks only the companies a query names: "Restrict this search to Acme (acme.com.au) and Beta (beta.co.uk). Return only those." (no web search, `only_domains`, `completion_reason: "all_domains_processed"`). Companies named without their websites get warning `scope_not_applied`.
|
|
11
|
+
- Task summaries (`company-search`, `company-search-status`, the control tools, `company-search-tasks`) show `max_cost_usd` and `continue_from` from the stored request and `only_domains` from the query's interpretation, when set. `progress.effort_units` (budgeted searches) passes through with `progress`.
|
|
12
|
+
- The `next` hint of a search that a limit stopped before `count` (`coverage_limited`) now says how to continue it: offer the user a new `company-search` with the same query and filters, `continue_from` set to its `task_id`, and the count still wanted (at least 5). Without a budget it adds that the user may set `max_cost_usd`, which bills search effort, and only with the user's agreement; a `cost_limit` stop says whether the search ran out of its budget or stopped because it cost more than its companies pay for. Company Enrich tasks get no continue hint. The hint says "a limit stopped it", no longer "a budget stopped it". A cancelled search with a budget says it pays for its search effort so far when that is more than the companies delivered.
|
|
13
|
+
- `company-search-cancel` says the same. The `company-search` cost text now gives a minimum of 1 company when a search delivers any (the API's minimum since 2026-11-02), no longer 2.
|
|
14
|
+
- Every version (package, `server.json`, the Gemini extension, the plugin manifests, and `SERVER_VERSION`) is 0.9.0. The tool count is unchanged (39).
|
|
15
|
+
|
|
3
16
|
## 0.8.0
|
|
4
17
|
|
|
5
18
|
YouTube, Reddit, and Threads: three new tools (39 in total) for the 16 public routes tagged YouTube Search, Reddit Search, and Threads Search. They are not in `desearch-js` 1.5, so they use the same `social.ts` action table and direct API calls (`desearch-api.ts`) as `tiktok`, `facebook`, and `instagram`. Each request is billed as one unit (an empty page included; a 404, a 422, and a 5xx are free).
|
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/desearch-mcp-server)
|
|
4
4
|
[](https://github.com/Desearch-ai/mcp-desearch/stargazers)
|
|
5
|
+
[](https://www.opensourcealternatives.to)
|
|
5
6
|
|
|
6
7
|
If Desearch is useful, a [star](https://github.com/Desearch-ai/mcp-desearch/stargazers) helps others find it.
|
|
7
8
|
|
|
@@ -51,7 +52,7 @@ Example output:
|
|
|
51
52
|
|
|
52
53
|
The tool returns that JSON as pretty-printed text: `{ "content": [{ "type": "text", "text": "<json above>" }] }`.
|
|
53
54
|
|
|
54
|
-
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.
|
|
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.9.0 exposes 39 tools.
|
|
55
56
|
|
|
56
57
|
## Tools
|
|
57
58
|
|
|
@@ -91,12 +92,12 @@ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destruc
|
|
|
91
92
|
- **List People Search Tasks** (`people-search-tasks`): Your searches, newest first. Arguments: `platform` (optional), `status` (optional list, for example `["running", "paused"]`), `limit` (optional, 1–100), `cursor` (optional), `metadata` (optional, up to 3 labels a task must have, for example `{"campaign": "q4-outbound"}`). Free; lists tasks, not the people they found.
|
|
92
93
|
- **List People Found** (`people-profiles`): Everyone your own searches found on one platform, one entry per person, with the search that found them. Runs no new search and queries no outside source. Arguments: `platform` (required), `q` (optional text in name, handle, bio, or location), `sort` (optional: `score`, `recent`, or `audience`), `limit` (optional, 1–200, default 25), `cursor` (optional), and the filters `has` (channels every person must have: `email`, `website`, `x`, `linkedin`, `instagram`, `youtube`, `tiktok`), `min_audience`, `max_audience`, `min_score`, `location`, `verified`. Free.
|
|
93
94
|
- **Export People Found** (`people-search-export`): The people your searches found as CSV or JSON Lines text. Pass `task_id` to export one search, or `platform` (without `task_id`) to export everyone found on that platform, with the same `q`, `sort`, and filters as `people-profiles`. Arguments: `task_id` or `platform`, `format` (optional, `csv` or `jsonl`, default `csv`), `has`, `min_audience`, `max_audience`, `min_score`, `location`, `verified`, `q` and `sort` (platform export only), `max_rows` (optional, 1–1000, default 100). The reply is a note, then the file text cut at a row boundary to `max_rows` rows and 50,000 characters; the note says how many rows were cut. Free.
|
|
94
|
-
- **Company Search** (`company-search`): Start a paid job billed to the user's Desearch balance: find companies on the web that match a plain-language description and collect each one's public contact data. Arguments: `query` (required, 3–1000 characters), `count` (optional, 5–200, API default 25), `min_score` (optional, 0–100), `exclude` (optional domains or URLs, up to 1000), `countries` (optional ISO 3166-1 alpha-2 codes or names, up to 20), `require` (optional: `email`, `phone`, `linkedin`, `leader`, `leader_email`), `roles` (optional, below), `infer_emails` (optional, default `true`), `verify_emails` (optional, default `true`), `metadata` (optional labels, as on `people-search`), `idempotency_key` (optional). `countries` and `require` are sent as the API's `filters`. Returns the `task_id`, status, and `reserved_cost_usd` (`count` times the Company Search per-company price at the time of the call
|
|
95
|
+
- **Company Search** (`company-search`): Start a paid job billed to the user's Desearch balance: find companies on the web that match a plain-language description and collect each one's public contact data. Arguments: `query` (required, 3–1000 characters), `count` (optional, 5–200, API default 25), `min_score` (optional, 0–100), `exclude` (optional domains or URLs, up to 1000), `countries` (optional ISO 3166-1 alpha-2 codes or names, up to 20), `require` (optional: `email`, `phone`, `linkedin`, `leader`, `leader_email`), `roles` (optional, below), `infer_emails` (optional, default `true`), `verify_emails` (optional, default `true`), `metadata` (optional labels, as on `people-search`), `idempotency_key` (optional), `max_cost_usd` (optional search budget in USD, more than 0 and up to 100; set it only with the user's agreement), `continue_from` (optional `task_id` of an ended Company Search, to find only new companies). `countries` and `require` are sent as the API's `filters`. Returns the `task_id`, status, and `reserved_cost_usd` (`count` times the Company Search per-company price at the time of the call, or the whole `max_cost_usd`; prices at https://desearch.ai/pricing); the ended task carries `final_cost_usd`. A query that names companies with their websites ("Restrict this search to Acme (acme.com.au) and Beta (beta.co.uk). Return only those.") checks only those domains. Public data only: each company's own website, public web search results, and public LinkedIn profiles of its leaders.
|
|
95
96
|
- **Company Enrich** (`company-enrich`): Start a paid job billed to the user's Desearch balance: the same public contact data for companies you already know. Arguments: `domains` (required, 1–200 domains or URLs; reduced to the host without `www.`, lowercased, deduplicated), `roles`, `infer_emails`, `verify_emails`, `metadata`, `idempotency_key` (all optional). One company per domain, with `score: null`. Reserves one company per domain sent at the Company Enrich per-company price; duplicates and companies it does not deliver are returned when the task ends.
|
|
96
97
|
- **Company Search Status** (`company-search-status`): A Company Search or Company Enrich task's status, progress, and cost, plus a page of the companies delivered so far. Arguments: `task_id` (required), `cursor` (optional, `next_cursor` from the previous call), `limit` (optional, 1–100, default 10), `include_companies` (optional, default `true`). Free.
|
|
97
98
|
- **Pause Company Search** (`company-search-pause`): Pause a task. No data is lost and billing does not change; `company-search-resume` continues where it stopped with no new charge. A task paused for more than 7 days is cancelled by the API. Argument: `task_id` (required). Free.
|
|
98
99
|
- **Resume Company Search** (`company-search-resume`): Resume a paused task from where it stopped, with no new charge (409 when it is not paused). Argument: `task_id` (required). Free.
|
|
99
|
-
- **Cancel Company Search** (`company-search-cancel`): Stop a task for good. You pay only for the companies it already delivered; the rest of the reservation is returned. Cannot be undone. Argument: `task_id` (required). Free.
|
|
100
|
+
- **Cancel Company Search** (`company-search-cancel`): Stop a task for good. You pay only for the companies it already delivered (a search with `max_cost_usd`: its search effort so far when that is more, up to the budget); the rest of the reservation is returned. Cannot be undone. Argument: `task_id` (required). Free.
|
|
100
101
|
- **List Company Search Tasks** (`company-search-tasks`): Your Company Search and Company Enrich tasks, newest first. Arguments: `type` (optional, `search` or `enrich`), `status` (optional list), `limit` (optional, 1–100), `cursor` (optional), `metadata` (optional, up to 3 labels, exact match). Free; People Search tasks are not listed here.
|
|
101
102
|
|
|
102
103
|
The full SDK method → endpoint → MCP tool map is in [docs/API_MCP_PARITY.md](docs/API_MCP_PARITY.md). Every public `desearch-js` 1.5 method is a tool. `latestTweets` was removed from the SDK (`GET /twitter/latest` in 1.0.1) and is not exposed. People Search, Company Search, the TikTok, Facebook, Instagram, YouTube, Reddit, and Threads routes, and `POST /search` are not in `desearch-js` 1.5; those tools call the routes directly (`/desearch/people/*`, `/desearch/companies/*`, and the rest), and the parity doc lists them too. The network stats routes (`/network/stats`) are not MCP tools.
|
|
@@ -294,12 +295,18 @@ Company Search finds companies on the web that match a plain-language descriptio
|
|
|
294
295
|
|
|
295
296
|
A task runs in the background, like a People Search:
|
|
296
297
|
|
|
297
|
-
1. `company-search` or `company-enrich` starts a paid job billed to the user's Desearch balance and returns a `task_id` at once. Company Search reserves `count` companies at its per-company price, Company Enrich one company per domain sent at its own price (prices at https://desearch.ai/pricing). When the task ends you pay only for the companies it delivered (
|
|
298
|
+
1. `company-search` or `company-enrich` starts a paid job billed to the user's Desearch balance and returns a `task_id` at once. Company Search reserves `count` companies at its per-company price, Company Enrich one company per domain sent at its own price (prices at https://desearch.ai/pricing). When the task ends you pay only for the companies it delivered (a minimum of 1 when it delivers any; a task that delivers none is free), and the rest of the reservation is returned. A company left out by `min_score` or `require` is not billed. Send the same `idempotency_key` to retry a call without starting, or paying for, a second task.
|
|
298
299
|
2. `company-search-status` returns the task's status, progress, cost, and a page of companies. Each company goes through stages: `profile` (its homepage, and the fit score), `contacts` (its contact, about, team, and imprint pages), `people` (its leaders), `email_patterns` (inferred leader emails), and `email_check` (every email checked: `valid`, `invalid`, `risky`, or `unknown`). A company is delivered as soon as the stages the request needs have run, with `enrichment.status: "partial"`, and later stages fill it in until it is `complete`. Pass `next_cursor` back as `cursor` to get only new companies; call without `cursor` to read every company in its latest version. `stage: "enriching"` means every company is delivered and only later stages are left. The `next` hint says which to do, and reminds you to read once more without `cursor` after the task ends if you read companies while it ran.
|
|
299
300
|
3. `company-search-pause`, `company-search-resume`, and `company-search-cancel` pause, resume, or cancel it. `company-search-tasks` lists your tasks, filtered by `type` (`search` or `enrich`), `status`, or `metadata`.
|
|
300
301
|
|
|
301
302
|
A People Search `task_id` is a 404 on the company tools, and a company `task_id` is a 404 on the People Search tools. Companies stay readable for 30 days after a task ends.
|
|
302
303
|
|
|
304
|
+
Without a budget, a Company Search stops once it costs more than the companies it found pay for (`completion_reason: "cost_limit"`, `coverage_limited: true`). `max_cost_usd` is the user's search budget in USD (more than 0, up to 100, and at least what `count` reserves; less is an HTTP 422 that gives the minimum). The whole budget is reserved, the search goes on until it delivers `count` or spends the budget, and its search effort is billed where the companies delivered do not cover it, up to the budget, even when it finds few companies or none. The unused part is returned. Agents must set it only when the user agreed to that amount. The task then shows `max_cost_usd`, and `progress.effort_units` once it ended.
|
|
305
|
+
|
|
306
|
+
`continue_from` takes the `task_id` of an ended Company Search: the new search leaves out every company that one delivered, held for review, or was told to exclude, so it finds only new ones. Send the same query and filters with the count still wanted. The API answers 409 while that task has not ended and 404 when it is not your Company Search. When a limit stopped a search before `count`, the `next` hint says how to continue it.
|
|
307
|
+
|
|
308
|
+
A query that names the only companies wanted, with their websites ("Restrict this search to Acme (acme.com.au) and Beta (beta.co.uk). Return only those."), checks only those domains against the rest of the description, with no web search: the task lists them as `only_domains` and ends with `completion_reason: "all_domains_processed"`. Companies named without their websites do not restrict the search, and the task has warning `scope_not_applied`.
|
|
309
|
+
|
|
303
310
|
`require` keeps only companies that have all of the listed contacts: `email`, `phone`, `linkedin` (the company's LinkedIn page), `leader` (one of `roles`), `leader_email` (a leader with an email). A company that does not have them once the stage that can show them has run is not delivered and not billed. `roles` takes any of `ceo`, `founder`, `cto`, `cfo`, `coo`, `cmo`, `president`, `owner`, `managing_director`; a managing director (Geschäftsführer) counts as `ceo` when `ceo` is asked for. `infer_emails: false` skips the inferred leader emails and `verify_emails: false` skips the email checks.
|
|
304
311
|
|
|
305
312
|
Prompt: find 25 Series A fintech startups in Berlin with a leader's email.
|
|
@@ -423,7 +430,7 @@ The output above is shortened to one company.
|
|
|
423
430
|
- Each email has `type` (`personal`, `leadership`, `sales`, `general`, `press`, `support`, `careers`, `legal`, `other`), `source` (`website`, `search`, `linkedin`, `inferred`), `source_url` (none for inferred ones), and `verification` (`valid`, `invalid`, `risky`, `unknown`; left out until the email checks ran). Inferred emails carry `confidence` (`high`: the pattern was learned from this company's own addresses; `low`: a common pattern) and `pattern`.
|
|
424
431
|
- `primary_email` is never a `support`, `legal`, `careers`, `press`, or `other` address, and an inferred one only when `valid`. `primary_contact` is the leader to reach first, with why.
|
|
425
432
|
- Each leader has `roles` (from the request's `roles`), `verified` (a quote on the company's own site or their current LinkedIn position shows the role), and `evidence_url` (the page that shows it).
|
|
426
|
-
- `completion_reason` adds `all_domains_processed` (Company Enrich read every domain) to People Search's values. `warnings` keep their `code` and `message`, for example `enrichment_time_limit` when some companies were not fully enriched before the task's time limit.
|
|
433
|
+
- `completion_reason` adds `all_domains_processed` (Company Enrich, or a search restricted to the domains its query names, read every domain) to People Search's values. `warnings` keep their `code` and `message`, for example `enrichment_time_limit` when some companies were not fully enriched before the task's time limit.
|
|
427
434
|
|
|
428
435
|
CSV and JSON Lines downloads (`GET /desearch/companies/tasks/{task_id}/export`) are not MCP tools; call the API directly for a file.
|
|
429
436
|
|
package/build/companies.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { type PeopleApiResponse, type PeopleControlAction } from "./people.js";
|
|
|
10
10
|
* - `POST /desearch/companies/search` finds companies from a description and
|
|
11
11
|
* `POST /desearch/companies/enrich` reads the domains you send. Both are billed:
|
|
12
12
|
* they reserve companies at the route price and settle to what they deliver.
|
|
13
|
+
* A search with `max_cost_usd` reserves that budget instead and also bills its
|
|
14
|
+
* search effort where the companies it delivers do not cover it.
|
|
13
15
|
* - Every other route (tasks, results, pause/resume/cancel) is free. Both kinds of task
|
|
14
16
|
* run on the People Search engine, but a People Search task_id is a 404 on these
|
|
15
17
|
* routes and a company task_id is a 404 on People Search's.
|
|
@@ -35,6 +37,10 @@ export type CompanyTaskType = (typeof COMPANY_TASK_TYPES)[number];
|
|
|
35
37
|
export declare const COMPANY_DOMAINS_MAX = 200;
|
|
36
38
|
export declare const COMPANY_COUNTRIES_MAX = 20;
|
|
37
39
|
export declare const COMPANY_EXCLUDE_MAX = 1000;
|
|
40
|
+
/** The largest `max_cost_usd` (model/companies.py COMPANY_SEARCH_MAX_BUDGET_USD). */
|
|
41
|
+
export declare const COMPANY_SEARCH_MAX_BUDGET_USD = 100;
|
|
42
|
+
/** `count` on `POST /desearch/companies/search` (model/people.py PEOPLE_COUNT_MIN). */
|
|
43
|
+
export declare const COMPANY_COUNT_MIN = 5;
|
|
38
44
|
interface CompanyTaskOptions {
|
|
39
45
|
roles?: CompanyRole[];
|
|
40
46
|
infer_emails?: boolean;
|
|
@@ -49,6 +55,8 @@ export interface CompanySearchArgs extends CompanyTaskOptions {
|
|
|
49
55
|
exclude?: string[];
|
|
50
56
|
countries?: string[];
|
|
51
57
|
require?: CompanyRequirement[];
|
|
58
|
+
max_cost_usd?: number;
|
|
59
|
+
continue_from?: string;
|
|
52
60
|
}
|
|
53
61
|
export interface CompanyEnrichArgs extends CompanyTaskOptions {
|
|
54
62
|
domains: string[];
|
|
@@ -83,25 +91,34 @@ export declare function compactCompany(company: unknown): Record<string, unknown
|
|
|
83
91
|
/**
|
|
84
92
|
* Task fields an agent polls on. `progress` is the worker's counters, passed through
|
|
85
93
|
* without its copy of `warnings` (listed once, at the top). `completion_reason` appears
|
|
86
|
-
* once the task has ended, `coverage_limited` only when true.
|
|
94
|
+
* once the task has ended, `coverage_limited` only when true. `max_cost_usd` and
|
|
95
|
+
* `continue_from` come from the stored request (a search with a budget, or one that continues
|
|
96
|
+
* an earlier search), `only_domains` from how the query was read (a search restricted to the
|
|
97
|
+
* domains it names).
|
|
87
98
|
*/
|
|
88
99
|
export declare function compactCompanyTask(task: unknown, options?: {
|
|
89
100
|
progress?: boolean;
|
|
90
101
|
}): Record<string, unknown>;
|
|
102
|
+
type NextTask = {
|
|
103
|
+
task_id?: unknown;
|
|
104
|
+
search_type?: unknown;
|
|
105
|
+
stage?: unknown;
|
|
106
|
+
completion_reason?: unknown;
|
|
107
|
+
coverage_limited?: unknown;
|
|
108
|
+
count?: unknown;
|
|
109
|
+
result_count?: unknown;
|
|
110
|
+
max_cost_usd?: unknown;
|
|
111
|
+
};
|
|
91
112
|
/**
|
|
92
113
|
* One sentence (or two) on what to do next, so an agent does not have to infer it from the status.
|
|
93
114
|
* `nextCursor` is the results cursor when the caller just read a page of companies.
|
|
94
|
-
* `task` adds the stage (`enriching`)
|
|
115
|
+
* `task` adds the stage (`enriching`), why an ended task stopped, and whether it had a budget
|
|
116
|
+
* (`max_cost_usd`): a search a limit stopped before `count` also says how to continue it.
|
|
95
117
|
* `page.partial` counts the companies on this page whose enrichment is still `partial`;
|
|
96
118
|
* `page.readAfterStart` is true when the caller passed a cursor, so it may hold older
|
|
97
119
|
* versions of companies it read before.
|
|
98
120
|
*/
|
|
99
|
-
export declare function companyNextStep(status: string | undefined, nextCursor?: string, hasMore?: boolean, task?: {
|
|
100
|
-
stage?: unknown;
|
|
101
|
-
completion_reason?: unknown;
|
|
102
|
-
coverage_limited?: unknown;
|
|
103
|
-
count?: unknown;
|
|
104
|
-
}, page?: {
|
|
121
|
+
export declare function companyNextStep(status: string | undefined, nextCursor?: string, hasMore?: boolean, task?: NextTask, page?: {
|
|
105
122
|
partial?: number;
|
|
106
123
|
readAfterStart?: boolean;
|
|
107
124
|
}): string;
|
package/build/companies.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companies.d.ts","sourceRoot":"","sources":["../companies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAUH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAC3B,MAAM,aAAa,CAAC;AAErB
|
|
1
|
+
{"version":3,"file":"companies.d.ts","sourceRoot":"","sources":["../companies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAUH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAC3B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qFAAqF;A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AC,CAMlC;AAED,sGAAsG;AACtG,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,GACxF,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA+BlC;AAED,uGAAuG;AACvG,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GACvD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAIlC;AAED,kGAAkG;AAClG,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE;IACF,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,GACF,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgBlC"}
|
package/build/companies.js
CHANGED
|
@@ -10,6 +10,8 @@ import { PEOPLE_API_BASE_URL, PEOPLE_ENDED_STATUSES, PEOPLE_TASK_STATUSES, array
|
|
|
10
10
|
* - `POST /desearch/companies/search` finds companies from a description and
|
|
11
11
|
* `POST /desearch/companies/enrich` reads the domains you send. Both are billed:
|
|
12
12
|
* they reserve companies at the route price and settle to what they deliver.
|
|
13
|
+
* A search with `max_cost_usd` reserves that budget instead and also bills its
|
|
14
|
+
* search effort where the companies it delivers do not cover it.
|
|
13
15
|
* - Every other route (tasks, results, pause/resume/cancel) is free. Both kinds of task
|
|
14
16
|
* run on the People Search engine, but a People Search task_id is a 404 on these
|
|
15
17
|
* routes and a company task_id is a 404 on People Search's.
|
|
@@ -42,6 +44,10 @@ export const COMPANY_TASK_TYPES = ["search", "enrich"];
|
|
|
42
44
|
export const COMPANY_DOMAINS_MAX = 200;
|
|
43
45
|
export const COMPANY_COUNTRIES_MAX = 20;
|
|
44
46
|
export const COMPANY_EXCLUDE_MAX = 1000;
|
|
47
|
+
/** The largest `max_cost_usd` (model/companies.py COMPANY_SEARCH_MAX_BUDGET_USD). */
|
|
48
|
+
export const COMPANY_SEARCH_MAX_BUDGET_USD = 100;
|
|
49
|
+
/** `count` on `POST /desearch/companies/search` (model/people.py PEOPLE_COUNT_MIN). */
|
|
50
|
+
export const COMPANY_COUNT_MIN = 5;
|
|
45
51
|
export function createCompanyClient(apiKey, baseUrl = PEOPLE_API_BASE_URL) {
|
|
46
52
|
return companyClientFor(createDesearchApi(apiKey, baseUrl));
|
|
47
53
|
}
|
|
@@ -100,6 +106,10 @@ export function companySearchBody(args) {
|
|
|
100
106
|
body.min_score = args.min_score;
|
|
101
107
|
if (args.exclude !== undefined)
|
|
102
108
|
body.exclude = args.exclude;
|
|
109
|
+
if (args.max_cost_usd !== undefined)
|
|
110
|
+
body.max_cost_usd = args.max_cost_usd;
|
|
111
|
+
if (args.continue_from !== undefined)
|
|
112
|
+
body.continue_from = args.continue_from;
|
|
103
113
|
leaderFields(args, body);
|
|
104
114
|
const filters = {};
|
|
105
115
|
if (args.countries !== undefined)
|
|
@@ -246,10 +256,14 @@ function compactWarning(warning) {
|
|
|
246
256
|
/**
|
|
247
257
|
* Task fields an agent polls on. `progress` is the worker's counters, passed through
|
|
248
258
|
* without its copy of `warnings` (listed once, at the top). `completion_reason` appears
|
|
249
|
-
* once the task has ended, `coverage_limited` only when true.
|
|
259
|
+
* once the task has ended, `coverage_limited` only when true. `max_cost_usd` and
|
|
260
|
+
* `continue_from` come from the stored request (a search with a budget, or one that continues
|
|
261
|
+
* an earlier search), `only_domains` from how the query was read (a search restricted to the
|
|
262
|
+
* domains it names).
|
|
250
263
|
*/
|
|
251
264
|
export function compactCompanyTask(task, options = {}) {
|
|
252
265
|
const t = objectOf(task);
|
|
266
|
+
const request = objectOf(t.request);
|
|
253
267
|
const status = typeof t.status === "string" ? t.status : undefined;
|
|
254
268
|
let progress;
|
|
255
269
|
if (options.progress) {
|
|
@@ -266,6 +280,9 @@ export function compactCompanyTask(task, options = {}) {
|
|
|
266
280
|
metadata: t.metadata,
|
|
267
281
|
count: t.count,
|
|
268
282
|
result_count: t.result_count,
|
|
283
|
+
max_cost_usd: numberOf(request.max_cost_usd),
|
|
284
|
+
continue_from: stringOf(request.continue_from),
|
|
285
|
+
only_domains: strings(objectOf(objectOf(t.interpreted).interpretation).only_domains),
|
|
269
286
|
completion_reason: stringOf(t.completion_reason),
|
|
270
287
|
coverage_limited: t.coverage_limited === true ? true : undefined,
|
|
271
288
|
warnings: arrayOf(t.warnings).map(compactWarning),
|
|
@@ -280,10 +297,35 @@ export function compactCompanyTask(task, options = {}) {
|
|
|
280
297
|
});
|
|
281
298
|
}
|
|
282
299
|
const LATEST = "call company-search-status without cursor to read every company in its latest version";
|
|
300
|
+
/**
|
|
301
|
+
* For a search a limit stopped before `count`: how to find more with `continue_from`, which
|
|
302
|
+
* leaves out every company this one delivered or held for review. A budget (`max_cost_usd`) is
|
|
303
|
+
* offered only as the user's choice, because it bills search effort even when little is found.
|
|
304
|
+
*/
|
|
305
|
+
function findMore(task) {
|
|
306
|
+
const id = typeof task.task_id === "string" ? `continue_from "${task.task_id}"` : "continue_from set to its task_id";
|
|
307
|
+
const count = numberOf(task.count);
|
|
308
|
+
const delivered = numberOf(task.result_count);
|
|
309
|
+
const left = count !== undefined && delivered !== undefined ? count - delivered : 0;
|
|
310
|
+
const wanted = left >= COMPANY_COUNT_MIN
|
|
311
|
+
? `count ${left} (the companies still wanted)`
|
|
312
|
+
: left > 0
|
|
313
|
+
? `count ${COMPANY_COUNT_MIN} (the least it takes; ${left} still wanted)`
|
|
314
|
+
: "count set to the companies still wanted";
|
|
315
|
+
const offer = `To find more, offer the user a new company-search with the same query and filters, ${id}, and ${wanted}: it leaves out every company this search delivered or held for review.`;
|
|
316
|
+
if (typeof task.max_cost_usd === "number") {
|
|
317
|
+
return `${offer} Set max_cost_usd on it only if the user agrees to a new budget.`;
|
|
318
|
+
}
|
|
319
|
+
if (task.completion_reason === "time_limit") {
|
|
320
|
+
return offer;
|
|
321
|
+
}
|
|
322
|
+
return `${offer} The user may also set a budget (max_cost_usd): the search then goes on until it delivers count or spends the budget, and bills its search effort up to the budget even when it finds few companies or none, so set it only with the user's agreement to that amount.`;
|
|
323
|
+
}
|
|
283
324
|
/**
|
|
284
325
|
* One sentence (or two) on what to do next, so an agent does not have to infer it from the status.
|
|
285
326
|
* `nextCursor` is the results cursor when the caller just read a page of companies.
|
|
286
|
-
* `task` adds the stage (`enriching`)
|
|
327
|
+
* `task` adds the stage (`enriching`), why an ended task stopped, and whether it had a budget
|
|
328
|
+
* (`max_cost_usd`): a search a limit stopped before `count` also says how to continue it.
|
|
287
329
|
* `page.partial` counts the companies on this page whose enrichment is still `partial`;
|
|
288
330
|
* `page.readAfterStart` is true when the caller passed a cursor, so it may hold older
|
|
289
331
|
* versions of companies it read before.
|
|
@@ -296,7 +338,7 @@ export function companyNextStep(status, nextCursor, hasMore = false, task = {},
|
|
|
296
338
|
if (hasMore) {
|
|
297
339
|
return `More companies are ready now: call ${again}.`;
|
|
298
340
|
}
|
|
299
|
-
const ended = (first) => {
|
|
341
|
+
const ended = (first, last) => {
|
|
300
342
|
const notes = [first];
|
|
301
343
|
if (partial > 0) {
|
|
302
344
|
notes.push(`${partial === 1 ? "1 company" : `${partial} companies`} on this page stayed partial: the task ended before every stage ran for ${partial === 1 ? "it" : "them"}.`);
|
|
@@ -304,6 +346,8 @@ export function companyNextStep(status, nextCursor, hasMore = false, task = {},
|
|
|
304
346
|
if (page.readAfterStart) {
|
|
305
347
|
notes.push("If you read companies while it ran, call company-search-status without cursor to read every company in its final version.");
|
|
306
348
|
}
|
|
349
|
+
if (last !== undefined)
|
|
350
|
+
notes.push(last);
|
|
307
351
|
return notes.join(" ");
|
|
308
352
|
};
|
|
309
353
|
switch (status) {
|
|
@@ -328,7 +372,14 @@ export function companyNextStep(status, nextCursor, hasMore = false, task = {},
|
|
|
328
372
|
case "completed":
|
|
329
373
|
if (task.coverage_limited === true) {
|
|
330
374
|
const wanted = typeof task.count === "number" ? `${task.count} companies` : "the count you asked for";
|
|
331
|
-
|
|
375
|
+
const budget = numberOf(task.max_cost_usd);
|
|
376
|
+
const why = task.completion_reason !== "cost_limit"
|
|
377
|
+
? `a limit stopped it (${String(task.completion_reason)})`
|
|
378
|
+
: budget !== undefined
|
|
379
|
+
? `it spent its search budget of $${budget} (max_cost_usd; cost_limit)`
|
|
380
|
+
: "it stopped once its search cost more than the companies it found pay for (cost_limit)";
|
|
381
|
+
// continue_from takes a Company Search only.
|
|
382
|
+
return ended(`Finished early: ${why} before it delivered ${wanted}, so more companies may match. You have every company it delivered.`, task.search_type === "company_enrich" ? undefined : findMore(task));
|
|
332
383
|
}
|
|
333
384
|
if (task.completion_reason === "no_candidates") {
|
|
334
385
|
return "Finished: its searches found no company to check. Try a broader description.";
|
|
@@ -345,6 +396,9 @@ export function companyNextStep(status, nextCursor, hasMore = false, task = {},
|
|
|
345
396
|
case "failed":
|
|
346
397
|
return "The task failed. See errors. A task that delivers no companies is not charged.";
|
|
347
398
|
case "cancelled":
|
|
399
|
+
if (typeof task.max_cost_usd === "number") {
|
|
400
|
+
return ended("Cancelled. A search with a budget pays for the companies it delivered or, when that is more, its search effort so far, up to max_cost_usd; the rest of the reservation is returned.");
|
|
401
|
+
}
|
|
348
402
|
return ended("Cancelled. You pay only for the companies it delivered; the rest of the reservation is returned.");
|
|
349
403
|
case "expired":
|
|
350
404
|
return "Results expired 30 days after the task ended.";
|
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.
|
|
6
|
+
export declare const SERVER_VERSION = "0.9.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;
|
package/build/server.d.ts.map
CHANGED
|
@@ -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;AAI5C,OAAO,EAqBH,KAAK,YAAY,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
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;AAI5C,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,UAAU,CAAC;AACtC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAG5D,eAAO,MAAM,mBAAmB,QAA6F,CAAC;AAE9H,eAAO,MAAM,YAAY,EAAE,IAAI,EAG9B,CAAC;AAEF,UAAU,cAAc;IACpB,KAAK,EAAE,MA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K,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;AAmVD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAuCvD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYzD;AAgJD;;;;;;;;;;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,CAo6CX"}
|
package/build/server.js
CHANGED
|
@@ -4,11 +4,11 @@ import DesearchImport from "desearch-js";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { createDesearchApi } from "./desearch-api.js";
|
|
6
6
|
import { PEOPLE_EXPORT_DEFAULT_ROWS, PEOPLE_EXPORT_FORMATS, PEOPLE_EXPORT_MAX_CHARS, PEOPLE_EXPORT_MAX_ROWS, PEOPLE_FILTER_CHANNELS, PEOPLE_METADATA_KEY_PATTERN, PEOPLE_METADATA_MAX_FILTERS, PEOPLE_METADATA_MAX_KEYS, PEOPLE_METADATA_VALUE_MAX, PEOPLE_PLATFORMS, PEOPLE_PROFILE_SORTS, PEOPLE_SEARCH_FILTERS, PEOPLE_TASK_STATUSES, controlPeopleTask, exportPeople, listPeopleProfiles, listPeopleTasks, peopleClientFor, readPeopleStatus, startPeopleSearch, } from "./people.js";
|
|
7
|
-
import { COMPANY_COUNTRIES_MAX, COMPANY_DOMAINS_MAX, COMPANY_EXCLUDE_MAX, COMPANY_REQUIREMENTS, COMPANY_ROLES, COMPANY_TASK_STATUSES, COMPANY_TASK_TYPES, companyClientFor, controlCompanyTask, listCompanyTasks, readCompanyStatus, startCompanyEnrich, startCompanySearch, } from "./companies.js";
|
|
7
|
+
import { COMPANY_COUNTRIES_MAX, COMPANY_DOMAINS_MAX, COMPANY_EXCLUDE_MAX, COMPANY_REQUIREMENTS, COMPANY_ROLES, COMPANY_SEARCH_MAX_BUDGET_USD, COMPANY_TASK_STATUSES, COMPANY_TASK_TYPES, companyClientFor, controlCompanyTask, listCompanyTasks, readCompanyStatus, startCompanyEnrich, startCompanySearch, } from "./companies.js";
|
|
8
8
|
import { runSocialAction, socialActionNames } from "./social.js";
|
|
9
9
|
import { AI_SEARCH_TOOLS, WEB_LINK_TOOLS, toolIdSchema } from "./tool-sources.js";
|
|
10
10
|
export const SERVER_NAME = "Desearch";
|
|
11
|
-
export const SERVER_VERSION = "0.
|
|
11
|
+
export const SERVER_VERSION = "0.9.0";
|
|
12
12
|
export const SERVER_TITLE = "Desearch";
|
|
13
13
|
export const SERVER_WEBSITE_URL = "https://www.desearch.ai";
|
|
14
14
|
// Public origin of the hosted server, which serves the icons below.
|
|
@@ -475,7 +475,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
475
475
|
icons: SERVER_ICONS,
|
|
476
476
|
};
|
|
477
477
|
const server = new McpServer(serverInfo, {
|
|
478
|
-
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. Calls need a Desearch API key.",
|
|
478
|
+
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.",
|
|
479
479
|
});
|
|
480
480
|
registerTool(server, apiKey, "ai-search", "AI Search", "AI search and analysis on web using Desearch AI", {
|
|
481
481
|
prompt: z.string().describe("Question, example: 'What is the latest news on AI?'"),
|
|
@@ -1264,7 +1264,10 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
1264
1264
|
}
|
|
1265
1265
|
}, undefined, READ_ONLY_OPEN_WORLD);
|
|
1266
1266
|
registerTool(server, apiKey, "company-search", "Company Search", "Start a paid job billed to the user's Desearch balance: find companies on the web that match a plain-language description, and collect each one's public contact data. Returns a task_id at once, with the task's status and reserved_cost_usd. " +
|
|
1267
|
-
"Cost: the call reserves count companies at the Company Search per-company price at the time of the call (reserved_cost_usd; prices at https://desearch.ai/pricing). When the task ends you pay only for the companies it delivered (final_cost_usd; a minimum of
|
|
1267
|
+
"Cost: without max_cost_usd, the call reserves count companies at the Company Search per-company price at the time of the call (reserved_cost_usd; prices at https://desearch.ai/pricing). When the task ends you pay only for the companies it delivered (final_cost_usd; a minimum of 1 when it delivers any; a task that delivers none is free) and the rest of the reservation is returned. A company left out by min_score or require is not billed. Such a search stops once it costs more than the companies it found pay for (completion_reason cost_limit, coverage_limited: true). " +
|
|
1268
|
+
"Search budget: with max_cost_usd the whole budget is reserved, and the search goes on until it delivers count or spends the budget. Its search effort is billed where the companies delivered do not cover it, up to the budget, even when it finds few companies or none; the unused part is returned. Set max_cost_usd only when the user agreed to spend that amount, never on your own. " +
|
|
1269
|
+
"Find more: when a search ended before count because a limit stopped it (coverage_limited, for example cost_limit), offer the user a new company-search with the same query and filters, continue_from set to its task_id, and count set to the companies still wanted, optionally with a budget the user agrees to. It leaves out every company the earlier search delivered or held for review, so it finds only new ones. " +
|
|
1270
|
+
"To check only companies you name, give their websites in query, for example 'Restrict this search to Acme (acme.com.au) and Beta (beta.co.uk). Return only those.' Only those domains are then checked against the rest of the description, with no web search (the task shows them as only_domains and ends with completion_reason all_domains_processed). Companies named without their websites do not restrict the search (warning scope_not_applied). " +
|
|
1268
1271
|
"Each company has a fit score (0-100) and why it matched, plus fully_verified and unverified_criteria (what its own pages do and do not confirm). " +
|
|
1269
1272
|
COMPANY_DATA +
|
|
1270
1273
|
COMPANY_RUNS +
|
|
@@ -1273,14 +1276,14 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
1273
1276
|
.string()
|
|
1274
1277
|
.min(3)
|
|
1275
1278
|
.max(1000)
|
|
1276
|
-
.describe("The companies you are looking for, in plain language: what they do, where, how far along. Example: 'Series A fintech startups in Berlin building payment infrastructure'."),
|
|
1279
|
+
.describe("The companies you are looking for, in plain language: what they do, where, how far along. Example: 'Series A fintech startups in Berlin building payment infrastructure'. To check only companies you name, give each one's website: 'Restrict this search to Acme (acme.com.au) and Beta (beta.co.uk). Return only those.' Only those domains are checked; companies named without a website do not restrict the search (warning scope_not_applied)."),
|
|
1277
1280
|
count: z
|
|
1278
1281
|
.number()
|
|
1279
1282
|
.int()
|
|
1280
1283
|
.min(5)
|
|
1281
1284
|
.max(200)
|
|
1282
1285
|
.optional()
|
|
1283
|
-
.describe("How many companies to deliver (5-200, API default 25).
|
|
1286
|
+
.describe("How many companies to deliver (5-200, API default 25). Without max_cost_usd the task reserves this many and bills only the companies it delivers. With continue_from, the companies still wanted."),
|
|
1284
1287
|
min_score: z
|
|
1285
1288
|
.number()
|
|
1286
1289
|
.int()
|
|
@@ -1302,6 +1305,17 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
1302
1305
|
.array(z.enum(COMPANY_REQUIREMENTS))
|
|
1303
1306
|
.optional()
|
|
1304
1307
|
.describe("Only deliver companies that have all of these: 'email', 'phone', 'linkedin' (the company's LinkedIn page), 'leader' (one of roles), 'leader_email' (a leader with an email). A company is delivered once the stage that can show them has run (email, phone, linkedin: the contact pages; leader: the leaders; leader_email: the email checks); one that does not have them is not delivered and not billed. Sent as filters.require."),
|
|
1308
|
+
max_cost_usd: z
|
|
1309
|
+
.number()
|
|
1310
|
+
.positive()
|
|
1311
|
+
.max(COMPANY_SEARCH_MAX_BUDGET_USD)
|
|
1312
|
+
.optional()
|
|
1313
|
+
.describe(`Search budget in USD (more than 0, up to ${COMPANY_SEARCH_MAX_BUDGET_USD}): the most this task may charge. Set it only when the user agreed to spend this amount. It must be at least what count reserves (count times the per-company price; a smaller budget is refused with HTTP 422, which gives the minimum). The whole budget is reserved (reserved_cost_usd) and the search goes on until it delivers count or spends the budget. Its search effort is billed where the companies delivered do not cover it, up to the budget, even when it finds few companies or none; the unused part is returned when the task ends. Without it, the search stops once it costs more than the companies it found pay for (cost_limit), and only the companies delivered are billed.`),
|
|
1314
|
+
continue_from: z
|
|
1315
|
+
.string()
|
|
1316
|
+
.uuid()
|
|
1317
|
+
.optional()
|
|
1318
|
+
.describe("task_id of an earlier Company Search of yours that has ended, to find only new companies: this search leaves out every company that one delivered, held for review, or was told to exclude, as well as your own exclude. Send the same query and filters with count set to the companies still wanted. HTTP 409 while that task has not ended (queued, running, or paused); 404 when it is not your Company Search (a Company Enrich or People Search task_id is refused)."),
|
|
1305
1319
|
...companyTaskFields(),
|
|
1306
1320
|
}), async (args) => {
|
|
1307
1321
|
try {
|
|
@@ -1331,7 +1345,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
1331
1345
|
}
|
|
1332
1346
|
}, undefined, BILLED_TASK);
|
|
1333
1347
|
registerTool(server, apiKey, "company-search-status", "Get Company Search Status", "Status, progress, and cost of one Company Search or Company Enrich task, plus a page of the companies delivered so far: domain, name, url, location, fit score (null for Company Enrich) and why it matched, primary_email and primary_contact, public emails, phones, and social profiles with the page each came from (source_url), leaders with their roles, title, LinkedIn profile, and emails (each with its verification status; inferred ones with source: inferred and a confidence), contact_coverage, and enrichment (status partial or complete, and each stage: profile, contacts, people, email_patterns, email_check). Free: it reads a task you already started and runs no new search. Cost fields are reserved_cost_usd and, once the task ended, final_cost_usd. The data came from each company's own website, public web search, and public LinkedIn profiles. " +
|
|
1334
|
-
"Companies arrive while the task runs and are filled in place by the later stages: pass the returned next_cursor as cursor to get only the companies delivered since then, and call without cursor to read every company in its latest version. stage enriching means every company is delivered and only later stages of some are left. When done is true and has_more is false you have every company. An ended task has completion_reason (why it stopped; all_domains_processed for Company Enrich), coverage_limited: true when a
|
|
1348
|
+
"Companies arrive while the task runs and are filled in place by the later stages: pass the returned next_cursor as cursor to get only the companies delivered since then, and call without cursor to read every company in its latest version. stage enriching means every company is delivered and only later stages of some are left. When done is true and has_more is false you have every company. An ended task has completion_reason (why it stopped; all_domains_processed for Company Enrich or a search restricted to the domains its query names, listed as only_domains), coverage_limited: true when a limit stopped it before count (more companies may match: the next hint says how to continue it with continue_from), and warnings. A search with a budget shows max_cost_usd, and progress.effort_units once it ended (the search effort billed where the companies delivered do not cover it); a continued search shows continue_from. Company Search results have fully_verified (every criterion confirmed by the company's own pages) and unverified_criteria (criteria that are unknown or not met, or a disqualifier that applies). These are information only: the company still qualified.", strictArgs({
|
|
1335
1349
|
task_id: companyTaskId,
|
|
1336
1350
|
cursor: z
|
|
1337
1351
|
.string()
|
|
@@ -1377,7 +1391,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
1377
1391
|
return fail("Company Search Resume error", error);
|
|
1378
1392
|
}
|
|
1379
1393
|
}, undefined, TASK_STATE_CHANGE);
|
|
1380
|
-
registerTool(server, apiKey, "company-search-cancel", "Cancel Company Search", "Cancel a Company Search or Company Enrich task. Free. The task stops for good; you pay only for the companies it already delivered (a task cancelled before it starts costs nothing) and the rest of the reservation is returned. Companies delivered so far stay readable for 30 days. This cannot be undone.", strictArgs({
|
|
1394
|
+
registerTool(server, apiKey, "company-search-cancel", "Cancel Company Search", "Cancel a Company Search or Company Enrich task. Free. The task stops for good; you pay only for the companies it already delivered (a task cancelled before it starts costs nothing) and the rest of the reservation is returned. A Company Search started with max_cost_usd pays for its search effort so far instead when that is more, up to its budget. Companies delivered so far stay readable for 30 days. This cannot be undone.", strictArgs({
|
|
1381
1395
|
task_id: companyTaskId,
|
|
1382
1396
|
}), async (args) => {
|
|
1383
1397
|
try {
|
|
@@ -1387,7 +1401,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
1387
1401
|
return fail("Company Search Cancel error", error);
|
|
1388
1402
|
}
|
|
1389
1403
|
}, undefined, TASK_CANCEL);
|
|
1390
|
-
registerTool(server, apiKey, "company-search-tasks", "List Company Search Tasks", "Your Company Search and Company Enrich tasks, newest first, with status, counts, cost, why each ended task stopped (completion_reason, coverage_limited), and the metadata labels set on company-search or company-enrich. Free; it lists your own tasks, not the companies they found (read those with company-search-status). People Search tasks are not listed here (see people-search-tasks). Use it to find a task_id (filter by type, status, or metadata to find the tasks of one campaign), or to see which tasks are still queued, running, or paused: a new task is refused while too many People Search and Company Search tasks are active.", strictArgs({
|
|
1404
|
+
registerTool(server, apiKey, "company-search-tasks", "List Company Search Tasks", "Your Company Search and Company Enrich tasks, newest first, with status, counts, cost, why each ended task stopped (completion_reason, coverage_limited), max_cost_usd and continue_from when a search set them, and the metadata labels set on company-search or company-enrich. Free; it lists your own tasks, not the companies they found (read those with company-search-status). People Search tasks are not listed here (see people-search-tasks). Use it to find a task_id (filter by type, status, or metadata to find the tasks of one campaign), or to see which tasks are still queued, running, or paused: a new task is refused while too many People Search and Company Search tasks are active.", strictArgs({
|
|
1391
1405
|
type: z
|
|
1392
1406
|
.enum(COMPANY_TASK_TYPES)
|
|
1393
1407
|
.optional()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desearch-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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",
|