dsh-free-search 0.9.66 → 0.9.67
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/README.md +2 -2
- package/lib/client.js +1 -1
- package/lib/mcp_server.js +93 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -548,7 +548,7 @@ Search engine test:
|
|
|
548
548
|
npx -y -p dsh-free-search dsh-free-search-mcp
|
|
549
549
|
```
|
|
550
550
|
|
|
551
|
-
`web_search` 默认只自动调用免 key 的 Bing / DuckDuckGo;在参数或 `MCP_SEARCH_ENGINE` 里显式点名 `google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu` / `perplexity` / `serpbase` / `serply` / `outcrawl` / `tinyfish` / `jina` / `kimi` / `aliyun` / `doubao` / `zhihu_global` / `zhihu_site` / `specstream` / `deepseek-official` / `openai` / `gemini` / `claude` / `agy` 时才会使用付费或有额度限制的引擎;`anysearch` / `searxng` / `exa` / `tavily` / `keenable` / `firecrawl` / `parallel` / `you` 可显式选择,且有免 key 档;`degoog` 需要 `MCP_DEGOOG_INSTANCES`;`baidu-html` / `so360` / `sogou` / `wechat` / `toutiao` 是默认关闭的 HTML SERP 抓取引擎。支持 `time_range`(day/week/month/year)。`advanced_search` 是同一后端的兼容别名,便于按宿主工具名调用。`web_fetch` 仍走直连 / 浏览器 / Exa / Firecrawl。`multi_search` 并行合并多个引擎(默认只跑免费引擎),`domain_search` 直查包/论文/CVE/财报/金融/法律等垂直源,`platform_search` 直查 GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/掘金/豆瓣/Qiita/YouTube/Vimeo/X,`video_search` 查 Bing/DDG 视频,`research` 做轻量多引擎检索 + 抓取 + 证据摘要,`weather` 查询 1–7 天天气;不监听端口。Claude Desktop 配置示例:
|
|
551
|
+
`web_search` 默认只自动调用免 key 的 Bing / DuckDuckGo;在参数或 `MCP_SEARCH_ENGINE` 里显式点名 `google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu` / `perplexity` / `serpbase` / `serply` / `outcrawl` / `tinyfish` / `jina` / `kimi` / `aliyun` / `doubao` / `zhihu_global` / `zhihu_site` / `specstream` / `deepseek-official` / `openai` / `gemini` / `claude` / `agy` 时才会使用付费或有额度限制的引擎;`anysearch` / `searxng` / `exa` / `tavily` / `keenable` / `firecrawl` / `parallel` / `you` 可显式选择,且有免 key 档;`degoog` 需要 `MCP_DEGOOG_INSTANCES`;`baidu-html` / `so360` / `sogou` / `wechat` / `toutiao` 是默认关闭的 HTML SERP 抓取引擎。支持 `time_range`(day/week/month/year)。`advanced_search` 是同一后端的兼容别名,便于按宿主工具名调用。`web_fetch` 仍走直连 / 浏览器 / Exa / Firecrawl。`multi_search` 并行合并多个引擎(默认只跑免费引擎),`domain_search` 直查包/论文/CVE/财报/金融/法律等垂直源,`platform_search` 直查 GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/掘金/豆瓣/Qiita/YouTube/Vimeo/X,`video_search` 查 Bing/DDG 视频,`research` 做轻量多引擎检索 + 抓取 + 证据摘要,`cache_search` 检索本地研究缓存,`free_search_test` 逐引擎探测,`weather` 查询 1–7 天天气;不监听端口。Claude Desktop 配置示例:
|
|
552
552
|
|
|
553
553
|
```json
|
|
554
554
|
{
|
|
@@ -1292,7 +1292,7 @@ The repo also ships a standalone stdio MCP server for Claude Desktop, Cursor, Co
|
|
|
1292
1292
|
npx -y -p dsh-free-search dsh-free-search-mcp
|
|
1293
1293
|
```
|
|
1294
1294
|
|
|
1295
|
-
`web_search` auto-runs only the keyless Bing / DuckDuckGo engines; a keyed engine (`google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu` / `perplexity` / `serpbase` / `serply` / `outcrawl` / `tinyfish` / `jina` / `kimi` / `aliyun` / `doubao` / `zhihu_global` / `zhihu_site` / `specstream` / `deepseek-official` / `openai` / `gemini` / `claude` / `agy`) runs only when named in the argument or `MCP_SEARCH_ENGINE`; `anysearch` / `searxng` / `exa` / `tavily` / `keenable` / `firecrawl` / `parallel` / `you` can also be named explicitly and have keyless tiers; `degoog` needs `MCP_DEGOOG_INSTANCES`; `baidu-html` / `so360` / `sogou` / `wechat` / `toutiao` are opt-in HTML SERP scrapers. It supports `time_range` (day/week/month/year). `advanced_search` is a compatibility alias over the same backend for hosts that call that tool name. `web_fetch` still uses direct / browser / Exa / Firecrawl. `multi_search` merges several engines in parallel (free engines by default), `domain_search` queries structured package/paper/CVE/filing/finance/law sources, `platform_search` queries GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/Juejin/Douban/Qiita/YouTube/Vimeo/X, `video_search` queries Bing/DDG videos, `research` runs a lightweight multi-engine search + fetch + evidence brief, and `weather` returns a 1-7 day forecast; the server does not listen on a port. Claude Desktop example:
|
|
1295
|
+
`web_search` auto-runs only the keyless Bing / DuckDuckGo engines; a keyed engine (`google` / `baidu` / `brave` / `metaso` / `yandex` / `yuanbao` / `deepseek-tools` / `zhipu` / `perplexity` / `serpbase` / `serply` / `outcrawl` / `tinyfish` / `jina` / `kimi` / `aliyun` / `doubao` / `zhihu_global` / `zhihu_site` / `specstream` / `deepseek-official` / `openai` / `gemini` / `claude` / `agy`) runs only when named in the argument or `MCP_SEARCH_ENGINE`; `anysearch` / `searxng` / `exa` / `tavily` / `keenable` / `firecrawl` / `parallel` / `you` can also be named explicitly and have keyless tiers; `degoog` needs `MCP_DEGOOG_INSTANCES`; `baidu-html` / `so360` / `sogou` / `wechat` / `toutiao` are opt-in HTML SERP scrapers. It supports `time_range` (day/week/month/year). `advanced_search` is a compatibility alias over the same backend for hosts that call that tool name. `web_fetch` still uses direct / browser / Exa / Firecrawl. `multi_search` merges several engines in parallel (free engines by default), `domain_search` queries structured package/paper/CVE/filing/finance/law sources, `platform_search` queries GitHub/HN/Reddit/npm/Wikipedia/Bilibili/V2EX/Juejin/Douban/Qiita/YouTube/Vimeo/X, `video_search` queries Bing/DDG videos, `research` runs a lightweight multi-engine search + fetch + evidence brief, `cache_search` searches the local research cache, `free_search_test` probes engines, and `weather` returns a 1-7 day forecast; the server does not listen on a port. Claude Desktop example:
|
|
1296
1296
|
|
|
1297
1297
|
```json
|
|
1298
1298
|
{
|
package/lib/client.js
CHANGED
|
@@ -777,7 +777,7 @@ window.__ModuleLoader__.load({
|
|
|
777
777
|
"cache_search",
|
|
778
778
|
"domain_search",
|
|
779
779
|
];
|
|
780
|
-
const PLUGIN_VERSION = "0.9.
|
|
780
|
+
const PLUGIN_VERSION = "0.9.67";
|
|
781
781
|
const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
|
|
782
782
|
// 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
|
|
783
783
|
const NAV_ITEMS = [
|
package/lib/mcp_server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { ENGINES } from "./domain_engines.js";
|
|
|
7
7
|
import { fetchWeather, formatWeather } from "./weather.js";
|
|
8
8
|
import { PLATFORMS, searchPlatform, searchBingVideos, searchDdgVideos } from "./platform_engines.js";
|
|
9
9
|
import { assessEvidenceQuality } from "./quality.js";
|
|
10
|
+
import { search as cachedPageSearch, put as cachePagePut } from "./cache.js";
|
|
10
11
|
|
|
11
12
|
const SERVER_NAME = "dsh-free-search";
|
|
12
13
|
const PROTOCOL_VERSIONS = ["2024-11-05", "2025-03-26", "2025-06-18"];
|
|
@@ -159,6 +160,39 @@ const TOOLS = [
|
|
|
159
160
|
additionalProperties: false,
|
|
160
161
|
},
|
|
161
162
|
},
|
|
163
|
+
{
|
|
164
|
+
name: "cache_search",
|
|
165
|
+
description: "Search the local cache of pages fetched by research/web_fetch. Returns title, URL, excerpt and fetch time; no network.",
|
|
166
|
+
inputSchema: {
|
|
167
|
+
type: "object",
|
|
168
|
+
properties: {
|
|
169
|
+
query: { type: "string", description: "Text to search in cached titles and bodies." },
|
|
170
|
+
limit: { type: "integer", minimum: 1, maximum: 20, description: "Maximum hits, default 8." },
|
|
171
|
+
},
|
|
172
|
+
required: ["query"],
|
|
173
|
+
additionalProperties: false,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "free_search_test",
|
|
178
|
+
description: "Run a small live probe for one or more search engines and report status, latency and a sample result. Makes network requests; use for diagnostics.",
|
|
179
|
+
inputSchema: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties: {
|
|
182
|
+
engines: {
|
|
183
|
+
type: "array",
|
|
184
|
+
items: { type: "string", enum: MCP_ENGINE_IDS.filter((id) => id !== "auto") },
|
|
185
|
+
minItems: 1,
|
|
186
|
+
maxItems: 20,
|
|
187
|
+
uniqueItems: true,
|
|
188
|
+
description: "Engine ids to probe.",
|
|
189
|
+
},
|
|
190
|
+
query: { type: "string", description: "Probe query, default 'test'." },
|
|
191
|
+
},
|
|
192
|
+
required: ["engines"],
|
|
193
|
+
additionalProperties: false,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
162
196
|
];
|
|
163
197
|
|
|
164
198
|
function packageVersion() {
|
|
@@ -344,10 +378,15 @@ export async function searchVideosWeb(args = {}) {
|
|
|
344
378
|
return { provider: used.join("+") || "video", query, sources };
|
|
345
379
|
}
|
|
346
380
|
|
|
347
|
-
async function fetchDocument(url, maxChars) {
|
|
381
|
+
async function fetchDocument(url, maxChars, title = "") {
|
|
348
382
|
const result = await getFetchProvider().fetch({ url }, undefined);
|
|
349
383
|
const content = String(result?.body?.content ?? "");
|
|
350
384
|
if (content.length === 0) throw new Error(`no readable text (HTTP ${result?.statusCode ?? "?"})`);
|
|
385
|
+
try {
|
|
386
|
+
cachePagePut(result?.url ?? url, title || result?.body?.title || "", content);
|
|
387
|
+
} catch {
|
|
388
|
+
// cache is best effort; a missing local sqlite cache must not fail a fetch
|
|
389
|
+
}
|
|
351
390
|
return {
|
|
352
391
|
url: result?.url ?? url,
|
|
353
392
|
status: result?.statusCode ?? 0,
|
|
@@ -394,7 +433,7 @@ export async function researchWeb(args = {}) {
|
|
|
394
433
|
const candidates = search.sources.slice(0, maxDocuments);
|
|
395
434
|
const perDocumentChars = Math.min(8000, 900 + depth * 1200);
|
|
396
435
|
const settled = await Promise.allSettled(
|
|
397
|
-
candidates.map(async (source) => ({ source, ...(await fetchDocument(source.url, perDocumentChars)) }))
|
|
436
|
+
candidates.map(async (source) => ({ source, ...(await fetchDocument(source.url, perDocumentChars, source.title || "")) }))
|
|
398
437
|
);
|
|
399
438
|
const documents = [];
|
|
400
439
|
settled.forEach((entry, index) => {
|
|
@@ -422,6 +461,54 @@ export async function researchWeb(args = {}) {
|
|
|
422
461
|
};
|
|
423
462
|
}
|
|
424
463
|
|
|
464
|
+
function markdownCacheResults(value) {
|
|
465
|
+
if (!value.hits?.length) return `No cached pages match "${value.query}".`;
|
|
466
|
+
const lines = value.hits.map((hit) => `- ${hit.title || hit.url} - ${hit.url}\n ${hit.excerpt} _(cached ${hit.fetched_at})_`);
|
|
467
|
+
return `Cached pages matching "${value.query}":\n\n${lines.join("\n")}`;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function markdownEngineTests(value) {
|
|
471
|
+
const lines = (value.results ?? []).map((result) => {
|
|
472
|
+
if (result.ok) return `- ${result.engine}: ok · ${result.sources} source(s)${result.sample ? ` · ${result.sample}` : ""}`;
|
|
473
|
+
return `- ${result.engine}: failed · ${result.error}`;
|
|
474
|
+
});
|
|
475
|
+
return `Engine test (${value.query}):\n\n${lines.join("\n") || "No engine results."}`;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export async function searchCachedPages(args = {}) {
|
|
479
|
+
const query = String(args.query ?? "").trim();
|
|
480
|
+
if (!query) throw new Error("query is required");
|
|
481
|
+
const limit = Math.min(Math.max(Number(args.limit) || 8, 1), 20);
|
|
482
|
+
return { query, hits: cachedPageSearch(query, limit) };
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export async function testEngines(args = {}) {
|
|
486
|
+
const engines = Array.isArray(args.engines)
|
|
487
|
+
? [...new Set(args.engines.map((id) => String(id ?? "").trim().toLowerCase()).filter(Boolean))]
|
|
488
|
+
: [];
|
|
489
|
+
if (engines.length === 0) throw new Error("engines must be a non-empty array");
|
|
490
|
+
for (const engine of engines) {
|
|
491
|
+
if (engine === "auto" || !MCP_ENGINE_IDS.includes(engine)) throw new Error(`unknown engine "${engine}"`);
|
|
492
|
+
}
|
|
493
|
+
const query = String(args.query ?? "").trim() || "test";
|
|
494
|
+
const results = await Promise.allSettled(engines.map((engine) => runMcpEngine(engine, query, { maxResults: 2 })));
|
|
495
|
+
return {
|
|
496
|
+
query,
|
|
497
|
+
results: results.map((entry, index) => {
|
|
498
|
+
if (entry.status === "fulfilled") {
|
|
499
|
+
const sources = entry.value.sources ?? [];
|
|
500
|
+
return {
|
|
501
|
+
engine: engines[index],
|
|
502
|
+
ok: true,
|
|
503
|
+
sources: sources.length,
|
|
504
|
+
sample: sources[0]?.title || sources[0]?.url || "",
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return { engine: engines[index], ok: false, error: entry.reason?.message ?? String(entry.reason) };
|
|
508
|
+
}),
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
425
512
|
export async function searchWeb(args = {}) {
|
|
426
513
|
const query = String(args.query ?? "").trim();
|
|
427
514
|
if (!query) throw new Error("query is required");
|
|
@@ -467,6 +554,8 @@ export function createMcpHandler({
|
|
|
467
554
|
platformSearch = searchPlatformWeb,
|
|
468
555
|
videoSearch = searchVideosWeb,
|
|
469
556
|
research = researchWeb,
|
|
557
|
+
cacheSearch = searchCachedPages,
|
|
558
|
+
testEngines: testEnginesTool = testEngines,
|
|
470
559
|
version = packageVersion(),
|
|
471
560
|
} = {}) {
|
|
472
561
|
const handleTool = async (name, args) => {
|
|
@@ -493,6 +582,8 @@ export function createMcpHandler({
|
|
|
493
582
|
return markdownResults(result.query ?? args?.query ?? "", result.provider ?? "video", result.sources ?? []);
|
|
494
583
|
}
|
|
495
584
|
if (name === "research") return markdownResearch(await research(args));
|
|
585
|
+
if (name === "cache_search") return markdownCacheResults(await cacheSearch(args));
|
|
586
|
+
if (name === "free_search_test") return markdownEngineTests(await testEnginesTool(args));
|
|
496
587
|
throw new Error(`unknown tool "${name}"`);
|
|
497
588
|
};
|
|
498
589
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-free-search",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.67",
|
|
4
4
|
"description": "Free web search for DeepSeek Harness: 42 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable/Firecrawl/Parallel/Brave/Zhipu/You.com keyless; Zhihu global/site via MCP and Perplexity/SerpBase/DeepSeek (official + native tools/search)/Baidu/Kimi/Aliyun/Doubao/Google CSE/Metaso/Yandex/Yuanbao/SpecStream with key; OpenAI/Gemini/Claude model built-in search, explicit-only) + auto smart routing + global engine enable/disable & fallback priority + editable zh/en language pools + multi mode (parallel full language-pool merge) + multi_search cross-source tool + failure-aware fallback (quota/auth cooldown, transient retry, fallbackOn) + time filtering + platform search + domain blocklist (blockedDomains) + web_fetch, with web settings UI, plus a standalone stdio MCP server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|