better-web-search-mcp 0.2.2 → 0.2.3
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/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +16 -1
- package/dist/tools/index.js.map +1 -1
- package/mcp.json +1 -1
- package/package.json +1 -1
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { Cache } from "../utils/cache.js";
|
|
3
|
+
import { type AppConfig } from "../utils/config.js";
|
|
3
4
|
/**
|
|
4
5
|
* Registers all MCP tools on the given server.
|
|
5
6
|
*
|
|
@@ -7,5 +8,14 @@ import { Cache } from "../utils/cache.js";
|
|
|
7
8
|
* and handler onto the server. A shared cache instance is passed through so
|
|
8
9
|
* search/news/find results are cached across calls.
|
|
9
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* Build the shared cache from configuration.
|
|
13
|
+
*
|
|
14
|
+
* `BETTER_WEB_SEARCH_DISABLE_CACHE` and `BETTER_WEB_SEARCH_CACHE_PATH` were
|
|
15
|
+
* parsed by the config loader and printed in the startup banner, but nothing
|
|
16
|
+
* ever passed them to the Cache: the server opened `data/cache.db` no matter
|
|
17
|
+
* what either said. Both are honored here.
|
|
18
|
+
*/
|
|
19
|
+
export declare function cacheFromConfig(cfg?: AppConfig): Cache;
|
|
10
20
|
export declare function registerTools(server: McpServer, cache?: Cache): void;
|
|
11
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAOhE;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,SAAwB,GAAG,KAAK,CAKpE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAOpE"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Cache } from "../utils/cache.js";
|
|
2
|
+
import { loadConfig } from "../utils/config.js";
|
|
2
3
|
import { registerSearch } from "./search.js";
|
|
3
4
|
import { registerExtract } from "./extract.js";
|
|
4
5
|
import { registerFind } from "./find.js";
|
|
@@ -11,8 +12,22 @@ import { registerResearch } from "./research.js";
|
|
|
11
12
|
* and handler onto the server. A shared cache instance is passed through so
|
|
12
13
|
* search/news/find results are cached across calls.
|
|
13
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* Build the shared cache from configuration.
|
|
17
|
+
*
|
|
18
|
+
* `BETTER_WEB_SEARCH_DISABLE_CACHE` and `BETTER_WEB_SEARCH_CACHE_PATH` were
|
|
19
|
+
* parsed by the config loader and printed in the startup banner, but nothing
|
|
20
|
+
* ever passed them to the Cache: the server opened `data/cache.db` no matter
|
|
21
|
+
* what either said. Both are honored here.
|
|
22
|
+
*/
|
|
23
|
+
export function cacheFromConfig(cfg = loadConfig()) {
|
|
24
|
+
if (!cfg.cacheEnabled) {
|
|
25
|
+
return new Cache({ memory: true });
|
|
26
|
+
}
|
|
27
|
+
return new Cache({ dbPath: cfg.cachePath });
|
|
28
|
+
}
|
|
14
29
|
export function registerTools(server, cache) {
|
|
15
|
-
const sharedCache = cache ??
|
|
30
|
+
const sharedCache = cache ?? cacheFromConfig();
|
|
16
31
|
registerSearch(server, sharedCache);
|
|
17
32
|
registerExtract(server, sharedCache);
|
|
18
33
|
registerFind(server, sharedCache);
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,KAAa;IAC5D,MAAM,WAAW,GAAG,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB,UAAU,EAAE;IAC3D,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QACt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