desearch-mcp-server 0.2.4 → 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 +9 -0
- package/README.md +4 -2
- 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 +35 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
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
|
+
|
|
3
12
|
## 0.2.4
|
|
4
13
|
|
|
5
14
|
`people-search` is marked destructive because it spends the user's Desearch balance.
|
package/README.md
CHANGED
|
@@ -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 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), `idempotency_key` (optional), and that platform's filters (below). Returns the `task_id`, status, and `reserved_cost_usd`.
|
|
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.
|
|
@@ -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","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,MA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AAO,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":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE,OAAO,EAiBH,K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AC,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;
|
|
@@ -88,6 +88,31 @@ function strictArgs(shape) {
|
|
|
88
88
|
function peopleKeywordList() {
|
|
89
89
|
return z.array(z.string().min(1).max(120)).max(20);
|
|
90
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
|
+
}
|
|
91
116
|
function platformFilterList() {
|
|
92
117
|
return Object.entries(PEOPLE_SEARCH_FILTERS)
|
|
93
118
|
.map(([platform, filters]) => `${platform}: ${filters.join(", ")}`)
|
|
@@ -654,6 +679,9 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
654
679
|
.max(200)
|
|
655
680
|
.optional()
|
|
656
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.`),
|
|
657
685
|
min_followers: z
|
|
658
686
|
.number()
|
|
659
687
|
.int()
|
|
@@ -742,7 +770,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
742
770
|
return fail("People Search Control error", error);
|
|
743
771
|
}
|
|
744
772
|
}, undefined, TASK_CONTROL);
|
|
745
|
-
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({
|
|
746
774
|
platform: peoplePlatform.optional().describe("Only tasks on this platform: 'x', 'youtube', 'linkedin', or 'tiktok'."),
|
|
747
775
|
status: z
|
|
748
776
|
.array(z.enum(PEOPLE_TASK_STATUSES))
|
|
@@ -755,7 +783,10 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
755
783
|
.max(100)
|
|
756
784
|
.optional()
|
|
757
785
|
.describe("Tasks per page (1-100, API default 20)."),
|
|
758
|
-
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"}.`),
|
|
759
790
|
}), async (args) => {
|
|
760
791
|
try {
|
|
761
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",
|