desearch-mcp-server 0.1.4 → 0.2.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/README.md +209 -6
  3. package/build/http.d.ts +2 -8
  4. package/build/http.d.ts.map +1 -1
  5. package/build/http.js +126 -37
  6. package/build/oauth/client-ip.d.ts +10 -0
  7. package/build/oauth/client-ip.d.ts.map +1 -0
  8. package/build/oauth/client-ip.js +28 -0
  9. package/build/oauth/crypto.d.ts +20 -0
  10. package/build/oauth/crypto.d.ts.map +1 -0
  11. package/build/oauth/crypto.js +89 -0
  12. package/build/oauth/errors.d.ts +9 -0
  13. package/build/oauth/errors.d.ts.map +1 -0
  14. package/build/oauth/errors.js +13 -0
  15. package/build/oauth/flow.d.ts +8 -0
  16. package/build/oauth/flow.d.ts.map +1 -0
  17. package/build/oauth/flow.js +424 -0
  18. package/build/oauth/http.d.ts +24 -0
  19. package/build/oauth/http.d.ts.map +1 -0
  20. package/build/oauth/http.js +137 -0
  21. package/build/oauth/metadata.d.ts +19 -0
  22. package/build/oauth/metadata.d.ts.map +1 -0
  23. package/build/oauth/metadata.js +86 -0
  24. package/build/oauth/page.d.ts +14 -0
  25. package/build/oauth/page.d.ts.map +1 -0
  26. package/build/oauth/page.js +92 -0
  27. package/build/oauth/rate-limit.d.ts +14 -0
  28. package/build/oauth/rate-limit.d.ts.map +1 -0
  29. package/build/oauth/rate-limit.js +19 -0
  30. package/build/oauth/redirects.d.ts +14 -0
  31. package/build/oauth/redirects.d.ts.map +1 -0
  32. package/build/oauth/redirects.js +78 -0
  33. package/build/oauth/store.d.ts +139 -0
  34. package/build/oauth/store.d.ts.map +1 -0
  35. package/build/oauth/store.js +606 -0
  36. package/build/oauth/validate-key.d.ts +21 -0
  37. package/build/oauth/validate-key.d.ts.map +1 -0
  38. package/build/oauth/validate-key.js +61 -0
  39. package/build/people.d.ts +125 -0
  40. package/build/people.d.ts.map +1 -0
  41. package/build/people.js +402 -0
  42. package/build/request-key.d.ts +9 -0
  43. package/build/request-key.d.ts.map +1 -0
  44. package/build/request-key.js +24 -0
  45. package/build/server.d.ts +5 -4
  46. package/build/server.d.ts.map +1 -1
  47. package/build/server.js +404 -9
  48. package/package.json +32 -9
