desearch-mcp-server 0.7.0 → 0.8.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 +12 -0
- package/README.md +31 -4
- package/build/desearch-api.d.ts +7 -2
- package/build/desearch-api.d.ts.map +1 -1
- package/build/desearch-api.js +7 -2
- package/build/people.d.ts +1 -1
- package/build/people.d.ts.map +1 -1
- package/build/server.d.ts +2 -2
- package/build/server.d.ts.map +1 -1
- package/build/server.js +88 -6
- package/build/social.d.ts +129 -8
- package/build/social.d.ts.map +1 -1
- package/build/social.js +117 -11
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
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).
|
|
6
|
+
|
|
7
|
+
- `youtube`: 6 routes. `search` (`POST /desearch/youtube/search`: `query`, `type`, `upload_date`, `sort_by`, `duration`, `cursor`), `video`, `transcript` (`language`), `comments` (`order`, `cursor`), `channel`, and `channel_videos` (`sort`, `cursor`). Video ids may be full YouTube URLs.
|
|
8
|
+
- `reddit`: 5 routes. `search` (`POST /desearch/reddit/search`: `query`, `sort`, `timeframe`, `cursor`), `subreddit`, `subreddit_posts` (`sort`, `timeframe`, `cursor`), `post`, and `comments` (`cursor`; a tree with the replies Reddit loaded). The two `sort` lists differ by action, and a value from the other list is refused before the request. A leading `r/` on a subreddit name is removed.
|
|
9
|
+
- `threads`: 5 routes. `search` (`query`, `start_date`, `end_date`), `search_users`, `profile`, `profile_posts`, and `post` (with its replies and thread continuation). Threads returns one page, so the tool has no `cursor`.
|
|
10
|
+
- Paging: `youtube` `search`, `comments`, `channel_videos` and `reddit` `search`, `subreddit_posts`, `comments` return `{ results, next_cursor, next }` with `next_cursor` from the `x-desearch-next-cursor` header, exactly as the TikTok actions do.
|
|
11
|
+
- All three are lookups: `readOnlyHint: true`, `destructiveHint: false`, `openWorldHint: true`. The server instructions, README, parity doc, `llms-install.md`, `GEMINI.md`, the plugin skill, and the manifest descriptions name them.
|
|
12
|
+
- `scripts/e2e-youtube-reddit-threads.mjs` calls every new action once over stdio against a live API (`--base-url`, `--key-env`), plus a second page on each action that pages.
|
|
13
|
+
- `DESEARCH_API_BASE`, which already set the OAuth key-check host, now also sets the host for the routes the server calls directly (People Search, Company Search, `search-api`, `people-search-export`, and the social tools), so a staging API can be tested end to end. Tools built on `desearch-js` still call `https://api.desearch.ai`.
|
|
14
|
+
|
|
3
15
|
## 0.7.0
|
|
4
16
|
|
|
5
17
|
Full Desearch API coverage: five new tools (36 in total: the 31 tools of 0.6.0 plus these five) for the routes `desearch-js` 1.5 does not cover. They call the API directly through `desearch-api.ts`, the request helper `people.ts` and `companies.ts` used, now in its own module, with the same `Authorization: <key>` header and `HTTP <status>: <detail>` errors. The network stats routes stay out of MCP.
|
package/README.md
CHANGED
|
@@ -51,13 +51,13 @@ Example output:
|
|
|
51
51
|
|
|
52
52
|
The tool returns that JSON as pretty-printed text: `{ "content": [{ "type": "text", "text": "<json above>" }] }`.
|
|
53
53
|
|
|
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, and
|
|
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.8.0 exposes 39 tools.
|
|
55
55
|
|
|
56
56
|
## Tools
|
|
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`. `search-api`, `tiktok`, `facebook`, `instagram`, `people-search-status`, `people-search-tasks`, `people-profiles`, and `people-search-export` are lookups too. `people-search` starts a paid job billed to the user's Desearch balance, so `readOnlyHint` is false; it creates a new task and does not delete or overwrite anything, so `destructiveHint` is false. `people-search-pause` and `people-search-resume` change a task's state and undo each other, so `readOnlyHint` and `destructiveHint` are false and `idempotentHint` is true. Pausing loses no data (people found so far stay readable and the search keeps its progress) and changes no billing (nothing is charged or refunded; the reservation stays until the search ends), and resume continues from where the search stopped with no new charge. The caveat: the API cancels a search paused for more than 7 days, and a cancelled search cannot be resumed, so a pause is reversible only within those 7 days. `people-search-cancel` cannot be undone, so `readOnlyHint` is false and `destructiveHint` and `idempotentHint` are true. The Company Search tools follow the same rules: `company-search` and `company-enrich` start paid jobs (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`), `company-search-status` and `company-search-tasks` are lookups, `company-search-pause` and `company-search-resume` set `destructiveHint: false` and `idempotentHint: true` (with the same 7-day caveat), and `company-search-cancel` sets `destructiveHint: true` and `idempotentHint: true`. `openWorldHint` is true on every tool because the call reaches a live external source.
|
|
60
|
+
Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destructiveHint: false`, and `openWorldHint: true`. `search-api`, `tiktok`, `facebook`, `instagram`, `youtube`, `reddit`, `threads`, `people-search-status`, `people-search-tasks`, `people-profiles`, and `people-search-export` are lookups too. `people-search` starts a paid job billed to the user's Desearch balance, so `readOnlyHint` is false; it creates a new task and does not delete or overwrite anything, so `destructiveHint` is false. `people-search-pause` and `people-search-resume` change a task's state and undo each other, so `readOnlyHint` and `destructiveHint` are false and `idempotentHint` is true. Pausing loses no data (people found so far stay readable and the search keeps its progress) and changes no billing (nothing is charged or refunded; the reservation stays until the search ends), and resume continues from where the search stopped with no new charge. The caveat: the API cancels a search paused for more than 7 days, and a cancelled search cannot be resumed, so a pause is reversible only within those 7 days. `people-search-cancel` cannot be undone, so `readOnlyHint` is false and `destructiveHint` and `idempotentHint` are true. The Company Search tools follow the same rules: `company-search` and `company-enrich` start paid jobs (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`), `company-search-status` and `company-search-tasks` are lookups, `company-search-pause` and `company-search-resume` set `destructiveHint: false` and `idempotentHint: true` (with the same 7-day caveat), and `company-search-cancel` sets `destructiveHint: true` and `idempotentHint: true`. `openWorldHint` is true on every tool because the call reaches a live external source.
|
|
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`.
|
|
@@ -80,6 +80,9 @@ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destruc
|
|
|
80
80
|
- **TikTok** (`tiktok`): Public TikTok data. `action` (required) picks the route: `search` (`query`; optional `count`, `sort`, `cursor`), `post` (`id`), `profile` (`username`), `profile_posts` (`username`; optional `count`, `cursor`), `comments` (`video_id`; optional `count`, `cursor`), `hashtag` (`tag`; optional `count`, `cursor`), `trending` (optional `region`, `count`). See [TikTok, Facebook, and Instagram](#tiktok-facebook-and-instagram).
|
|
81
81
|
- **Facebook** (`facebook`): Public Facebook data. `action` (required): `search` (`query`; optional `count`, `cursor`) and `hashtag` (`tag`; optional `count`, `cursor`) return Meta Ad Library ads, not organic posts; `post` (`id`), `profile` (`profile_id`, a page or profile ID or public handle), `profile_posts` (`profile_id`; optional `count`, `cursor`), `comments` (`post_id`; optional `count`, `cursor`).
|
|
82
82
|
- **Instagram** (`instagram`): Public Instagram data. `action` (required): `search` (`query`; optional `count`; profiles, one page, no cursor), `media` (`id`: shortcode, numeric ID, or URL), `profile` (`username`), `profile_posts` (`username`; optional `count`, `cursor`), `comments` (`shortcode`, the code in the post URL; optional `count`, `cursor`), `hashtag` (`tag`; optional `count`, `cursor`).
|
|
83
|
+
- **YouTube** (`youtube`): Public YouTube data. `action` (required): `search` (`query`; optional `type`, `upload_date`, `sort_by`, `duration`, `cursor`; videos, Shorts, live streams, channels, and playlists, each with a `type`), `video` (`id`: video or Short ID or URL), `transcript` (`video_id`; optional `language`), `comments` (`video_id`; optional `order`, `cursor`), `channel` (`handle`, with or without `@`, or a `UC...` channel ID), `channel_videos` (`handle`; optional `sort`, `cursor`). See [YouTube, Reddit, and Threads](#youtube-reddit-and-threads).
|
|
84
|
+
- **Reddit** (`reddit`): Public Reddit data. `action` (required): `search` (`query`; optional `sort`, `timeframe`, `cursor`), `subreddit` (`name`, case-sensitive), `subreddit_posts` (`name`; optional `sort`, `timeframe`, `cursor`), `post` (`id`: post ID or URL), `comments` (`post_id`; optional `cursor`).
|
|
85
|
+
- **Threads** (`threads`): Public Threads data. `action` (required): `search` (`query`; optional `start_date`, `end_date`), `search_users` (`query`), `profile` (`username`), `profile_posts` (`username`), `post` (`id`: post URL or shortcode). One page each; no cursor.
|
|
83
86
|
- **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` (`count` times the platform's per-person price at the time of the call; prices at https://desearch.ai/pricing); the ended task carries `final_cost_usd`. Public data only: public X posts and profile fields, public YouTube channel pages plus the creator's own website for publicly listed contact details, public LinkedIn posts and profiles, and public TikTok videos and profiles. Contacts are only those the person lists publicly.
|
|
84
87
|
- **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; it reads a search you already started (people come from public profiles and posts).
|
|
85
88
|
- **Pause People Search** (`people-search-pause`): Pause a task. A queued search pauses at once; a running one finishes its current batch first. No data is lost and billing does not change; `people-search-resume` continues where it stopped with no new charge. A search paused for more than 7 days is cancelled by the API and can no longer be resumed. Argument: `task_id` (required). Free.
|
|
@@ -96,7 +99,7 @@ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destruc
|
|
|
96
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.
|
|
97
100
|
- **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.
|
|
98
101
|
|
|
99
|
-
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, and
|
|
102
|
+
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.
|
|
100
103
|
|
|
101
104
|
### TikTok, Facebook, and Instagram
|
|
102
105
|
|
|
@@ -130,6 +133,30 @@ Prompt: show me the latest TikTok videos tagged #ai, then the next page.
|
|
|
130
133
|
|
|
131
134
|
The cursor is opaque: send it back unchanged, on the same action with the same target (`query`, `username`, `profile_id`, `video_id`, `post_id`, `shortcode`, or `tag`), within 24 hours. Any other value returns HTTP 422 and is not charged. TikTok `trending` and Instagram `search` return one page and take no cursor. Facebook `search` and `hashtag` read the Meta Ad Library (ads), not organic posts. Instagram `comments` takes the post shortcode (`DeuOR-CjKE9` in `https://www.instagram.com/p/DeuOR-CjKE9/`); a numeric media ID returns 404. A leading `@` on a username and `#` on a tag are removed.
|
|
132
135
|
|
|
136
|
+
### YouTube, Reddit, and Threads
|
|
137
|
+
|
|
138
|
+
`youtube`, `reddit`, and `threads` work the same way: `action` picks one public route, and the action's arguments are checked before any request. Each call is billed per request, including an empty page; a 404, a 422, and a 5xx are not charged (prices at https://desearch.ai/pricing).
|
|
139
|
+
|
|
140
|
+
| Tool | Actions that page (take `cursor`) | Single items | One page, no cursor |
|
|
141
|
+
| --- | --- | --- | --- |
|
|
142
|
+
| `youtube` | `search`, `comments`, `channel_videos` | `video`, `transcript`, `channel` | — |
|
|
143
|
+
| `reddit` | `search`, `subreddit_posts`, `comments` | `subreddit`, `post` | — |
|
|
144
|
+
| `threads` | — | `profile`, `post` | `search`, `search_users`, `profile_posts` (the latest posts only) |
|
|
145
|
+
|
|
146
|
+
Paging is the same as on TikTok: a list action returns `{ "results": [...], "next_cursor": ..., "next": ... }`, where `next_cursor` is the `x-desearch-next-cursor` response header. Send it back unchanged as `cursor`, on the same action with the same target, within 24 hours.
|
|
147
|
+
|
|
148
|
+
Prompt: find recent YouTube videos about bittensor, then read the transcript of the first one.
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{ "name": "youtube", "arguments": { "action": "search", "query": "bittensor", "type": "videos", "upload_date": "this_month" } }
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{ "name": "youtube", "arguments": { "action": "transcript", "video_id": "dQw4w9WgXcQ", "language": "en" } }
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The transcript comes back as `{ "videoId", "language", "text", "segments": [{ "text", "startMs", "endMs", "startText" }] }`; a video without captions returns 404 (not charged). `video`, `transcript`, and `comments` take a video ID or a full YouTube URL; `reddit` `post` and `comments` take a post ID (with or without `t3_`) or URL; `threads` `post` takes a post URL or shortcode. Reddit subreddit names are case-sensitive (`AskReddit`); a leading `r/` is removed. Reddit `sort` values depend on the action: `relevance`, `new`, `top`, or `comment_count` for `search`, and `best`, `hot`, `new`, `top`, or `rising` for `subreddit_posts` (`timeframe` applies to `top` there). `reddit` `comments` returns a tree: top-level comments with the `replies` Reddit loaded and `hasMoreReplies` when there are more.
|
|
159
|
+
|
|
133
160
|
### People Search
|
|
134
161
|
|
|
135
162
|
People Search finds X profiles, YouTube creators, LinkedIn members, or TikTok creators who match a plain-language description. Each person comes back with a fit score, one line on why they matched, their audience (followers, or subscribers on YouTube), location, and the public contacts and links the search found.
|
|
@@ -691,7 +718,7 @@ Environment variables for the host:
|
|
|
691
718
|
| `OAUTH_REGISTER_RATE_WINDOW_SEC` | No | Registration rate-limit window in seconds. Default 3600 (1 hour). Range 1 to 86400. |
|
|
692
719
|
| `OAUTH_AUTHORIZE_RATE_LIMIT` | No | Sign-in key checks per IP per window. Default 20. Range 1 to 10000. |
|
|
693
720
|
| `OAUTH_AUTHORIZE_RATE_WINDOW_SEC` | No | Sign-in key-check window in seconds. Default 600 (10 minutes). Range 1 to 86400. |
|
|
694
|
-
| `DESEARCH_API_BASE` | No |
|
|
721
|
+
| `DESEARCH_API_BASE` | No | Desearch API host. Default `https://api.desearch.ai`. Used by the key check and by the routes the server calls directly (People Search, Company Search, `search-api`, `people-search-export`, and the social tools), for example to test against a staging API. Tools built on `desearch-js` always call `https://api.desearch.ai`. |
|
|
695
722
|
| `OAUTH_REQUIRE_AUTH_ON_INITIALIZE` | No | Set to `true` to require a key or access token on `initialize`. Default is off, so keyless `initialize` stays public. `tools/list` stays public either way. |
|
|
696
723
|
|
|
697
724
|
The key check calls `GET /twitter/trends?woeid=1&count=1`. A real key is authenticated and then rejected as invalid input (HTTP 422), so the check does not run a full trends query. Only 422 counts as a valid key. `401` and `403` reject the key. Any other status, including a 2xx, is a verification error and is not treated as valid.
|
package/build/desearch-api.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Direct calls to the Desearch API for routes desearch-js 1.5 does not cover
|
|
3
|
-
* (People Search, the TikTok, Facebook and
|
|
3
|
+
* (People Search, the TikTok, Facebook, Instagram, YouTube, Reddit and Threads routes,
|
|
4
|
+
* `POST /search`).
|
|
4
5
|
*
|
|
5
6
|
* Same base URL, `Authorization: <key>` header, and `HTTP <status>: <detail>`
|
|
6
7
|
* error text that desearch-js uses, so every tool reports API errors the same way.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* `DESEARCH_API_BASE` (the host the OAuth key check also uses) points these direct calls
|
|
11
|
+
* at another Desearch API, such as a staging deploy. The desearch-js tools ignore it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DESEARCH_API_BASE_URL: string;
|
|
9
14
|
export type QueryValue = string | number | boolean | undefined;
|
|
10
15
|
export interface ApiResponse {
|
|
11
16
|
status: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desearch-api.d.ts","sourceRoot":"","sources":["../desearch-api.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"desearch-api.d.ts","sourceRoot":"","sources":["../desearch-api.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAGjC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,WAAW,GAAG,CACtB,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,iBAAiB,KAC1B,OAAO,CAAC,WAAW,CAAC,CAAC;AAM1B,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/D;AAED,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,MAAM,CASlF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAA8B,GAAG,WAAW,CAgCtG"}
|
package/build/desearch-api.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { fetch } from "undici";
|
|
2
2
|
/**
|
|
3
3
|
* Direct calls to the Desearch API for routes desearch-js 1.5 does not cover
|
|
4
|
-
* (People Search, the TikTok, Facebook and
|
|
4
|
+
* (People Search, the TikTok, Facebook, Instagram, YouTube, Reddit and Threads routes,
|
|
5
|
+
* `POST /search`).
|
|
5
6
|
*
|
|
6
7
|
* Same base URL, `Authorization: <key>` header, and `HTTP <status>: <detail>`
|
|
7
8
|
* error text that desearch-js uses, so every tool reports API errors the same way.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* `DESEARCH_API_BASE` (the host the OAuth key check also uses) points these direct calls
|
|
12
|
+
* at another Desearch API, such as a staging deploy. The desearch-js tools ignore it.
|
|
13
|
+
*/
|
|
14
|
+
export const DESEARCH_API_BASE_URL = (process.env.DESEARCH_API_BASE?.trim() || "https://api.desearch.ai").replace(/\/+$/, "");
|
|
10
15
|
function isPlainObject(value) {
|
|
11
16
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
17
|
}
|
package/build/people.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type DesearchApi, type QueryValue } from "./desearch-api.js";
|
|
|
10
10
|
* it reserves `count` people at the route price and settles to what it delivers.
|
|
11
11
|
* - Every other route (tasks, results, pause/resume/cancel, profiles, exports) is free.
|
|
12
12
|
*/
|
|
13
|
-
export declare const PEOPLE_API_BASE_URL
|
|
13
|
+
export declare const PEOPLE_API_BASE_URL: string;
|
|
14
14
|
export declare const PEOPLE_PLATFORMS: readonly ["x", "youtube", "linkedin", "tiktok"];
|
|
15
15
|
export type PeoplePlatform = (typeof PEOPLE_PLATFORMS)[number];
|
|
16
16
|
export declare const PEOPLE_TASK_STATUSES: readonly ["queued", "running", "pausing", "paused", "cancelling", "completed", "partial", "failed", "cancelled", "expired"];
|
package/build/people.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"people.d.ts","sourceRoot":"","sources":["../people.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhH;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,mBA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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.8.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;
|
|
@@ -107,7 +107,7 @@ export declare function presentSearchBody(value: unknown): unknown;
|
|
|
107
107
|
* them and the server builds a desearch-js client, a People Search client (people.ts), and
|
|
108
108
|
* a Company Search client (companies.ts) from `apiKey`.
|
|
109
109
|
* The routes desearch-js 1.5 does not cover (People Search, Company Search, TikTok,
|
|
110
|
-
* Facebook, Instagram, `POST /search`) share one direct API caller (desearch-api.ts)
|
|
110
|
+
* Facebook, Instagram, YouTube, Reddit, Threads, `POST /search`) share one direct API caller (desearch-api.ts)
|
|
111
111
|
* for that key.
|
|
112
112
|
*/
|
|
113
113
|
export declare function createDesearchMcpServer(apiKey: string, client?: DesearchClient, peopleClient?: PeopleClient, companyClient?: CompanyClient): McpServer;
|
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,EAcH,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,QAA6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B,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,CAk5CX"}
|
package/build/server.js
CHANGED
|
@@ -8,7 +8,7 @@ import { COMPANY_COUNTRIES_MAX, COMPANY_DOMAINS_MAX, COMPANY_EXCLUDE_MAX, COMPAN
|
|
|
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.8.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.
|
|
@@ -142,13 +142,20 @@ function socialCursor() {
|
|
|
142
142
|
.optional()
|
|
143
143
|
.describe("next_cursor from the previous page of the same action and target, sent back unchanged. Omit it for the first page.");
|
|
144
144
|
}
|
|
145
|
-
function socialQuery(example) {
|
|
145
|
+
function socialQuery(example, maxLength = 1000, note = "") {
|
|
146
146
|
return z
|
|
147
147
|
.string()
|
|
148
148
|
.min(1)
|
|
149
|
-
.max(
|
|
149
|
+
.max(maxLength)
|
|
150
150
|
.optional()
|
|
151
|
-
.describe(`search: keyword or phrase, example: '${example}'
|
|
151
|
+
.describe(`search: keyword or phrase, example: '${example}'.${note}`);
|
|
152
|
+
}
|
|
153
|
+
function socialDate(description) {
|
|
154
|
+
return z
|
|
155
|
+
.string()
|
|
156
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
157
|
+
.optional()
|
|
158
|
+
.describe(description);
|
|
152
159
|
}
|
|
153
160
|
function socialTag() {
|
|
154
161
|
return socialTarget("hashtag: the hashtag without #, example: 'ai'. A leading # is removed.");
|
|
@@ -452,7 +459,7 @@ function registerTool(server, apiKey, name, title, description, inputSchema, han
|
|
|
452
459
|
* them and the server builds a desearch-js client, a People Search client (people.ts), and
|
|
453
460
|
* a Company Search client (companies.ts) from `apiKey`.
|
|
454
461
|
* The routes desearch-js 1.5 does not cover (People Search, Company Search, TikTok,
|
|
455
|
-
* Facebook, Instagram, `POST /search`) share one direct API caller (desearch-api.ts)
|
|
462
|
+
* Facebook, Instagram, YouTube, Reddit, Threads, `POST /search`) share one direct API caller (desearch-api.ts)
|
|
456
463
|
* for that key.
|
|
457
464
|
*/
|
|
458
465
|
export function createDesearchMcpServer(apiKey, client, peopleClient, companyClient) {
|
|
@@ -468,7 +475,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
468
475
|
icons: SERVER_ICONS,
|
|
469
476
|
};
|
|
470
477
|
const server = new McpServer(serverInfo, {
|
|
471
|
-
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, and
|
|
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.",
|
|
472
479
|
});
|
|
473
480
|
registerTool(server, apiKey, "ai-search", "AI Search", "AI search and analysis on web using Desearch AI", {
|
|
474
481
|
prompt: z.string().describe("Question, example: 'What is the latest news on AI?'"),
|
|
@@ -857,6 +864,81 @@ export function createDesearchMcpServer(apiKey, client, peopleClient, companyCli
|
|
|
857
864
|
return fail("Instagram error", error);
|
|
858
865
|
}
|
|
859
866
|
});
|
|
867
|
+
registerTool(server, apiKey, "youtube", "YouTube", "Read public YouTube data with Desearch. Set action and that action's arguments. search (query; optional type, upload_date, sort_by, duration, cursor): videos, Shorts, live streams, channels, and playlists that match a keyword; each result has a type. video (id): one video or Short by ID or URL, with its channel, counts, chapters, and caption languages. transcript (video_id; optional language): its captions as plain text and timestamped segments; a video without captions returns 404. comments (video_id; optional order, cursor): its top-level comments. channel (handle): one channel by handle or channel ID. channel_videos (handle; optional sort, cursor): the channel's videos. A video id from search or channel_videos can be passed to video, transcript, or comments. video, transcript, and channel return the item itself. " +
|
|
868
|
+
SOCIAL_PAGING, strictArgs({
|
|
869
|
+
action: socialAction("youtube", "What to read: 'search', 'video', 'transcript', 'comments', 'channel', or 'channel_videos'."),
|
|
870
|
+
query: socialQuery("bittensor", 500, " Use intitle:\"...\" for stricter title matching."),
|
|
871
|
+
type: z
|
|
872
|
+
.enum(["videos", "shorts", "channels", "playlists"])
|
|
873
|
+
.optional()
|
|
874
|
+
.describe("search: only this kind of result. Omit for mixed results."),
|
|
875
|
+
upload_date: z
|
|
876
|
+
.enum(["today", "this_week", "this_month", "this_year"])
|
|
877
|
+
.optional()
|
|
878
|
+
.describe("search: only videos uploaded in this window."),
|
|
879
|
+
sort_by: z.enum(["relevance", "popular"]).optional().describe("search: result order."),
|
|
880
|
+
duration: z
|
|
881
|
+
.enum(["under_3_min", "between_3_and_20_min", "over_20_min"])
|
|
882
|
+
.optional()
|
|
883
|
+
.describe("search: video length. Applies to videos, not Shorts."),
|
|
884
|
+
id: socialTarget("video: YouTube video or Short ID, or its full URL, example: 'dQw4w9WgXcQ'."),
|
|
885
|
+
video_id: socialTarget("transcript, comments: YouTube video or Short ID, or its full URL."),
|
|
886
|
+
language: z
|
|
887
|
+
.string()
|
|
888
|
+
.regex(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,4})?$/)
|
|
889
|
+
.optional()
|
|
890
|
+
.describe("transcript: caption language code, example: 'en' or 'es'. Omit for YouTube's default track."),
|
|
891
|
+
order: z.enum(["top", "newest"]).optional().describe("comments: comment order."),
|
|
892
|
+
handle: socialTarget("channel, channel_videos: channel handle (with or without @) or channel ID (UC...), example: '@MrBeast'."),
|
|
893
|
+
sort: z.enum(["latest", "popular"]).optional().describe("channel_videos: video order (API default latest)."),
|
|
894
|
+
cursor: socialCursor(),
|
|
895
|
+
}), async (args) => {
|
|
896
|
+
try {
|
|
897
|
+
return ok(await runSocialAction(api, "youtube", args));
|
|
898
|
+
}
|
|
899
|
+
catch (error) {
|
|
900
|
+
return fail("YouTube error", error);
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
registerTool(server, apiKey, "reddit", "Reddit", "Read public Reddit data with Desearch. Set action and that action's arguments. search (query; optional sort, timeframe, cursor): posts across all subreddits that match a keyword. subreddit (name): a subreddit's description, rules, and weekly activity; the name is case-sensitive ('AskReddit', not 'askreddit'). subreddit_posts (name; optional sort, timeframe, cursor): its posts. post (id): one post by ID or URL, without comments. comments (post_id; optional cursor): a post's comments as a tree, with the replies Reddit loaded alongside them. A post id from search or subreddit_posts can be passed to post or comments. subreddit and post return the item itself. " +
|
|
904
|
+
SOCIAL_PAGING, strictArgs({
|
|
905
|
+
action: socialAction("reddit", "What to read: 'search', 'subreddit', 'subreddit_posts', 'post', or 'comments'."),
|
|
906
|
+
query: socialQuery("bittensor", 500),
|
|
907
|
+
sort: z
|
|
908
|
+
.enum(["relevance", "new", "top", "comment_count", "best", "hot", "rising"])
|
|
909
|
+
.optional()
|
|
910
|
+
.describe("search: 'relevance', 'new', 'top', or 'comment_count'. subreddit_posts: 'best', 'hot', 'new', 'top', or 'rising'."),
|
|
911
|
+
timeframe: z
|
|
912
|
+
.enum(["all", "day", "week", "month", "year"])
|
|
913
|
+
.optional()
|
|
914
|
+
.describe("search: only posts from this window. subreddit_posts: the window for sort 'top' (ignored with another sort; without a sort it means top)."),
|
|
915
|
+
name: socialTarget("subreddit, subreddit_posts: subreddit name, case-sensitive, example: 'AskReddit'. A leading r/ is removed."),
|
|
916
|
+
id: socialTarget("post: Reddit post ID (example: '1q6pxwn', with or without t3_) or its full URL."),
|
|
917
|
+
post_id: socialTarget("comments: Reddit post ID (with or without t3_) or its full URL."),
|
|
918
|
+
cursor: socialCursor(),
|
|
919
|
+
}), async (args) => {
|
|
920
|
+
try {
|
|
921
|
+
return ok(await runSocialAction(api, "reddit", args));
|
|
922
|
+
}
|
|
923
|
+
catch (error) {
|
|
924
|
+
return fail("Reddit error", error);
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
registerTool(server, apiKey, "threads", "Threads", "Read public Threads data with Desearch. Set action and that action's arguments. search (query; optional start_date, end_date): one page of posts that match a keyword. search_users (query): accounts that match a username or name. profile (username): one profile with bio, followers, and links. profile_posts (username): the account's latest public posts (Threads shows only the most recent ones). post (id): one post by URL or shortcode, with its replies (comments) and the author's own continuation posts (threadItems). profile and post return the item itself. List actions return { results, next_cursor, next }; Threads returns no further pages, so next_cursor is always null and no action takes a cursor.", strictArgs({
|
|
928
|
+
action: socialAction("threads", "What to read: 'search', 'search_users', 'profile', 'profile_posts', or 'post'."),
|
|
929
|
+
query: socialQuery("bittensor", 500, " search_users: username or name, up to 100 characters, example: 'zuck'."),
|
|
930
|
+
start_date: socialDate("search: only posts on or after this date (YYYY-MM-DD), example: '2026-01-01'."),
|
|
931
|
+
end_date: socialDate("search: only posts on or before this date (YYYY-MM-DD)."),
|
|
932
|
+
username: socialTarget("profile, profile_posts: Threads username, example: 'zuck'. A leading @ is removed."),
|
|
933
|
+
id: socialTarget("post: Threads post URL or shortcode, example: 'DK-BydcJHkF' or 'https://www.threads.com/@zuck/post/DK-BydcJHkF'."),
|
|
934
|
+
}), async (args) => {
|
|
935
|
+
try {
|
|
936
|
+
return ok(await runSocialAction(api, "threads", args));
|
|
937
|
+
}
|
|
938
|
+
catch (error) {
|
|
939
|
+
return fail("Threads error", error);
|
|
940
|
+
}
|
|
941
|
+
});
|
|
860
942
|
registerTool(server, apiKey, "search", "Search", "Search the public web and return titles and links. Use fetch with a result URL to read the page.", {
|
|
861
943
|
query: z.string().describe("Search query."),
|
|
862
944
|
}, async ({ query }) => {
|
package/build/social.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { DesearchApi } from "./desearch-api.js";
|
|
2
2
|
/**
|
|
3
|
-
* TikTok, Facebook, and
|
|
3
|
+
* TikTok, Facebook, Instagram, YouTube, Reddit, and Threads on the Desearch API
|
|
4
|
+
* (`/desearch/{platform}/*`).
|
|
4
5
|
*
|
|
5
|
-
* desearch-js 1.5 has no social methods, so the `tiktok`, `facebook`,
|
|
6
|
-
* `
|
|
7
|
-
* `action` that picks one route; the table below says which
|
|
8
|
-
* needs and accepts, and the request is refused before it is
|
|
6
|
+
* desearch-js 1.5 has no social methods, so the `tiktok`, `facebook`, `instagram`,
|
|
7
|
+
* `youtube`, `reddit`, and `threads` tools call these routes through `desearch-api.ts`.
|
|
8
|
+
* Each tool takes an `action` that picks one route; the table below says which
|
|
9
|
+
* arguments each route needs and accepts, and the request is refused before it is
|
|
10
|
+
* sent when they do not match.
|
|
9
11
|
*
|
|
10
12
|
* Paging (desearch-public-api docs/social-pagination.md): a list route answers with a
|
|
11
13
|
* JSON array and, when there is another page, an `x-desearch-next-cursor` header.
|
|
@@ -13,7 +15,7 @@ import type { DesearchApi } from "./desearch-api.js";
|
|
|
13
15
|
* same target. The header is absent on the last page. A cursor is opaque and lasts
|
|
14
16
|
* 24 hours; this module never builds or changes one.
|
|
15
17
|
*/
|
|
16
|
-
export declare const SOCIAL_PLATFORMS: readonly ["tiktok", "facebook", "instagram"];
|
|
18
|
+
export declare const SOCIAL_PLATFORMS: readonly ["tiktok", "facebook", "instagram", "youtube", "reddit", "threads"];
|
|
17
19
|
export type SocialPlatform = (typeof SOCIAL_PLATFORMS)[number];
|
|
18
20
|
export declare const NEXT_CURSOR_HEADER = "x-desearch-next-cursor";
|
|
19
21
|
export interface SocialActionSpec {
|
|
@@ -26,6 +28,8 @@ export interface SocialActionSpec {
|
|
|
26
28
|
optional: readonly string[];
|
|
27
29
|
/** The route answers with a list of items. */
|
|
28
30
|
list?: true;
|
|
31
|
+
/** Values an argument may take on this action, when the tool's schema allows more. */
|
|
32
|
+
choices?: Readonly<Record<string, readonly string[]>>;
|
|
29
33
|
}
|
|
30
34
|
export declare const SOCIAL_ACTIONS: {
|
|
31
35
|
readonly tiktok: {
|
|
@@ -161,6 +165,123 @@ export declare const SOCIAL_ACTIONS: {
|
|
|
161
165
|
readonly list: true;
|
|
162
166
|
};
|
|
163
167
|
};
|
|
168
|
+
readonly youtube: {
|
|
169
|
+
readonly search: {
|
|
170
|
+
readonly method: "POST";
|
|
171
|
+
readonly path: "/desearch/youtube/search";
|
|
172
|
+
readonly required: readonly ["query"];
|
|
173
|
+
readonly optional: readonly ["type", "upload_date", "sort_by", "duration", "cursor"];
|
|
174
|
+
readonly list: true;
|
|
175
|
+
};
|
|
176
|
+
readonly video: {
|
|
177
|
+
readonly method: "GET";
|
|
178
|
+
readonly path: "/desearch/youtube/video/{id}";
|
|
179
|
+
readonly required: readonly ["id"];
|
|
180
|
+
readonly optional: readonly [];
|
|
181
|
+
};
|
|
182
|
+
readonly transcript: {
|
|
183
|
+
readonly method: "GET";
|
|
184
|
+
readonly path: "/desearch/youtube/transcript/{video_id}";
|
|
185
|
+
readonly required: readonly ["video_id"];
|
|
186
|
+
readonly optional: readonly ["language"];
|
|
187
|
+
};
|
|
188
|
+
readonly comments: {
|
|
189
|
+
readonly method: "GET";
|
|
190
|
+
readonly path: "/desearch/youtube/comments/{video_id}";
|
|
191
|
+
readonly required: readonly ["video_id"];
|
|
192
|
+
readonly optional: readonly ["order", "cursor"];
|
|
193
|
+
readonly list: true;
|
|
194
|
+
};
|
|
195
|
+
readonly channel: {
|
|
196
|
+
readonly method: "GET";
|
|
197
|
+
readonly path: "/desearch/youtube/channel/{handle}";
|
|
198
|
+
readonly required: readonly ["handle"];
|
|
199
|
+
readonly optional: readonly [];
|
|
200
|
+
};
|
|
201
|
+
readonly channel_videos: {
|
|
202
|
+
readonly method: "GET";
|
|
203
|
+
readonly path: "/desearch/youtube/channel/{handle}/videos";
|
|
204
|
+
readonly required: readonly ["handle"];
|
|
205
|
+
readonly optional: readonly ["sort", "cursor"];
|
|
206
|
+
readonly list: true;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
readonly reddit: {
|
|
210
|
+
readonly search: {
|
|
211
|
+
readonly method: "POST";
|
|
212
|
+
readonly path: "/desearch/reddit/search";
|
|
213
|
+
readonly required: readonly ["query"];
|
|
214
|
+
readonly optional: readonly ["sort", "timeframe", "cursor"];
|
|
215
|
+
readonly list: true;
|
|
216
|
+
readonly choices: {
|
|
217
|
+
readonly sort: readonly ["relevance", "new", "top", "comment_count"];
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
readonly subreddit: {
|
|
221
|
+
readonly method: "GET";
|
|
222
|
+
readonly path: "/desearch/reddit/subreddit/{name}";
|
|
223
|
+
readonly required: readonly ["name"];
|
|
224
|
+
readonly optional: readonly [];
|
|
225
|
+
};
|
|
226
|
+
readonly subreddit_posts: {
|
|
227
|
+
readonly method: "GET";
|
|
228
|
+
readonly path: "/desearch/reddit/subreddit/{name}/posts";
|
|
229
|
+
readonly required: readonly ["name"];
|
|
230
|
+
readonly optional: readonly ["sort", "timeframe", "cursor"];
|
|
231
|
+
readonly list: true;
|
|
232
|
+
readonly choices: {
|
|
233
|
+
readonly sort: readonly ["best", "hot", "new", "top", "rising"];
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
readonly post: {
|
|
237
|
+
readonly method: "GET";
|
|
238
|
+
readonly path: "/desearch/reddit/post/{id}";
|
|
239
|
+
readonly required: readonly ["id"];
|
|
240
|
+
readonly optional: readonly [];
|
|
241
|
+
};
|
|
242
|
+
readonly comments: {
|
|
243
|
+
readonly method: "GET";
|
|
244
|
+
readonly path: "/desearch/reddit/comments/{post_id}";
|
|
245
|
+
readonly required: readonly ["post_id"];
|
|
246
|
+
readonly optional: readonly ["cursor"];
|
|
247
|
+
readonly list: true;
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
readonly threads: {
|
|
251
|
+
readonly search: {
|
|
252
|
+
readonly method: "POST";
|
|
253
|
+
readonly path: "/desearch/threads/search";
|
|
254
|
+
readonly required: readonly ["query"];
|
|
255
|
+
readonly optional: readonly ["start_date", "end_date"];
|
|
256
|
+
readonly list: true;
|
|
257
|
+
};
|
|
258
|
+
readonly search_users: {
|
|
259
|
+
readonly method: "POST";
|
|
260
|
+
readonly path: "/desearch/threads/search/users";
|
|
261
|
+
readonly required: readonly ["query"];
|
|
262
|
+
readonly optional: readonly [];
|
|
263
|
+
readonly list: true;
|
|
264
|
+
};
|
|
265
|
+
readonly profile: {
|
|
266
|
+
readonly method: "GET";
|
|
267
|
+
readonly path: "/desearch/threads/profile/{username}";
|
|
268
|
+
readonly required: readonly ["username"];
|
|
269
|
+
readonly optional: readonly [];
|
|
270
|
+
};
|
|
271
|
+
readonly profile_posts: {
|
|
272
|
+
readonly method: "GET";
|
|
273
|
+
readonly path: "/desearch/threads/profile/{username}/posts";
|
|
274
|
+
readonly required: readonly ["username"];
|
|
275
|
+
readonly optional: readonly [];
|
|
276
|
+
readonly list: true;
|
|
277
|
+
};
|
|
278
|
+
readonly post: {
|
|
279
|
+
readonly method: "GET";
|
|
280
|
+
readonly path: "/desearch/threads/post/{id}";
|
|
281
|
+
readonly required: readonly ["id"];
|
|
282
|
+
readonly optional: readonly [];
|
|
283
|
+
};
|
|
284
|
+
};
|
|
164
285
|
};
|
|
165
286
|
export type SocialAction<P extends SocialPlatform> = keyof (typeof SOCIAL_ACTIONS)[P] & string;
|
|
166
287
|
/** Action names in table order, for the tool's `action` enum. */
|
|
@@ -179,8 +300,8 @@ export declare function socialRequest(platform: SocialPlatform, args: Record<str
|
|
|
179
300
|
/** One sentence on how to get the next page. */
|
|
180
301
|
export declare function socialNextStep(platform: SocialPlatform, action: string, spec: SocialActionSpec, nextCursor: string | null): string;
|
|
181
302
|
/**
|
|
182
|
-
* Run one
|
|
183
|
-
*
|
|
303
|
+
* Run one social action. A single post, profile, media item, video, transcript,
|
|
304
|
+
* channel, or subreddit comes back as the API sent it. A list comes back as
|
|
184
305
|
* `{ results, next_cursor, next }`: `next_cursor` is the `x-desearch-next-cursor`
|
|
185
306
|
* header (null on the last page) and `next` says how to ask for the next page.
|
|
186
307
|
*/
|
package/build/social.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../social.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../social.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,gBAAgB,8EAA+E,CAAC;AAC7G,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,mDAAmD;IACnD,IAA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CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CAAE,CA0DnF;AAED,gDAAgD;AAChD,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,CASR;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACjC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC,CAclB"}
|
package/build/social.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TikTok, Facebook, and
|
|
2
|
+
* TikTok, Facebook, Instagram, YouTube, Reddit, and Threads on the Desearch API
|
|
3
|
+
* (`/desearch/{platform}/*`).
|
|
3
4
|
*
|
|
4
|
-
* desearch-js 1.5 has no social methods, so the `tiktok`, `facebook`,
|
|
5
|
-
* `
|
|
6
|
-
* `action` that picks one route; the table below says which
|
|
7
|
-
* needs and accepts, and the request is refused before it is
|
|
5
|
+
* desearch-js 1.5 has no social methods, so the `tiktok`, `facebook`, `instagram`,
|
|
6
|
+
* `youtube`, `reddit`, and `threads` tools call these routes through `desearch-api.ts`.
|
|
7
|
+
* Each tool takes an `action` that picks one route; the table below says which
|
|
8
|
+
* arguments each route needs and accepts, and the request is refused before it is
|
|
9
|
+
* sent when they do not match.
|
|
8
10
|
*
|
|
9
11
|
* Paging (desearch-public-api docs/social-pagination.md): a list route answers with a
|
|
10
12
|
* JSON array and, when there is another page, an `x-desearch-next-cursor` header.
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
* same target. The header is absent on the last page. A cursor is opaque and lasts
|
|
13
15
|
* 24 hours; this module never builds or changes one.
|
|
14
16
|
*/
|
|
15
|
-
export const SOCIAL_PLATFORMS = ["tiktok", "facebook", "instagram"];
|
|
17
|
+
export const SOCIAL_PLATFORMS = ["tiktok", "facebook", "instagram", "youtube", "reddit", "threads"];
|
|
16
18
|
export const NEXT_CURSOR_HEADER = "x-desearch-next-cursor";
|
|
17
19
|
export const SOCIAL_ACTIONS = {
|
|
18
20
|
tiktok: {
|
|
@@ -129,6 +131,90 @@ export const SOCIAL_ACTIONS = {
|
|
|
129
131
|
list: true,
|
|
130
132
|
},
|
|
131
133
|
},
|
|
134
|
+
youtube: {
|
|
135
|
+
search: {
|
|
136
|
+
method: "POST",
|
|
137
|
+
path: "/desearch/youtube/search",
|
|
138
|
+
required: ["query"],
|
|
139
|
+
optional: ["type", "upload_date", "sort_by", "duration", "cursor"],
|
|
140
|
+
list: true,
|
|
141
|
+
},
|
|
142
|
+
video: { method: "GET", path: "/desearch/youtube/video/{id}", required: ["id"], optional: [] },
|
|
143
|
+
transcript: {
|
|
144
|
+
method: "GET",
|
|
145
|
+
path: "/desearch/youtube/transcript/{video_id}",
|
|
146
|
+
required: ["video_id"],
|
|
147
|
+
optional: ["language"],
|
|
148
|
+
},
|
|
149
|
+
comments: {
|
|
150
|
+
method: "GET",
|
|
151
|
+
path: "/desearch/youtube/comments/{video_id}",
|
|
152
|
+
required: ["video_id"],
|
|
153
|
+
optional: ["order", "cursor"],
|
|
154
|
+
list: true,
|
|
155
|
+
},
|
|
156
|
+
channel: { method: "GET", path: "/desearch/youtube/channel/{handle}", required: ["handle"], optional: [] },
|
|
157
|
+
channel_videos: {
|
|
158
|
+
method: "GET",
|
|
159
|
+
path: "/desearch/youtube/channel/{handle}/videos",
|
|
160
|
+
required: ["handle"],
|
|
161
|
+
optional: ["sort", "cursor"],
|
|
162
|
+
list: true,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
reddit: {
|
|
166
|
+
search: {
|
|
167
|
+
method: "POST",
|
|
168
|
+
path: "/desearch/reddit/search",
|
|
169
|
+
required: ["query"],
|
|
170
|
+
optional: ["sort", "timeframe", "cursor"],
|
|
171
|
+
list: true,
|
|
172
|
+
choices: { sort: ["relevance", "new", "top", "comment_count"] },
|
|
173
|
+
},
|
|
174
|
+
subreddit: { method: "GET", path: "/desearch/reddit/subreddit/{name}", required: ["name"], optional: [] },
|
|
175
|
+
subreddit_posts: {
|
|
176
|
+
method: "GET",
|
|
177
|
+
path: "/desearch/reddit/subreddit/{name}/posts",
|
|
178
|
+
required: ["name"],
|
|
179
|
+
optional: ["sort", "timeframe", "cursor"],
|
|
180
|
+
list: true,
|
|
181
|
+
choices: { sort: ["best", "hot", "new", "top", "rising"] },
|
|
182
|
+
},
|
|
183
|
+
post: { method: "GET", path: "/desearch/reddit/post/{id}", required: ["id"], optional: [] },
|
|
184
|
+
comments: {
|
|
185
|
+
method: "GET",
|
|
186
|
+
path: "/desearch/reddit/comments/{post_id}",
|
|
187
|
+
required: ["post_id"],
|
|
188
|
+
optional: ["cursor"],
|
|
189
|
+
list: true,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
// Threads shows one page of results everywhere: no action takes a cursor.
|
|
193
|
+
threads: {
|
|
194
|
+
search: {
|
|
195
|
+
method: "POST",
|
|
196
|
+
path: "/desearch/threads/search",
|
|
197
|
+
required: ["query"],
|
|
198
|
+
optional: ["start_date", "end_date"],
|
|
199
|
+
list: true,
|
|
200
|
+
},
|
|
201
|
+
search_users: {
|
|
202
|
+
method: "POST",
|
|
203
|
+
path: "/desearch/threads/search/users",
|
|
204
|
+
required: ["query"],
|
|
205
|
+
optional: [],
|
|
206
|
+
list: true,
|
|
207
|
+
},
|
|
208
|
+
profile: { method: "GET", path: "/desearch/threads/profile/{username}", required: ["username"], optional: [] },
|
|
209
|
+
profile_posts: {
|
|
210
|
+
method: "GET",
|
|
211
|
+
path: "/desearch/threads/profile/{username}/posts",
|
|
212
|
+
required: ["username"],
|
|
213
|
+
optional: [],
|
|
214
|
+
list: true,
|
|
215
|
+
},
|
|
216
|
+
post: { method: "GET", path: "/desearch/threads/post/{id}", required: ["id"], optional: [] },
|
|
217
|
+
},
|
|
132
218
|
};
|
|
133
219
|
/** Action names in table order, for the tool's `action` enum. */
|
|
134
220
|
export function socialActionNames(platform) {
|
|
@@ -148,8 +234,9 @@ export function socialActionUsage(platform, action) {
|
|
|
148
234
|
return parts.length > 0 ? parts.join(", ") : "no other arguments";
|
|
149
235
|
}
|
|
150
236
|
/**
|
|
151
|
-
* Light clean-up of a target: trim it, and drop a leading "@" from a username
|
|
152
|
-
* "#" from a tag, which the API takes without them.
|
|
237
|
+
* Light clean-up of a target: trim it, and drop a leading "@" from a username,
|
|
238
|
+
* "#" from a tag, or "r/" from a subreddit name, which the API takes without them.
|
|
239
|
+
* Cursors are never touched.
|
|
153
240
|
*/
|
|
154
241
|
function cleanTarget(name, value) {
|
|
155
242
|
const trimmed = value.trim();
|
|
@@ -159,18 +246,32 @@ function cleanTarget(name, value) {
|
|
|
159
246
|
if (name === "tag") {
|
|
160
247
|
return trimmed.replace(/^#+/, "");
|
|
161
248
|
}
|
|
249
|
+
if (name === "name") {
|
|
250
|
+
return trimmed.replace(/^\/?r\//i, "");
|
|
251
|
+
}
|
|
162
252
|
return trimmed;
|
|
163
253
|
}
|
|
164
254
|
const ARGUMENT_NAMES = [
|
|
165
255
|
"query",
|
|
256
|
+
"type",
|
|
166
257
|
"sort",
|
|
258
|
+
"sort_by",
|
|
259
|
+
"upload_date",
|
|
260
|
+
"duration",
|
|
261
|
+
"timeframe",
|
|
262
|
+
"start_date",
|
|
263
|
+
"end_date",
|
|
167
264
|
"id",
|
|
168
265
|
"username",
|
|
266
|
+
"handle",
|
|
267
|
+
"name",
|
|
169
268
|
"profile_id",
|
|
170
269
|
"post_id",
|
|
171
270
|
"video_id",
|
|
172
271
|
"shortcode",
|
|
173
272
|
"tag",
|
|
273
|
+
"language",
|
|
274
|
+
"order",
|
|
174
275
|
"region",
|
|
175
276
|
"count",
|
|
176
277
|
"cursor",
|
|
@@ -201,7 +302,9 @@ export function socialRequest(platform, args) {
|
|
|
201
302
|
typeof raw === "string" && spec.required.includes(name) ? cleanTarget(name, raw) : raw;
|
|
202
303
|
}
|
|
203
304
|
const missing = spec.required.filter((name) => values[name] === undefined || values[name] === "");
|
|
204
|
-
|
|
305
|
+
const choices = spec.choices ?? {};
|
|
306
|
+
const wrong = Object.keys(choices).filter((name) => values[name] !== undefined && !choices[name].includes(String(values[name])));
|
|
307
|
+
if (missing.length > 0 || extra.length > 0 || wrong.length > 0) {
|
|
205
308
|
const problems = [];
|
|
206
309
|
if (missing.length > 0) {
|
|
207
310
|
problems.push(`${platform} action "${action}" needs ${missing.join(" and ")}.`);
|
|
@@ -209,6 +312,9 @@ export function socialRequest(platform, args) {
|
|
|
209
312
|
if (extra.length > 0) {
|
|
210
313
|
problems.push(`${platform} action "${action}" does not take ${extra.join(", ")}.`);
|
|
211
314
|
}
|
|
315
|
+
for (const name of wrong) {
|
|
316
|
+
problems.push(`${platform} action "${action}" takes ${name} ${choices[name].join(", ")}, not "${String(values[name])}".`);
|
|
317
|
+
}
|
|
212
318
|
throw new Error(`${problems.join(" ")} ${action} takes: ${socialActionUsage(platform, action)}. No request was sent.`);
|
|
213
319
|
}
|
|
214
320
|
const inPath = new Set();
|
|
@@ -237,8 +343,8 @@ export function socialNextStep(platform, action, spec, nextCursor) {
|
|
|
237
343
|
return `More results: call ${platform} again with action "${action}"${same} and cursor set to next_cursor, unchanged. A cursor works for 24 hours.`;
|
|
238
344
|
}
|
|
239
345
|
/**
|
|
240
|
-
* Run one
|
|
241
|
-
*
|
|
346
|
+
* Run one social action. A single post, profile, media item, video, transcript,
|
|
347
|
+
* channel, or subreddit comes back as the API sent it. A list comes back as
|
|
242
348
|
* `{ results, next_cursor, next }`: `next_cursor` is the `x-desearch-next-cursor`
|
|
243
349
|
* header (null on the last page) and `next` says how to ask for the next page.
|
|
244
350
|
*/
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desearch-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"mcpName": "io.github.Desearch-ai/mcp-desearch",
|
|
5
|
-
"description": "AI search (web, Reddit, Hacker News, arXiv, Wikipedia, and Twitter), X (Twitter) search, web search, the Search API, public TikTok, Facebook, and
|
|
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",
|
|
7
7
|
"homepage": "https://desearch.ai",
|
|
8
8
|
"type": "module",
|
|
@@ -52,7 +52,9 @@
|
|
|
52
52
|
"tiktok",
|
|
53
53
|
"linkedin",
|
|
54
54
|
"instagram",
|
|
55
|
-
"facebook"
|
|
55
|
+
"facebook",
|
|
56
|
+
"threads",
|
|
57
|
+
"youtube-transcript"
|
|
56
58
|
],
|
|
57
59
|
"scripts": {
|
|
58
60
|
"build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
|