desearch-mcp-server 0.2.3 → 0.3.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 +15 -0
- package/README.md +6 -4
- package/build/people.d.ts +11 -0
- package/build/people.d.ts.map +1 -1
- package/build/people.js +19 -2
- package/build/server.d.ts +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +41 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
People Search `metadata` labels. Release this version only after the Desearch API release that brings `metadata` to `api.desearch.ai`. Until then the production API rejects a search that sends `metadata` (HTTP 422, extra fields are forbidden) and ignores `metadata.<key>` list filters, so a filtered `people-search-tasks` call would return every task.
|
|
6
|
+
|
|
7
|
+
- `people-search` takes an optional `metadata` object: your own string labels for the search, for example `{"campaign": "q4-outbound"}`. Up to 10 keys; keys are 1-40 characters of `a-z`, `0-9`, `_`, `.`, `-`; values are strings of up to 200 characters. A bad label is rejected before the billed call. An empty object is not sent.
|
|
8
|
+
- `people-search-tasks` takes an optional `metadata` filter of up to 3 pairs. Each pair is sent as `metadata.<key>=<value>`, and a task must match all of them exactly.
|
|
9
|
+
- `people-search`, `people-search-status`, `people-search-control` and `people-search-tasks` return the task's `metadata` when it has any.
|
|
10
|
+
- The key rule and key counts are checked by the tool, not advertised as `propertyNames`/`maxProperties` in the input schema, so clients that do not accept those keywords still load the tools. The argument descriptions state the limits.
|
|
11
|
+
|
|
12
|
+
## 0.2.4
|
|
13
|
+
|
|
14
|
+
`people-search` is marked destructive because it spends the user's Desearch balance.
|
|
15
|
+
|
|
16
|
+
`readOnlyHint` stays false and `openWorldHint` stays true. `destructiveHint` is now true. The tool description states that it starts a paid job billed to the user's Desearch balance. `people-search-control` stays `destructiveHint: true`. Lookup tools, including `search` and `fetch`, stay read-only.
|
|
17
|
+
|
|
3
18
|
## 0.2.3
|
|
4
19
|
|
|
5
20
|
The sign-in form works in a browser.
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ AI search, X search and web search for AI agents, plus page extraction, X data t
|
|
|
57
57
|
|
|
58
58
|
The Desearch MCP server includes the following tools.
|
|
59
59
|
|
|
60
|
-
Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destructiveHint: false`, and `openWorldHint: true`. `people-search` starts a billed
|
|
60
|
+
Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destructiveHint: false`, and `openWorldHint: true`. `people-search` starts a paid job billed to the user's Desearch balance, so `readOnlyHint` is false and `destructiveHint` is true. `people-search-control` can cancel a search, so `readOnlyHint` is false and `destructiveHint` is true. `openWorldHint` is true on every tool because the call reaches a live external source.
|
|
61
61
|
|
|
62
62
|
- **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
63
|
- **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`.
|
|
@@ -76,10 +76,10 @@ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destruc
|
|
|
76
76
|
- **X User Replies** (`x-user-replies`): Posts and replies by a user. Arguments: `user` (required), `count` (optional, 1–100), `query` (optional).
|
|
77
77
|
- **X Post Replies** (`x-post-replies`): Replies to a post. Arguments: `post_id` (required), `count` (optional, 1–100), `query` (optional).
|
|
78
78
|
- **X Trends** (`x-trends`): Trending topics for a location. Arguments: `woeid` (required), `count` (optional, 30–100).
|
|
79
|
-
- **People Search** (`people-search`): Start a search for people who match a plain-language description.
|
|
79
|
+
- **People Search** (`people-search`): Start a paid job billed to the user's Desearch balance: a search for people who match a plain-language description. Arguments: `platform` (required: `x`, `youtube`, `linkedin`, or `tiktok`), `query` (required, 3–1000 characters), `count` (optional, 5–200, API default 25), `min_score` (optional, 0–100), `exclude` (optional handles), `metadata` (optional labels, below), `idempotency_key` (optional), and that platform's filters (below). Returns the `task_id`, status, and `reserved_cost_usd`.
|
|
80
80
|
- **People Search Status** (`people-search-status`): A task's status, progress, and cost, plus a page of the people found so far. Arguments: `task_id` (required), `cursor` (optional, `next_cursor` from the previous call), `limit` (optional, 1–100, default 25), `include_people` (optional, default `true`). Free.
|
|
81
81
|
- **Control People Search** (`people-search-control`): Pause, resume, or cancel a task. Arguments: `task_id` (required), `action` (required: `pause`, `resume`, or `cancel`). Free.
|
|
82
|
-
- **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). Free.
|
|
82
|
+
- **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.
|
|
83
83
|
- **List People Found** (`people-profiles`): Everyone your searches found on one platform, one entry per person, with the search that found them. 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.
|
|
84
84
|
|
|
85
85
|
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 is not in `desearch-js` 1.5; its tools call the `/desearch/people/*` routes directly, and the parity doc lists them too.
|
|
@@ -90,7 +90,7 @@ People Search finds X profiles, YouTube creators, LinkedIn members, or TikTok cr
|
|
|
90
90
|
|
|
91
91
|
A search is a background task:
|
|
92
92
|
|
|
93
|
-
1. `people-search` starts
|
|
93
|
+
1. `people-search` starts a paid job billed to the user's Desearch balance and returns a `task_id` at once. It is the only billed People Search call. It reserves `count` people at the platform's per-person price (`reserved_cost_usd`). When the search ends you pay only for the people it delivered (a per-search minimum applies when it finds anyone; a search that finds no one is free), and the rest of the reservation is returned. Send the same `idempotency_key` to retry a call without starting, or paying for, a second search.
|
|
94
94
|
2. The search usually runs for 1 to 5 minutes. `people-search-status` returns its status, progress, cost, and the people found so far. People arrive while it runs: pass `next_cursor` back as `cursor` to get only the new ones. When `done` is `true` and `has_more` is `false`, you have everyone it found.
|
|
95
95
|
3. `people-search-control` pauses, resumes, or cancels it. A cancelled search bills only the people it already delivered.
|
|
96
96
|
|
|
@@ -107,6 +107,8 @@ Search filters depend on the platform. A filter that does not apply is rejected
|
|
|
107
107
|
|
|
108
108
|
`require_contact` keeps only creators with a public email (on TikTok, in the bio). `keywords` and `exclude_keywords` take up to 20 words each.
|
|
109
109
|
|
|
110
|
+
`metadata` labels a search with your own keys, for example `{"campaign": "q4-outbound", "workspace_id": "ws_42"}`. A search takes up to 10 keys; keys are 1–40 characters of `a-z`, `0-9`, `_`, `.` or `-`, and values are strings of up to 200 characters. A bad label is rejected before the billed call. The labels come back as `metadata` on the task, and `people-search-tasks` with `metadata: {"campaign": "q4-outbound"}` lists only the searches that carry them (up to 3 pairs, exact match). The search itself does not use them.
|
|
111
|
+
|
|
110
112
|
Prompt: find 10 TikTok skincare creators with a public email.
|
|
111
113
|
|
|
112
114
|
```json
|
package/build/people.d.ts
CHANGED
|
@@ -19,6 +19,15 @@ export declare const PEOPLE_ENDED_STATUSES: ReadonlySet<string>;
|
|
|
19
19
|
export declare const PEOPLE_FILTER_CHANNELS: readonly ["email", "website", "x", "linkedin", "instagram", "youtube", "tiktok"];
|
|
20
20
|
export declare const PEOPLE_PROFILE_SORTS: readonly ["score", "recent", "audience"];
|
|
21
21
|
export declare const PEOPLE_CONTROL_ACTIONS: readonly ["pause", "resume", "cancel"];
|
|
22
|
+
/**
|
|
23
|
+
* `metadata`: the caller's own labels on a search (desearch-public-api model/people.py).
|
|
24
|
+
* A search takes up to 10 keys; `GET /desearch/people/tasks` takes up to 3 as
|
|
25
|
+
* `metadata.<key>=<value>` filters.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PEOPLE_METADATA_KEY_PATTERN = "^[a-z0-9_.-]{1,40}$";
|
|
28
|
+
export declare const PEOPLE_METADATA_MAX_KEYS = 10;
|
|
29
|
+
export declare const PEOPLE_METADATA_MAX_FILTERS = 3;
|
|
30
|
+
export declare const PEOPLE_METADATA_VALUE_MAX = 200;
|
|
22
31
|
export type PeopleControlAction = (typeof PEOPLE_CONTROL_ACTIONS)[number];
|
|
23
32
|
/**
|
|
24
33
|
* Search filters each platform accepts inside the request `filters` object.
|
|
@@ -38,6 +47,7 @@ export interface PeopleSearchArgs {
|
|
|
38
47
|
count?: number;
|
|
39
48
|
min_score?: number;
|
|
40
49
|
exclude?: string[];
|
|
50
|
+
metadata?: Record<string, string>;
|
|
41
51
|
idempotency_key?: string;
|
|
42
52
|
min_followers?: number;
|
|
43
53
|
max_followers?: number;
|
|
@@ -105,6 +115,7 @@ export declare function listPeopleTasks(client: PeopleClient, args: {
|
|
|
105
115
|
status?: string[];
|
|
106
116
|
limit?: number;
|
|
107
117
|
cursor?: string;
|
|
118
|
+
metadata?: Record<string, string>;
|
|
108
119
|
}): Promise<Record<string, unknown>>;
|
|
109
120
|
export interface PeopleProfilesArgs {
|
|
110
121
|
platform: PeoplePlatform;
|
package/build/people.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"people.d.ts","s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,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"}
|
package/build/people.js
CHANGED
|
@@ -44,6 +44,15 @@ export const PEOPLE_FILTER_CHANNELS = [
|
|
|
44
44
|
];
|
|
45
45
|
export const PEOPLE_PROFILE_SORTS = ["score", "recent", "audience"];
|
|
46
46
|
export const PEOPLE_CONTROL_ACTIONS = ["pause", "resume", "cancel"];
|
|
47
|
+
/**
|
|
48
|
+
* `metadata`: the caller's own labels on a search (desearch-public-api model/people.py).
|
|
49
|
+
* A search takes up to 10 keys; `GET /desearch/people/tasks` takes up to 3 as
|
|
50
|
+
* `metadata.<key>=<value>` filters.
|
|
51
|
+
*/
|
|
52
|
+
export const PEOPLE_METADATA_KEY_PATTERN = "^[a-z0-9_.-]{1,40}$";
|
|
53
|
+
export const PEOPLE_METADATA_MAX_KEYS = 10;
|
|
54
|
+
export const PEOPLE_METADATA_MAX_FILTERS = 3;
|
|
55
|
+
export const PEOPLE_METADATA_VALUE_MAX = 200;
|
|
47
56
|
/**
|
|
48
57
|
* Search filters each platform accepts inside the request `filters` object.
|
|
49
58
|
* The API forbids extra keys, so a filter that is not listed for a platform
|
|
@@ -183,6 +192,8 @@ export function peopleSearchBody(args) {
|
|
|
183
192
|
body.exclude = args.exclude;
|
|
184
193
|
if (Object.keys(filters).length > 0)
|
|
185
194
|
body.filters = filters;
|
|
195
|
+
if (args.metadata !== undefined && Object.keys(args.metadata).length > 0)
|
|
196
|
+
body.metadata = args.metadata;
|
|
186
197
|
return body;
|
|
187
198
|
}
|
|
188
199
|
function compact(fields) {
|
|
@@ -265,6 +276,7 @@ export function compactTask(task, options = {}) {
|
|
|
265
276
|
stage: t.stage,
|
|
266
277
|
done: status ? PEOPLE_ENDED_STATUSES.has(status) : undefined,
|
|
267
278
|
query: t.query,
|
|
279
|
+
metadata: t.metadata,
|
|
268
280
|
count: t.count,
|
|
269
281
|
result_count: t.result_count,
|
|
270
282
|
progress: options.progress ? t.progress : undefined,
|
|
@@ -368,12 +380,17 @@ export async function controlPeopleTask(client, args) {
|
|
|
368
380
|
}
|
|
369
381
|
/** `people-search-tasks`: the caller's tasks, newest first. */
|
|
370
382
|
export async function listPeopleTasks(client, args) {
|
|
371
|
-
const
|
|
383
|
+
const params = {
|
|
372
384
|
platform: args.platform,
|
|
373
385
|
status: args.status?.length ? args.status.join(",") : undefined,
|
|
374
386
|
limit: args.limit,
|
|
375
387
|
cursor: args.cursor,
|
|
376
|
-
}
|
|
388
|
+
};
|
|
389
|
+
// The API reads metadata filters as `metadata.<key>=<value>`, one parameter per pair.
|
|
390
|
+
for (const [key, value] of Object.entries(args.metadata ?? {})) {
|
|
391
|
+
params[`metadata.${key}`] = value;
|
|
392
|
+
}
|
|
393
|
+
const page = objectOf(await client.listTasks(params));
|
|
377
394
|
return {
|
|
378
395
|
tasks: arrayOf(page.tasks).map((task) => compactTask(task)),
|
|
379
396
|
next_cursor: stringOf(page.next_cursor) ?? null,
|
package/build/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { type PeopleClient } from "./people.js";
|
|
3
3
|
export declare const SERVER_NAME = "Desearch";
|
|
4
|
-
export declare const SERVER_VERSION = "0.
|
|
4
|
+
export declare const SERVER_VERSION = "0.3.0";
|
|
5
5
|
interface XSearchPayload {
|
|
6
6
|
query: string;
|
|
7
7
|
sort?: "Top" | "Latest";
|
package/build/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings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AAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1F,YAAY,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,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;AA6JD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AAuCvD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYzD;AAgJD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,cAAc,EACvB,YAAY,CAAC,EAAE,YAAY,GAC5B,SAAS,CA2yBX"}
|
package/build/server.js
CHANGED
|
@@ -2,10 +2,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
2
2
|
import { ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
3
3
|
import DesearchImport from "desearch-js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { PEOPLE_CONTROL_ACTIONS, PEOPLE_FILTER_CHANNELS, PEOPLE_PLATFORMS, PEOPLE_PROFILE_SORTS, PEOPLE_SEARCH_FILTERS, PEOPLE_TASK_STATUSES, controlPeopleTask, createPeopleClient, listPeopleProfiles, listPeopleTasks, readPeopleStatus, startPeopleSearch, } from "./people.js";
|
|
5
|
+
import { PEOPLE_CONTROL_ACTIONS, 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, createPeopleClient, listPeopleProfiles, listPeopleTasks, readPeopleStatus, startPeopleSearch, } from "./people.js";
|
|
6
6
|
import { AI_SEARCH_TOOLS, WEB_LINK_TOOLS, toolIdSchema } from "./tool-sources.js";
|
|
7
7
|
export const SERVER_NAME = "Desearch";
|
|
8
|
-
export const SERVER_VERSION = "0.
|
|
8
|
+
export const SERVER_VERSION = "0.3.0";
|
|
9
9
|
// desearch-js 1.5 publishes a default class. Node16 resolution types that package
|
|
10
10
|
// as a module namespace, so the constructor is applied through a cast.
|
|
11
11
|
const Desearch = DesearchImport;
|
|
@@ -21,12 +21,13 @@ const READ_ONLY_OPEN_WORLD = {
|
|
|
21
21
|
openWorldHint: true,
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* `people-search`
|
|
25
|
-
*
|
|
24
|
+
* `people-search` starts a paid job billed to the user's Desearch balance.
|
|
25
|
+
* Spending that balance is irreversible, so destructiveHint is true.
|
|
26
|
+
* Calling it again starts (and reserves) another search unless the same idempotency_key is sent.
|
|
26
27
|
*/
|
|
27
28
|
const BILLED_TASK = {
|
|
28
29
|
readOnlyHint: false,
|
|
29
|
-
destructiveHint:
|
|
30
|
+
destructiveHint: true,
|
|
30
31
|
idempotentHint: false,
|
|
31
32
|
openWorldHint: true,
|
|
32
33
|
};
|
|
@@ -87,6 +88,31 @@ function strictArgs(shape) {
|
|
|
87
88
|
function peopleKeywordList() {
|
|
88
89
|
return z.array(z.string().min(1).max(120)).max(20);
|
|
89
90
|
}
|
|
91
|
+
const peopleMetadataKey = new RegExp(PEOPLE_METADATA_KEY_PATTERN);
|
|
92
|
+
/**
|
|
93
|
+
* `metadata` labels: string keys of a-z, 0-9, '_', '.', '-' (1-40 characters) to strings of
|
|
94
|
+
* at most 200 characters, and at most `maxKeys` pairs. Checked here so a bad label never
|
|
95
|
+
* reaches the API. The key rule and the key count are checked in a refinement rather than
|
|
96
|
+
* advertised as `propertyNames`/`maxProperties`, which some MCP clients do not accept; the
|
|
97
|
+
* description states them. A new schema per field, like peopleKeywordList.
|
|
98
|
+
*/
|
|
99
|
+
function peopleMetadata(maxKeys) {
|
|
100
|
+
return z.record(z.string(), z.string().max(PEOPLE_METADATA_VALUE_MAX)).superRefine((value, ctx) => {
|
|
101
|
+
const keys = Object.keys(value);
|
|
102
|
+
if (keys.length > maxKeys) {
|
|
103
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: `At most ${maxKeys} metadata keys` });
|
|
104
|
+
}
|
|
105
|
+
for (const key of keys) {
|
|
106
|
+
if (!peopleMetadataKey.test(key)) {
|
|
107
|
+
ctx.addIssue({
|
|
108
|
+
code: z.ZodIssueCode.custom,
|
|
109
|
+
path: [key],
|
|
110
|
+
message: "metadata keys are 1-40 characters of a-z, 0-9, '_', '.' or '-'",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
90
116
|
function platformFilterList() {
|
|
91
117
|
return Object.entries(PEOPLE_SEARCH_FILTERS)
|
|
92
118
|
.map(([platform, filters]) => `${platform}: ${filters.join(", ")}`)
|
|
@@ -285,7 +311,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
285
311
|
name: SERVER_NAME,
|
|
286
312
|
version: SERVER_VERSION,
|
|
287
313
|
}, {
|
|
288
|
-
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. Other tools cover AI search, X posts, and page extraction. People Search finds people and creators on X, YouTube, LinkedIn, and TikTok: people-search starts a billed
|
|
314
|
+
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. Other tools cover AI search, X posts, and page extraction. 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, and people-search-control can pause, resume, or cancel it. Calls need a Desearch API key.",
|
|
289
315
|
});
|
|
290
316
|
registerTool(server, apiKey, "ai-search", "AI Search", "AI search and analysis on web using Desearch AI", {
|
|
291
317
|
prompt: z.string().describe("Question, example: 'What is the latest news on AI?'"),
|
|
@@ -619,7 +645,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
619
645
|
url: z.string(),
|
|
620
646
|
metadata: z.record(z.string(), z.string()).optional(),
|
|
621
647
|
});
|
|
622
|
-
registerTool(server, apiKey, "people-search", "People Search", "Start a
|
|
648
|
+
registerTool(server, apiKey, "people-search", "People Search", "Start a paid job billed to the user's Desearch balance: find people on X, YouTube, LinkedIn, or TikTok who match a plain-language description. Each person comes back with a fit score, why they matched, their audience, and public contacts and links. This call reserves count times the platform's per-person price (reserved_cost_usd) and returns a task_id at once. When the search ends you pay only for the people it delivered (a per-search minimum applies when it finds anyone; a search that finds no one is free) and the rest of the reservation is returned. The search runs in the background, usually for 1 to 5 minutes: poll people-search-status with the task_id to read progress and the people found so far, and use people-search-control to pause, resume, or cancel it. Do not start the same search twice; send idempotency_key so a retry returns the first task instead of charging again. Filters depend on the platform. " +
|
|
623
649
|
platformFilterList() +
|
|
624
650
|
".", strictArgs({
|
|
625
651
|
platform: peoplePlatform.describe("Where to look: 'x' (X profiles), 'youtube' (YouTube creators), 'linkedin' (LinkedIn members), or 'tiktok' (TikTok creators)."),
|
|
@@ -653,6 +679,9 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
653
679
|
.max(200)
|
|
654
680
|
.optional()
|
|
655
681
|
.describe("Any unique string for this search, for example a UUID. Sending the same key again returns the first task and is not charged again."),
|
|
682
|
+
metadata: peopleMetadata(PEOPLE_METADATA_MAX_KEYS)
|
|
683
|
+
.optional()
|
|
684
|
+
.describe(`Your own labels for this search, example: {"campaign": "q4-outbound"}. Up to ${PEOPLE_METADATA_MAX_KEYS} keys; keys are 1-40 characters of a-z, 0-9, '_', '.', '-'; values are strings of up to ${PEOPLE_METADATA_VALUE_MAX} characters. Returned on the task; filter people-search-tasks by it. The search does not use it.`),
|
|
656
685
|
min_followers: z
|
|
657
686
|
.number()
|
|
658
687
|
.int()
|
|
@@ -741,7 +770,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
741
770
|
return fail("People Search Control error", error);
|
|
742
771
|
}
|
|
743
772
|
}, undefined, TASK_CONTROL);
|
|
744
|
-
registerTool(server, apiKey, "people-search-tasks", "List People Search Tasks", "Your People Search tasks, newest first, with status, counts, and
|
|
773
|
+
registerTool(server, apiKey, "people-search-tasks", "List People Search Tasks", "Your People Search tasks, newest first, with status, counts, cost, and the metadata labels set on people-search. Free. Use it to find a task_id (filter by metadata to find the searches of one campaign), or to see which searches are still queued, running, or paused: a new search is refused while too many are active.", strictArgs({
|
|
745
774
|
platform: peoplePlatform.optional().describe("Only tasks on this platform: 'x', 'youtube', 'linkedin', or 'tiktok'."),
|
|
746
775
|
status: z
|
|
747
776
|
.array(z.enum(PEOPLE_TASK_STATUSES))
|
|
@@ -754,7 +783,10 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
754
783
|
.max(100)
|
|
755
784
|
.optional()
|
|
756
785
|
.describe("Tasks per page (1-100, API default 20)."),
|
|
757
|
-
cursor: z.string().optional().describe("next_cursor from the previous page."),
|
|
786
|
+
cursor: z.string().optional().describe("next_cursor from the previous page. Keep the same metadata filter when you page."),
|
|
787
|
+
metadata: peopleMetadata(PEOPLE_METADATA_MAX_FILTERS)
|
|
788
|
+
.optional()
|
|
789
|
+
.describe(`Only tasks whose metadata has all of these key/value pairs (exact match, up to ${PEOPLE_METADATA_MAX_FILTERS}), example: {"campaign": "q4-outbound"}.`),
|
|
758
790
|
}), async (args) => {
|
|
759
791
|
try {
|
|
760
792
|
return ok(await listPeopleTasks(people, args));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desearch-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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, page extraction, X data, and People Search (find people and creators on X, YouTube, LinkedIn, and TikTok) tools for AI agents.",
|
|
6
6
|
"license": "MIT",
|