@@ -0,0 +1,125 @@
1
+ /**
2
+ * People Search on the Desearch API (`/desearch/people/*`).
3
+ *
4
+ * desearch-js 1.5 has no People Search methods, so this module calls the routes
5
+ * directly with the same base URL, `Authorization: <key>` header, and
6
+ * `HTTP <status>: <detail>` error text that desearch-js uses.
7
+ *
8
+ * - `POST /desearch/people/search/{platform}` starts a background search and is billed:
9
+ * it reserves `count` people at the route price and settles to what it delivers.
10
+ * - Every other route (tasks, results, pause/resume/cancel, profiles) is free.
11
+ */
12
+ export declare const PEOPLE_API_BASE_URL = "https://api.desearch.ai";
13
+ export declare const PEOPLE_PLATFORMS: readonly ["x", "youtube", "linkedin", "tiktok"];
14
+ export type PeoplePlatform = (typeof PEOPLE_PLATFORMS)[number];
15
+ export declare const PEOPLE_TASK_STATUSES: readonly ["queued", "running", "pausing", "paused", "cancelling", "completed", "partial", "failed", "cancelled", "expired"];
16
+ /** Statuses after which a task does not change again. */
17
+ export declare const PEOPLE_ENDED_STATUSES: ReadonlySet<string>;
18
+ /** `has` channels on `GET /desearch/people/profiles` (src/utils/people_filters.py). */
19
+ export declare const PEOPLE_FILTER_CHANNELS: readonly ["email", "website", "x", "linkedin", "instagram", "youtube", "tiktok"];
20
+ export declare const PEOPLE_PROFILE_SORTS: readonly ["score", "recent", "audience"];
21
+ export declare const PEOPLE_CONTROL_ACTIONS: readonly ["pause", "resume", "cancel"];
22
+ export type PeopleControlAction = (typeof PEOPLE_CONTROL_ACTIONS)[number];
23
+ /**
24
+ * Search filters each platform accepts inside the request `filters` object.
25
+ * The API forbids extra keys, so a filter that is not listed for a platform
26
+ * is rejected before the billed call instead of returning HTTP 422.
27
+ */
28
+ export declare const PEOPLE_SEARCH_FILTERS: {
29
+ readonly x: readonly ["min_followers", "max_followers", "verified_only", "countries", "keywords", "exclude_keywords"];
30
+ readonly youtube: readonly ["min_subscribers", "max_subscribers", "countries", "require_contact", "keywords", "exclude_keywords"];
31
+ readonly linkedin: readonly ["min_followers", "max_followers", "countries", "keywords", "exclude_keywords"];
32
+ readonly tiktok: readonly ["min_followers", "max_followers", "require_contact", "keywords", "exclude_keywords"];
33
+ };
34
+ export declare const PEOPLE_SEARCH_FILTER_NAMES: readonly ["min_followers", "max_followers", "min_subscribers", "max_subscribers", "verified_only", "require_contact", "countries", "keywords", "exclude_keywords"];
35
+ export interface PeopleSearchArgs {
36
+ platform: PeoplePlatform;
37
+ query: string;
38
+ count?: number;
39
+ min_score?: number;
40
+ exclude?: string[];
41
+ idempotency_key?: string;
42
+ min_followers?: number;
43
+ max_followers?: number;
44
+ min_subscribers?: number;
45
+ max_subscribers?: number;
46
+ verified_only?: boolean;
47
+ require_contact?: boolean;
48
+ countries?: string[];
49
+ keywords?: string[];
50
+ exclude_keywords?: string[];
51
+ }
52
+ export interface PeopleApiResponse {
53
+ status: number;
54
+ data: unknown;
55
+ }
56
+ type QueryValue = string | number | boolean | undefined;
57
+ export interface PeopleClient {
58
+ startSearch(platform: PeoplePlatform, body: Record<string, unknown>, idempotencyKey?: string): Promise<PeopleApiResponse>;
59
+ getTask(taskId: string): Promise<unknown>;
60
+ getResults(taskId: string, params: {
61
+ cursor?: string;
62
+ limit?: number;
63
+ }): Promise<unknown>;
64
+ controlTask(taskId: string, action: PeopleControlAction): Promise<unknown>;
65
+ listTasks(params: Record<string, QueryValue>): Promise<unknown>;
66
+ listProfiles(params: Record<string, QueryValue>): Promise<unknown>;
67
+ }
68
+ export declare function createPeopleClient(apiKey: string, baseUrl?: string): PeopleClient;
69
+ /**
70
+ * Request body for `POST /desearch/people/search/{platform}`.
71
+ * Throws when a filter does not apply to the platform, so no billed call is made.
72
+ */
73
+ export declare function peopleSearchBody(args: PeopleSearchArgs): Record<string, unknown>;
74
+ /**
75
+ * One person as an agent needs it: who they are, how big their audience is,
76
+ * how well they fit and why, and how to reach them.
77
+ */
78
+ export declare function compactPerson(person: unknown): Record<string, unknown>;
79
+ /** Task fields an agent polls on. `progress` is the worker's counters, passed through. */
80
+ export declare function compactTask(task: unknown, options?: {
81
+ progress?: boolean;
82
+ }): Record<string, unknown>;
83
+ /**
84
+ * One sentence on what to do next, so an agent does not have to infer it from the status.
85
+ * `nextCursor` is the results cursor when the caller just read a page of people.
86
+ */
87
+ export declare function peopleNextStep(status: string | undefined, nextCursor?: string, hasMore?: boolean): string;
88
+ /** `people-search`: start a billed background search and return the task to poll. */
89
+ export declare function startPeopleSearch(client: PeopleClient, args: PeopleSearchArgs): Promise<Record<string, unknown>>;
90
+ /** `people-search-status`: task status and progress, plus a page of people when there are any. */
91
+ export declare function readPeopleStatus(client: PeopleClient, args: {
92
+ task_id: string;
93
+ cursor?: string;
94
+ limit?: number;
95
+ include_people?: boolean;
96
+ }): Promise<Record<string, unknown>>;
97
+ /** `people-search-control`: pause, resume, or cancel a task. */
98
+ export declare function controlPeopleTask(client: PeopleClient, args: {
99
+ task_id: string;
100
+ action: PeopleControlAction;
101
+ }): Promise<Record<string, unknown>>;
102
+ /** `people-search-tasks`: the caller's tasks, newest first. */
103
+ export declare function listPeopleTasks(client: PeopleClient, args: {
104
+ platform?: PeoplePlatform;
105
+ status?: string[];
106
+ limit?: number;
107
+ cursor?: string;
108
+ }): Promise<Record<string, unknown>>;
109
+ export interface PeopleProfilesArgs {
110
+ platform: PeoplePlatform;
111
+ q?: string;
112
+ sort?: (typeof PEOPLE_PROFILE_SORTS)[number];
113
+ limit?: number;
114
+ cursor?: string;
115
+ has?: string[];
116
+ min_audience?: number;
117
+ max_audience?: number;
118
+ min_score?: number;
119
+ location?: string;
120
+ verified?: boolean;
121
+ }
122
+ /** `people-profiles`: everyone the caller's searches found on one platform. */
123
+ export declare function listPeopleProfiles(client: PeopleClient, args: PeopleProfilesArgs): Promise<Record<string, unknown>>;
124
+ export {};
125
+ //# sourceMappingURL=people.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"people.d.ts","sourceRoot":"","sources":["../people.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,iDAAkD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,oBAAoB,6HAWvB,CAAC;AAEX,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAMpD,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,kFAQzB,CAAC;AAEX,eAAO,MAAM,oBAAoB,0CAA2C,CAAC;AAE7E,eAAO,MAAM,sBAAsB,wCAAyC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;CAY4B,CAAC;AAE/D,eAAO,MAAM,0BAA0B,oKAU7B,CAAC;AAEX,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAA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AAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACxF,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAalC;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,+EAA+E;AAC/E,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,kBAAkB,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqBlC"}
@@ -0,0 +1,402 @@
1
+ import { fetch } from "undici";
2
+ /**
3
+ * People Search on the Desearch API (`/desearch/people/*`).
4
+ *
5
+ * desearch-js 1.5 has no People Search methods, so this module calls the routes
6
+ * directly with the same base URL, `Authorization: <key>` header, and
7
+ * `HTTP <status>: <detail>` error text that desearch-js uses.
8
+ *
9
+ * - `POST /desearch/people/search/{platform}` starts a background search and is billed:
10
+ * it reserves `count` people at the route price and settles to what it delivers.
11
+ * - Every other route (tasks, results, pause/resume/cancel, profiles) is free.
12
+ */
13
+ export const PEOPLE_API_BASE_URL = "https://api.desearch.ai";
14
+ export const PEOPLE_PLATFORMS = ["x", "youtube", "linkedin", "tiktok"];
15
+ export const PEOPLE_TASK_STATUSES = [
16
+ "queued",
17
+ "running",
18
+ "pausing",
19
+ "paused",
20
+ "cancelling",
21
+ "completed",
22
+ "partial",
23
+ "failed",
24
+ "cancelled",
25
+ "expired",
26
+ ];
27
+ /** Statuses after which a task does not change again. */
28
+ export const PEOPLE_ENDED_STATUSES = new Set([
29
+ "completed",
30
+ "partial",
31
+ "failed",
32
+ "cancelled",
33
+ "expired",
34
+ ]);
35
+ /** `has` channels on `GET /desearch/people/profiles` (src/utils/people_filters.py). */
36
+ export const PEOPLE_FILTER_CHANNELS = [
37
+ "email",
38
+ "website",
39
+ "x",
40
+ "linkedin",
41
+ "instagram",
42
+ "youtube",
43
+ "tiktok",
44
+ ];
45
+ export const PEOPLE_PROFILE_SORTS = ["score", "recent", "audience"];
46
+ export const PEOPLE_CONTROL_ACTIONS = ["pause", "resume", "cancel"];
47
+ /**
48
+ * Search filters each platform accepts inside the request `filters` object.
49
+ * The API forbids extra keys, so a filter that is not listed for a platform
50
+ * is rejected before the billed call instead of returning HTTP 422.
51
+ */
52
+ export const PEOPLE_SEARCH_FILTERS = {
53
+ x: ["min_followers", "max_followers", "verified_only", "countries", "keywords", "exclude_keywords"],
54
+ youtube: [
55
+ "min_subscribers",
56
+ "max_subscribers",
57
+ "countries",
58
+ "require_contact",
59
+ "keywords",
60
+ "exclude_keywords",
61
+ ],
62
+ linkedin: ["min_followers", "max_followers", "countries", "keywords", "exclude_keywords"],
63
+ tiktok: ["min_followers", "max_followers", "require_contact", "keywords", "exclude_keywords"],
64
+ };
65
+ export const PEOPLE_SEARCH_FILTER_NAMES = [
66
+ "min_followers",
67
+ "max_followers",
68
+ "min_subscribers",
69
+ "max_subscribers",
70
+ "verified_only",
71
+ "require_contact",
72
+ "countries",
73
+ "keywords",
74
+ "exclude_keywords",
75
+ ];
76
+ function isPlainObject(value) {
77
+ return typeof value === "object" && value !== null && !Array.isArray(value);
78
+ }
79
+ function errorDetail(data, text) {
80
+ if (isPlainObject(data) && data.detail !== undefined) {
81
+ const detail = typeof data.detail === "string" ? data.detail : JSON.stringify(data.detail);
82
+ const task = isPlainObject(data.task) ? data.task : undefined;
83
+ return typeof task?.status === "string" ? `${detail} Task status: ${task.status}.` : detail;
84
+ }
85
+ return text.length > 500 ? `${text.slice(0, 500)}...` : text;
86
+ }
87
+ function withQuery(path, params) {
88
+ const search = new URLSearchParams();
89
+ for (const [key, value] of Object.entries(params)) {
90
+ if (value !== undefined) {
91
+ search.append(key, String(value));
92
+ }
93
+ }
94
+ const qs = search.toString();
95
+ return qs ? `${path}?${qs}` : path;
96
+ }
97
+ export function createPeopleClient(apiKey, baseUrl = PEOPLE_API_BASE_URL) {
98
+ async function call(method, path, options = {}) {
99
+ const headers = { Authorization: apiKey, ...options.headers };
100
+ if (options.body) {
101
+ headers["Content-Type"] = "application/json";
102
+ }
103
+ let response;
104
+ let text;
105
+ try {
106
+ response = await fetch(`${baseUrl}${path}`, {
107
+ method,
108
+ headers,
109
+ body: options.body ? JSON.stringify(options.body) : undefined,
110
+ });
111
+ text = await response.text();
112
+ }
113
+ catch (error) {
114
+ throw new Error(`Unexpected Error: ${error instanceof Error ? error.message : String(error)}`);
115
+ }
116
+ let data = text;
117
+ if (text) {
118
+ try {
119
+ data = JSON.parse(text);
120
+ }
121
+ catch {
122
+ // Not JSON: keep the text.
123
+ }
124
+ }
125
+ if (!response.ok) {
126
+ throw new Error(`HTTP ${response.status}: ${errorDetail(data, text)}`);
127
+ }
128
+ return { status: response.status, data };
129
+ }
130
+ const taskPath = (taskId) => `/desearch/people/tasks/${encodeURIComponent(taskId)}`;
131
+ return {
132
+ startSearch(platform, body, idempotencyKey) {
133
+ return call("POST", `/desearch/people/search/${platform}`, {
134
+ body,
135
+ headers: idempotencyKey ? { "Idempotency-Key": idempotencyKey } : undefined,
136
+ });
137
+ },
138
+ async getTask(taskId) {
139
+ return (await call("GET", taskPath(taskId))).data;
140
+ },
141
+ async getResults(taskId, params) {
142
+ return (await call("GET", withQuery(`${taskPath(taskId)}/results`, params))).data;
143
+ },
144
+ async controlTask(taskId, action) {
145
+ return (await call("POST", `${taskPath(taskId)}/${action}`)).data;
146
+ },
147
+ async listTasks(params) {
148
+ return (await call("GET", withQuery("/desearch/people/tasks", params))).data;
149
+ },
150
+ async listProfiles(params) {
151
+ return (await call("GET", withQuery("/desearch/people/profiles", params))).data;
152
+ },
153
+ };
154
+ }
155
+ /**
156
+ * Request body for `POST /desearch/people/search/{platform}`.
157
+ * Throws when a filter does not apply to the platform, so no billed call is made.
158
+ */
159
+ export function peopleSearchBody(args) {
160
+ const allowed = PEOPLE_SEARCH_FILTERS[args.platform];
161
+ const filters = {};
162
+ const rejected = [];
163
+ for (const name of PEOPLE_SEARCH_FILTER_NAMES) {
164
+ const value = args[name];
165
+ if (value === undefined) {
166
+ continue;
167
+ }
168
+ if (!allowed.includes(name)) {
169
+ rejected.push(name);
170
+ continue;
171
+ }
172
+ filters[name] = value;
173
+ }
174
+ if (rejected.length > 0) {
175
+ throw new Error(`${rejected.join(", ")} ${rejected.length === 1 ? "does" : "do"} not apply to ${args.platform}. ${args.platform} filters: ${allowed.join(", ")}. Nothing was charged.`);
176
+ }
177
+ const body = { query: args.query };
178
+ if (args.count !== undefined)
179
+ body.count = args.count;
180
+ if (args.min_score !== undefined)
181
+ body.min_score = args.min_score;
182
+ if (args.exclude !== undefined)
183
+ body.exclude = args.exclude;
184
+ if (Object.keys(filters).length > 0)
185
+ body.filters = filters;
186
+ return body;
187
+ }
188
+ function compact(fields) {
189
+ const out = {};
190
+ for (const [key, value] of Object.entries(fields)) {
191
+ if (value === undefined || value === null || value === "")
192
+ continue;
193
+ if (Array.isArray(value) && value.length === 0)
194
+ continue;
195
+ if (isPlainObject(value) && Object.keys(value).length === 0)
196
+ continue;
197
+ out[key] = value;
198
+ }
199
+ return out;
200
+ }
201
+ function objectOf(value) {
202
+ return isPlainObject(value) ? value : {};
203
+ }
204
+ function arrayOf(value) {
205
+ return Array.isArray(value) ? value : [];
206
+ }
207
+ function numberOf(value) {
208
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
209
+ }
210
+ function stringOf(value) {
211
+ return typeof value === "string" && value.trim() !== "" ? value : undefined;
212
+ }
213
+ /**
214
+ * One person as an agent needs it: who they are, how big their audience is,
215
+ * how well they fit and why, and how to reach them.
216
+ */
217
+ export function compactPerson(person) {
218
+ const p = objectOf(person);
219
+ const metrics = objectOf(p.metrics);
220
+ const attributes = objectOf(p.attributes);
221
+ const score = objectOf(p.score);
222
+ const evidence = arrayOf(p.evidence).map(objectOf);
223
+ const found = isPlainObject(p.found_by) ? p.found_by : undefined;
224
+ return compact({
225
+ id: p.id,
226
+ platform: p.platform,
227
+ handle: p.handle,
228
+ name: p.name,
229
+ url: p.url,
230
+ audience: numberOf(metrics.followers) ?? numberOf(metrics.subscribers),
231
+ location: stringOf(p.location),
232
+ verified: typeof attributes.verified === "boolean" ? attributes.verified : undefined,
233
+ headline: stringOf(attributes.headline),
234
+ company: stringOf(attributes.company),
235
+ score: numberOf(score.value),
236
+ why: stringOf(score.summary),
237
+ reasons: arrayOf(score.reasons).filter((r) => typeof r === "string").slice(0, 3),
238
+ contacts: arrayOf(p.contacts)
239
+ .map(objectOf)
240
+ .filter((c) => stringOf(c.value))
241
+ .map((c) => compact({ type: c.type, value: c.value })),
242
+ links: arrayOf(p.links)
243
+ .map(objectOf)
244
+ .filter((l) => stringOf(l.url))
245
+ .map((l) => compact({ type: l.type, url: l.url })),
246
+ evidence_url: evidence.map((e) => stringOf(e.url)).find((url) => url !== undefined),
247
+ found_by: found
248
+ ? compact({
249
+ task_id: found.task_id,
250
+ query: found.query,
251
+ times_found: found.times_found,
252
+ found_at: found.found_at,
253
+ })
254
+ : undefined,
255
+ });
256
+ }
257
+ /** Task fields an agent polls on. `progress` is the worker's counters, passed through. */
258
+ export function compactTask(task, options = {}) {
259
+ const t = objectOf(task);
260
+ const status = typeof t.status === "string" ? t.status : undefined;
261
+ return compact({
262
+ task_id: t.task_id,
263
+ platform: t.platform,
264
+ status,
265
+ stage: t.stage,
266
+ done: status ? PEOPLE_ENDED_STATUSES.has(status) : undefined,
267
+ query: t.query,
268
+ count: t.count,
269
+ result_count: t.result_count,
270
+ progress: options.progress ? t.progress : undefined,
271
+ errors: options.progress ? t.errors : undefined,
272
+ reserved_cost_usd: t.reserved_cost_usd,
273
+ final_cost_usd: t.final_cost_usd,
274
+ refunded_usd: t.refunded_usd,
275
+ created_at: t.created_at,
276
+ finished_at: t.finished_at,
277
+ results_expire_at: t.results_expire_at,
278
+ });
279
+ }
280
+ /**
281
+ * One sentence on what to do next, so an agent does not have to infer it from the status.
282
+ * `nextCursor` is the results cursor when the caller just read a page of people.
283
+ */
284
+ export function peopleNextStep(status, nextCursor, hasMore = false) {
285
+ const again = nextCursor === undefined
286
+ ? "people-search-status again"
287
+ : `people-search-status again with cursor "${nextCursor}"`;
288
+ if (hasMore) {
289
+ return `More people are ready now: call ${again}.`;
290
+ }
291
+ switch (status) {
292
+ case "queued":
293
+ case "running":
294
+ return nextCursor === undefined
295
+ ? `Still searching. Wait 15 to 30 seconds, then call ${again}.`
296
+ : `Still searching. Wait 15 to 30 seconds, then call ${again} to get only the people found since this call.`;
297
+ case "pausing":
298
+ return "Pausing after the current batch. Resume it with people-search-control action \"resume\".";
299
+ case "paused":
300
+ return "Paused. Resume it with people-search-control action \"resume\", or cancel it.";
301
+ case "cancelling":
302
+ return "Cancelling. Call people-search-status again to read the final status.";
303
+ case "completed":
304
+ return "Finished. You have every person this search found.";
305
+ case "partial":
306
+ return "Finished with partial results: some searches failed. You have every person it found.";
307
+ case "failed":
308
+ return "The search failed. See errors. A search that finds no one is not charged.";
309
+ case "cancelled":
310
+ return "Cancelled. You pay only for the people listed; the rest of the reservation is returned.";
311
+ case "expired":
312
+ return "Results expired 30 days after the search ended.";
313
+ default:
314
+ return `Call ${again} to check for changes.`;
315
+ }
316
+ }
317
+ const POLL_HINT = "Searches usually take 1 to 5 minutes. Poll people-search-status with this task_id every 15 to 30 seconds; people appear while it runs.";
318
+ /** `people-search`: start a billed background search and return the task to poll. */
319
+ export async function startPeopleSearch(client, args) {
320
+ const body = peopleSearchBody(args);
321
+ const { status, data } = await client.startSearch(args.platform, body, args.idempotency_key);
322
+ const raw = objectOf(data);
323
+ // 200 means the same Idempotency-Key already created this task; the API refunds this call.
324
+ const existing = status === 200;
325
+ return compact({
326
+ ...compactTask(data),
327
+ cost_usd: numberOf(raw.cost_usd),
328
+ currency: stringOf(raw.currency),
329
+ existing_task: existing ? true : undefined,
330
+ next: existing
331
+ ? `This idempotency_key already started this search, so it was not charged again. ${POLL_HINT}`
332
+ : POLL_HINT,
333
+ });
334
+ }
335
+ /** `people-search-status`: task status and progress, plus a page of people when there are any. */
336
+ export async function readPeopleStatus(client, args) {
337
+ const task = await client.getTask(args.task_id);
338
+ const summary = compactTask(task, { progress: true });
339
+ const status = typeof summary.status === "string" ? summary.status : undefined;
340
+ const includePeople = args.include_people !== false;
341
+ if (!includePeople) {
342
+ return { ...summary, next: peopleNextStep(status) };
343
+ }
344
+ let nextCursor = args.cursor ?? "0";
345
+ let hasMore = false;
346
+ let people = [];
347
+ const resultCount = numberOf(summary.result_count) ?? 0;
348
+ // No results yet, or expired (the results route answers 410): skip the second call.
349
+ if (resultCount > 0 && status !== "expired") {
350
+ const page = objectOf(await client.getResults(args.task_id, { cursor: args.cursor, limit: args.limit }));
351
+ people = arrayOf(page.results).map(compactPerson);
352
+ nextCursor = stringOf(page.next_cursor) ?? nextCursor;
353
+ hasMore = page.has_more === true;
354
+ }
355
+ return {
356
+ ...summary,
357
+ people,
358
+ next_cursor: nextCursor,
359
+ has_more: hasMore,
360
+ next: peopleNextStep(status, nextCursor, hasMore),
361
+ };
362
+ }
363
+ /** `people-search-control`: pause, resume, or cancel a task. */
364
+ export async function controlPeopleTask(client, args) {
365
+ const task = compactTask(await client.controlTask(args.task_id, args.action));
366
+ const status = typeof task.status === "string" ? task.status : undefined;
367
+ return { ...task, next: peopleNextStep(status) };
368
+ }
369
+ /** `people-search-tasks`: the caller's tasks, newest first. */
370
+ export async function listPeopleTasks(client, args) {
371
+ const page = objectOf(await client.listTasks({
372
+ platform: args.platform,
373
+ status: args.status?.length ? args.status.join(",") : undefined,
374
+ limit: args.limit,
375
+ cursor: args.cursor,
376
+ }));
377
+ return {
378
+ tasks: arrayOf(page.tasks).map((task) => compactTask(task)),
379
+ next_cursor: stringOf(page.next_cursor) ?? null,
380
+ };
381
+ }
382
+ /** `people-profiles`: everyone the caller's searches found on one platform. */
383
+ export async function listPeopleProfiles(client, args) {
384
+ const page = objectOf(await client.listProfiles({
385
+ platform: args.platform,
386
+ q: args.q,
387
+ sort: args.sort,
388
+ limit: args.limit,
389
+ cursor: args.cursor,
390
+ has: args.has?.length ? args.has.join(",") : undefined,
391
+ min_audience: args.min_audience,
392
+ max_audience: args.max_audience,
393
+ min_score: args.min_score,
394
+ location: args.location,
395
+ verified: args.verified,
396
+ }));
397
+ return {
398
+ total: numberOf(page.total) ?? 0,
399
+ next_cursor: stringOf(page.next_cursor) ?? null,
400
+ profiles: arrayOf(page.profiles).map(compactPerson),
401
+ };
402
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Desearch API key from the remote client.
3
+ * Prefer `Authorization: Bearer <key>` (what MCP clients send). `x-api-key` is
4
+ * accepted as well. A bare `Authorization: <key>` value is accepted so the same
5
+ * string used as `DESEARCH_API_KEY` for stdio can be sent without a scheme.
6
+ * Query strings are ignored so keys do not land in access logs.
7
+ */
8
+ export declare function extractDesearchApiKey(request: Request): string | undefined;
9
+ //# sourceMappingURL=request-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-key.d.ts","sourceRoot":"","sources":["../request-key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAkB1E"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Desearch API key from the remote client.
3
+ * Prefer `Authorization: Bearer <key>` (what MCP clients send). `x-api-key` is
4
+ * accepted as well. A bare `Authorization: <key>` value is accepted so the same
5
+ * string used as `DESEARCH_API_KEY` for stdio can be sent without a scheme.
6
+ * Query strings are ignored so keys do not land in access logs.
7
+ */
8
+ export function extractDesearchApiKey(request) {
9
+ const authorization = request.headers.get("authorization")?.trim();
10
+ if (authorization) {
11
+ const bearer = /^Bearer\s+(\S+)$/i.exec(authorization);
12
+ if (bearer?.[1]) {
13
+ return bearer[1];
14
+ }
15
+ if (!/^Bearer\b/i.test(authorization) && !/\s/.test(authorization)) {
16
+ return authorization;
17
+ }
18
+ }
19
+ const headerKey = request.headers.get("x-api-key")?.trim();
20
+ if (headerKey) {
21
+ return headerKey;
22
+ }
23
+ return undefined;
24
+ }
package/build/server.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type PeopleClient } from "./people.js";
2
3
  export declare const SERVER_NAME = "Desearch";
3
- export declare const SERVER_VERSION = "0.1.4";
4
+ export declare const SERVER_VERSION = "0.2.1";
4
5
  interface XSearchPayload {
5
6
  query: string;
6
7
  sort?: "Top" | "Latest";
@@ -95,9 +96,9 @@ export declare function presentSearchBody(value: unknown): unknown;
95
96
  * One MCP server bound to a single Desearch API key.
96
97
  * Stdio uses the process env key. Remote HTTP builds a new server per request
97
98
  * so each caller spends their own key.
98
- * `client` is a test seam. Production callers omit it and the server builds
99
- * a desearch-js client from `apiKey`.
99
+ * `client` and `peopleClient` are test seams. Production callers omit them and the
100
+ * server builds a desearch-js client and a People Search client (people.ts) from `apiKey`.
100
101
  */
101
- export declare function createDesearchMcpServer(apiKey: string, client?: DesearchClient): McpServer;
102
+ export declare function createDesearchMcpServer(apiKey: string, client?: DesearchClient, peopleClient?: PeopleClient): McpServer;
102
103
  export {};
103
104
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAAA,OA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