desearch-mcp-server 0.2.0 → 0.2.2
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 +19 -1
- package/README.md +58 -4
- package/build/http.d.ts +2 -8
- package/build/http.d.ts.map +1 -1
- package/build/http.js +126 -37
- package/build/oauth/client-ip.d.ts +10 -0
- package/build/oauth/client-ip.d.ts.map +1 -0
- package/build/oauth/client-ip.js +28 -0
- package/build/oauth/crypto.d.ts +20 -0
- package/build/oauth/crypto.d.ts.map +1 -0
- package/build/oauth/crypto.js +89 -0
- package/build/oauth/errors.d.ts +9 -0
- package/build/oauth/errors.d.ts.map +1 -0
- package/build/oauth/errors.js +13 -0
- package/build/oauth/flow.d.ts +8 -0
- package/build/oauth/flow.d.ts.map +1 -0
- package/build/oauth/flow.js +424 -0
- package/build/oauth/http.d.ts +25 -0
- package/build/oauth/http.d.ts.map +1 -0
- package/build/oauth/http.js +160 -0
- package/build/oauth/metadata.d.ts +19 -0
- package/build/oauth/metadata.d.ts.map +1 -0
- package/build/oauth/metadata.js +86 -0
- package/build/oauth/page.d.ts +14 -0
- package/build/oauth/page.d.ts.map +1 -0
- package/build/oauth/page.js +92 -0
- package/build/oauth/rate-limit.d.ts +14 -0
- package/build/oauth/rate-limit.d.ts.map +1 -0
- package/build/oauth/rate-limit.js +19 -0
- package/build/oauth/redirects.d.ts +14 -0
- package/build/oauth/redirects.d.ts.map +1 -0
- package/build/oauth/redirects.js +78 -0
- package/build/oauth/store.d.ts +139 -0
- package/build/oauth/store.d.ts.map +1 -0
- package/build/oauth/store.js +606 -0
- package/build/oauth/validate-key.d.ts +21 -0
- package/build/oauth/validate-key.d.ts.map +1 -0
- package/build/oauth/validate-key.js +61 -0
- package/build/request-key.d.ts +9 -0
- package/build/request-key.d.ts.map +1 -0
- package/build/request-key.js +24 -0
- package/build/server.d.ts +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +151 -5
- package/package.json +2 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desearch API key from the remote client.
|
|
3
|
+
* Prefer `Authorization: Bearer <key>` (what MCP clients send). `x-api-key` is
|
|
4
|
+
* accepted as well. A bare `Authorization: <key>` value is accepted so the same
|
|
5
|
+
* string used as `DESEARCH_API_KEY` for stdio can be sent without a scheme.
|
|
6
|
+
* Query strings are ignored so keys do not land in access logs.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractDesearchApiKey(request: Request): string | undefined;
|
|
9
|
+
//# sourceMappingURL=request-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-key.d.ts","sourceRoot":"","sources":["../request-key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAkB1E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desearch API key from the remote client.
|
|
3
|
+
* Prefer `Authorization: Bearer <key>` (what MCP clients send). `x-api-key` is
|
|
4
|
+
* accepted as well. A bare `Authorization: <key>` value is accepted so the same
|
|
5
|
+
* string used as `DESEARCH_API_KEY` for stdio can be sent without a scheme.
|
|
6
|
+
* Query strings are ignored so keys do not land in access logs.
|
|
7
|
+
*/
|
|
8
|
+
export function extractDesearchApiKey(request) {
|
|
9
|
+
const authorization = request.headers.get("authorization")?.trim();
|
|
10
|
+
if (authorization) {
|
|
11
|
+
const bearer = /^Bearer\s+(\S+)$/i.exec(authorization);
|
|
12
|
+
if (bearer?.[1]) {
|
|
13
|
+
return bearer[1];
|
|
14
|
+
}
|
|
15
|
+
if (!/^Bearer\b/i.test(authorization) && !/\s/.test(authorization)) {
|
|
16
|
+
return authorization;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const headerKey = request.headers.get("x-api-key")?.trim();
|
|
20
|
+
if (headerKey) {
|
|
21
|
+
return headerKey;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
package/build/server.d.ts
CHANGED
|
@@ -1,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.2.
|
|
4
|
+
export declare const SERVER_VERSION = "0.2.2";
|
|
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;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE,OAAO,EAaH,KAAK,YAAY,EACpB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,UAAU,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OA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ACH,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,cAAc,EACvB,YAAY,CAAC,EAAE,YAAY,GAC5B,SAAS,CAiyBX"}
|
package/build/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
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
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";
|
|
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.2.
|
|
8
|
+
export const SERVER_VERSION = "0.2.2";
|
|
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;
|
|
@@ -170,6 +170,78 @@ function ok(value) {
|
|
|
170
170
|
content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
+
function structured(value) {
|
|
174
|
+
return {
|
|
175
|
+
content: [{ type: "text", text: JSON.stringify(value) }],
|
|
176
|
+
structuredContent: value,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const WEB_RESULT_KEYS = ["data", "organic", "results", "search_results", "items", "search"];
|
|
180
|
+
function firstString(record, keys) {
|
|
181
|
+
for (const key of keys) {
|
|
182
|
+
const value = record[key];
|
|
183
|
+
if (typeof value === "string" && value.trim()) {
|
|
184
|
+
return value.trim();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return "";
|
|
188
|
+
}
|
|
189
|
+
function searchResultsFrom(value) {
|
|
190
|
+
const rows = [];
|
|
191
|
+
if (Array.isArray(value)) {
|
|
192
|
+
rows.push(...value);
|
|
193
|
+
}
|
|
194
|
+
else if (value && typeof value === "object") {
|
|
195
|
+
const record = value;
|
|
196
|
+
for (const key of WEB_RESULT_KEYS) {
|
|
197
|
+
const entry = record[key];
|
|
198
|
+
if (Array.isArray(entry)) {
|
|
199
|
+
rows.push(...entry);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const out = [];
|
|
204
|
+
const seen = new Set();
|
|
205
|
+
for (const row of rows) {
|
|
206
|
+
if (!row || typeof row !== "object") {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const record = row;
|
|
210
|
+
const url = firstString(record, ["link", "url", "href"]);
|
|
211
|
+
if (!/^https?:\/\//i.test(url) || seen.has(url)) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
seen.add(url);
|
|
215
|
+
out.push({
|
|
216
|
+
id: url,
|
|
217
|
+
title: firstString(record, ["title", "name"]) || url,
|
|
218
|
+
url,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return out;
|
|
222
|
+
}
|
|
223
|
+
function pageText(value) {
|
|
224
|
+
if (typeof value === "string") {
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
if (value && typeof value === "object") {
|
|
228
|
+
const text = firstString(value, ["text", "content", "markdown", "body"]);
|
|
229
|
+
if (text) {
|
|
230
|
+
return text;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return JSON.stringify(value ?? "");
|
|
234
|
+
}
|
|
235
|
+
function titleFromUrl(url) {
|
|
236
|
+
try {
|
|
237
|
+
const parsed = new URL(url);
|
|
238
|
+
const last = parsed.pathname.split("/").filter(Boolean).pop();
|
|
239
|
+
return last ? decodeURIComponent(last) : parsed.hostname;
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return url;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
173
245
|
function fail(label, error) {
|
|
174
246
|
return {
|
|
175
247
|
content: [
|
|
@@ -181,7 +253,7 @@ function fail(label, error) {
|
|
|
181
253
|
isError: true,
|
|
182
254
|
};
|
|
183
255
|
}
|
|
184
|
-
function registerTool(server, apiKey, name, title, description, inputSchema, handler, annotations = READ_ONLY_OPEN_WORLD) {
|
|
256
|
+
function registerTool(server, apiKey, name, title, description, inputSchema, handler, outputSchema, annotations = READ_ONLY_OPEN_WORLD) {
|
|
185
257
|
// SDK 1.30's tool generics blow the TypeScript instantiation limit on these
|
|
186
258
|
// schemas. Runtime registration is the same registerTool call.
|
|
187
259
|
const register = server.registerTool.bind(server);
|
|
@@ -195,6 +267,7 @@ function registerTool(server, apiKey, name, title, description, inputSchema, han
|
|
|
195
267
|
title,
|
|
196
268
|
description,
|
|
197
269
|
inputSchema,
|
|
270
|
+
...(outputSchema ? { outputSchema } : {}),
|
|
198
271
|
annotations: { ...annotations, title },
|
|
199
272
|
}, guarded);
|
|
200
273
|
}
|
|
@@ -211,6 +284,8 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
211
284
|
const server = new McpServer({
|
|
212
285
|
name: SERVER_NAME,
|
|
213
286
|
version: SERVER_VERSION,
|
|
287
|
+
}, {
|
|
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 search, people-search-status reads progress, and people-search-control can pause, resume, or cancel it. Calls need a Desearch API key.",
|
|
214
289
|
});
|
|
215
290
|
registerTool(server, apiKey, "ai-search", "AI Search", "AI search and analysis on web using Desearch AI", {
|
|
216
291
|
prompt: z.string().describe("Question, example: 'What is the latest news on AI?'"),
|
|
@@ -501,6 +576,49 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
501
576
|
return fail("X Trends error", error);
|
|
502
577
|
}
|
|
503
578
|
});
|
|
579
|
+
registerTool(server, apiKey, "search", "Search", "Search the public web and return titles and links. Use fetch with a result URL to read the page.", {
|
|
580
|
+
query: z.string().describe("Search query."),
|
|
581
|
+
}, async ({ query }) => {
|
|
582
|
+
try {
|
|
583
|
+
const results = searchResultsFrom(await desearch.webSearch({ query }));
|
|
584
|
+
return structured({ results });
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
return fail("Search error", error);
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
results: z.array(z.object({
|
|
591
|
+
id: z.string(),
|
|
592
|
+
title: z.string(),
|
|
593
|
+
url: z.string(),
|
|
594
|
+
})),
|
|
595
|
+
});
|
|
596
|
+
registerTool(server, apiKey, "fetch", "Fetch Page", "Read a public page as text. Pass a URL returned by search.", {
|
|
597
|
+
id: z.string().describe("URL of the page to read."),
|
|
598
|
+
}, async ({ id }) => {
|
|
599
|
+
if (typeof id !== "string" || !/^https?:\/\//i.test(id)) {
|
|
600
|
+
return fail("Fetch error", new Error("id must be an http or https URL from search."));
|
|
601
|
+
}
|
|
602
|
+
try {
|
|
603
|
+
const text = pageText(await desearch.extract({ url: id, format: "text" }));
|
|
604
|
+
return structured({
|
|
605
|
+
id,
|
|
606
|
+
title: titleFromUrl(id),
|
|
607
|
+
text,
|
|
608
|
+
url: id,
|
|
609
|
+
metadata: { source: "desearch" },
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
catch (error) {
|
|
613
|
+
return fail("Fetch error", error);
|
|
614
|
+
}
|
|
615
|
+
}, {
|
|
616
|
+
id: z.string(),
|
|
617
|
+
title: z.string(),
|
|
618
|
+
text: z.string(),
|
|
619
|
+
url: z.string(),
|
|
620
|
+
metadata: z.record(z.string(), z.string()).optional(),
|
|
621
|
+
});
|
|
504
622
|
registerTool(server, apiKey, "people-search", "People Search", "Start a People Search: 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. Billed and asynchronous: 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. " +
|
|
505
623
|
platformFilterList() +
|
|
506
624
|
".", strictArgs({
|
|
@@ -583,7 +701,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
583
701
|
catch (error) {
|
|
584
702
|
return fail("People Search error", error);
|
|
585
703
|
}
|
|
586
|
-
}, BILLED_TASK);
|
|
704
|
+
}, undefined, BILLED_TASK);
|
|
587
705
|
registerTool(server, apiKey, "people-search-status", "Get People Search Status", "Status, progress, and cost of one People Search task, plus a page of the people found so far: name, handle, url, platform, audience, location, fit score, why they matched, contacts, and links. Free. People arrive while the search runs: pass the returned next_cursor as cursor on the next call to get only the people found since then. When done is true and has_more is false you have everyone the search found.", strictArgs({
|
|
588
706
|
task_id: peopleTaskId,
|
|
589
707
|
cursor: z
|
|
@@ -622,7 +740,7 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
622
740
|
catch (error) {
|
|
623
741
|
return fail("People Search Control error", error);
|
|
624
742
|
}
|
|
625
|
-
}, TASK_CONTROL);
|
|
743
|
+
}, undefined, TASK_CONTROL);
|
|
626
744
|
registerTool(server, apiKey, "people-search-tasks", "List People Search Tasks", "Your People Search tasks, newest first, with status, counts, and cost. Free. Use it to find a task_id, or to see which searches are still queued, running, or paused: a new search is refused while too many are active.", strictArgs({
|
|
627
745
|
platform: peoplePlatform.optional().describe("Only tasks on this platform: 'x', 'youtube', 'linkedin', or 'tiktok'."),
|
|
628
746
|
status: z
|
|
@@ -716,5 +834,33 @@ export function createDesearchMcpServer(apiKey, client, peopleClient) {
|
|
|
716
834
|
server.server.setRequestHandler(ListResourceTemplatesRequestSchema, () => ({
|
|
717
835
|
resourceTemplates: [],
|
|
718
836
|
}));
|
|
837
|
+
// The installed SDK tool schema has no securitySchemes field. The list
|
|
838
|
+
// handler adds it after the SDK builds the tool list, and copies the same
|
|
839
|
+
// value into `_meta` so clients that drop unknown top-level fields still
|
|
840
|
+
// see it. Connector hosts use it to see that tool calls need OAuth.
|
|
841
|
+
publishToolSecurity(server);
|
|
719
842
|
return server;
|
|
720
843
|
}
|
|
844
|
+
function publishToolSecurity(server) {
|
|
845
|
+
const low = server.server;
|
|
846
|
+
const previous = low._requestHandlers.get("tools/list");
|
|
847
|
+
if (!previous) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
low.setRequestHandler(ListToolsRequestSchema, async (request, extra) => {
|
|
851
|
+
const result = await previous(request, extra);
|
|
852
|
+
if (Array.isArray(result?.tools)) {
|
|
853
|
+
for (const tool of result.tools) {
|
|
854
|
+
const securitySchemes = [{ type: "oauth2", scopes: ["mcp"] }];
|
|
855
|
+
tool.securitySchemes = securitySchemes;
|
|
856
|
+
const existing = tool._meta;
|
|
857
|
+
const meta = existing !== null && typeof existing === "object" && !Array.isArray(existing)
|
|
858
|
+
? { ...existing }
|
|
859
|
+
: {};
|
|
860
|
+
meta.securitySchemes = [{ type: "oauth2", scopes: ["mcp"] }];
|
|
861
|
+
tool._meta = meta;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return result;
|
|
865
|
+
});
|
|
866
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desearch-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@modelcontextprotocol/sdk": "^1.30.1",
|
|
62
62
|
"desearch-js": "^1.5.0",
|
|
63
|
+
"redis": "^5.12.1",
|
|
63
64
|
"undici": "^7.29.1",
|
|
64
65
|
"zod": "^3.24.4"
|
|
65
66
|
},
|