@nite07/websearch-mcp 0.2.3 → 0.2.4
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 +40 -76
- package/README.zh.md +37 -46
- package/dist/sdk.js +16 -1
- package/dist/tools.js +16 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,50 +32,36 @@ and Reddit, which need no account.
|
|
|
32
32
|
1. Open `~/.config/websearch-mcp/config.json`.
|
|
33
33
|
2. Under `search.backends`, set `"enabled": true` on the providers you want. Anonymous tiers —
|
|
34
34
|
Keenable, Exa, You.com, AnySearch, Parallel, Reddit — need nothing else.
|
|
35
|
-
3. Register the server with your MCP client (
|
|
35
|
+
3. Register the server with your MCP client (see **Client configuration**).
|
|
36
36
|
4. Ask the client to search. To see what is available without spending anything, call
|
|
37
37
|
`list_backends` first: it reports each backend's modes, cost tier, enabled state and whether a
|
|
38
38
|
credential is present. It never enables anything.
|
|
39
39
|
|
|
40
|
+
## Search results
|
|
41
|
+
|
|
42
|
+
Each result names the backends that found it, including multiple sources for the same page.
|
|
43
|
+
The response also shows which backends were used and whether it came from the cache.
|
|
44
|
+
|
|
40
45
|
## Settings page
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
credential in one form, plus a probe button per backend. **The MCP server serves it itself** — one
|
|
44
|
-
process, no extra unit, container or port-forwarder to install:
|
|
47
|
+
Use the settings page to choose backends, check costs, enter credentials and test your setup:
|
|
45
48
|
|
|
46
49
|
```sh
|
|
47
|
-
WEBSEARCH_MCP_UI_PORT=7799 WEBSEARCH_MCP_UI_TOKEN
|
|
50
|
+
WEBSEARCH_MCP_UI_PORT=7799 WEBSEARCH_MCP_UI_TOKEN=replace-with-a-long-random-token websearch-mcp
|
|
48
51
|
```
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- With a token the first request carries `?token=`, exchanged for an `HttpOnly`, `SameSite=Strict`
|
|
60
|
-
cookie, so the link does not stay in browser history.
|
|
61
|
-
- Saving validates against the same schema the server enforces. A rejected save leaves the file
|
|
62
|
-
untouched and lists every problem by path; an accepted one writes `config.json.bak-<local time>`
|
|
63
|
-
(five kept) and replaces the file atomically at mode 0600. The server watching that file reloads
|
|
64
|
-
immediately, so the next `web_search` already uses what the page saved.
|
|
65
|
-
- The page has **Search** and **Page fetch** tabs over one shared draft: the fetch tab edits route
|
|
66
|
-
order and enablement, per-route fallback rules, the one selected fetch provider (with its own access
|
|
67
|
-
mode, endpoint, timeout and options), the safety limits, and a user-triggered fetch test that takes a
|
|
68
|
-
URL and a required format. Fetch settings live in the same file, so a running server picks them up
|
|
69
|
-
through the same watcher.
|
|
70
|
-
- A file that stops parsing keeps the previous configuration and says why on stderr.
|
|
71
|
-
- When a `config.container.json` sits beside the file, every save rewrites it too: loopback endpoints
|
|
72
|
-
become `host.containers.internal`, and the browser session file is mapped into `/host/home`. The
|
|
73
|
-
companion is never created on its own.
|
|
74
|
-
|
|
75
|
-
Page without an MCP client, for a quick look:
|
|
53
|
+
Open `http://127.0.0.1:7799/?token=replace-with-a-long-random-token`. The page is available while the MCP server is running.
|
|
54
|
+
Set `WEBSEARCH_MCP_UI_HOST` if you need a different bind address. Without a token, the page is open;
|
|
55
|
+
set one before exposing it beyond your machine.
|
|
56
|
+
|
|
57
|
+
The page has sections for search, reliability, diagnostics, backends, browser setup and page fetching.
|
|
58
|
+
Saved changes take effect on the next call, without restarting the server. Invalid changes are
|
|
59
|
+
rejected; recent configuration backups are kept automatically.
|
|
60
|
+
|
|
61
|
+
To run only the settings page:
|
|
76
62
|
|
|
77
63
|
```sh
|
|
78
|
-
websearch-mcp --ui --
|
|
64
|
+
websearch-mcp --ui --port 7799 --token replace-with-a-long-random-token
|
|
79
65
|
```
|
|
80
66
|
|
|
81
67
|
## Client configuration
|
|
@@ -117,12 +103,11 @@ Put them where your client can see them:
|
|
|
117
103
|
```
|
|
118
104
|
|
|
119
105
|
If an environment value is absent, `credentials.<backend-id>` may hold the value itself inside the
|
|
120
|
-
config file. Values are literal strings: `${...}` is not expanded.
|
|
121
|
-
discarded on load so a file can never redirect a lookup.
|
|
106
|
+
config file. Values are literal strings: `${...}` is not expanded.
|
|
122
107
|
|
|
123
108
|
## Browser-backed search
|
|
124
109
|
|
|
125
|
-
Xiaohongshu
|
|
110
|
+
Xiaohongshu search and note reading need a browser container. Start
|
|
126
111
|
it from [packages/core/image](../core/image/README.md), sign in over VNC, then point the server at it:
|
|
127
112
|
|
|
128
113
|
```json
|
|
@@ -142,54 +127,36 @@ it from [packages/core/image](../core/image/README.md), sign in over VNC, then p
|
|
|
142
127
|
```
|
|
143
128
|
|
|
144
129
|
The endpoint token goes in `DSH_SEARCH_BROWSER_TOKEN`, or in `credentials.browser` inside the file.
|
|
145
|
-
`
|
|
146
|
-
|
|
147
|
-
starts signed out.
|
|
130
|
+
Set `statePath` to the container's saved session file. `maxConcurrentReads` (1–8) controls concurrent
|
|
131
|
+
reads on the same site.
|
|
148
132
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
carries the token the read needs) or a note id an earlier search returned.
|
|
133
|
+
To read a note, pass its full share link from the app, or a note id returned by an earlier search,
|
|
134
|
+
to `xiaohongshu_note`.
|
|
152
135
|
|
|
153
136
|
## Tools
|
|
154
137
|
|
|
155
138
|
| Tool | What it does |
|
|
156
139
|
| --- | --- |
|
|
157
|
-
| `web_search` | Search
|
|
158
|
-
| `read_thread` | Read
|
|
159
|
-
| `xiaohongshu_note` | Read
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
| `web_extract` | Fetch **one** page: `url` plus a required `format` (`markdown` to read, `html` to inspect structure). Only one URL per call, never a crawl. Route order, provider selection, credentials and fallback rules are saved configuration. Returned page content is untrusted. **Hidden until `search.tools.webExtract` is `true`**: while it is off the tool is absent from `tools/list` instead of being advertised and refusing to run, and turning it on or off reloads through the SDK's `notifications/tools/list_changed`. |
|
|
165
|
-
|
|
166
|
-
`compact: true` returns URL, title and date only, which is usually the difference between a usable
|
|
167
|
-
context and a flooded one.
|
|
140
|
+
| `web_search` | Search selected backends with `query`. Optional: `backends`, `allBackends`, `exclude`, `compact`, `maxResults`. One backend id searches only that backend; omitting the selection searches every enabled backend. |
|
|
141
|
+
| `read_thread` | Read a Reddit post and comments or an X post and replies, including pictures. X requires session mode. |
|
|
142
|
+
| `xiaohongshu_note` | Read a note's text, author, engagement, tags and pictures, with optional comments. Requires the Xiaohongshu backend in browser mode and a configured browser. |
|
|
143
|
+
| `list_backends` | List available backends, access modes, costs, enabled state and credential readiness. |
|
|
144
|
+
| `web_extract` | Read one page as Markdown or HTML. Disabled by default; enable it in **Page fetch**. |
|
|
145
|
+
|
|
146
|
+
`compact: true` omits snippets while keeping links, titles, dates and backend provenance.
|
|
168
147
|
|
|
169
148
|
## Page fetching
|
|
170
149
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
`search.tools.webExtract` defaults to `false`; with it off the tool is hidden while the configuration,
|
|
174
|
-
credentials, settings page and library API stay available.
|
|
150
|
+
Use `web_extract` to read a known URL as Markdown or HTML. Enable it in the settings page, or set
|
|
151
|
+
`search.tools.webExtract` to `true` in the configuration file.
|
|
175
152
|
|
|
176
|
-
```
|
|
177
|
-
|
|
153
|
+
```json
|
|
154
|
+
{ "url": "https://example.com/article", "format": "markdown" }
|
|
178
155
|
```
|
|
179
156
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
result then names that trust boundary. Both shipped fetch providers return native Markdown, so
|
|
184
|
-
`format: "html"` is served by the HTTP or browser route, and a Markdown-only provider is skipped
|
|
185
|
-
without a request.
|
|
186
|
-
|
|
187
|
-
## Protocol versions
|
|
188
|
-
|
|
189
|
-
The wire protocol is the [official TypeScript SDK](https://ts.sdk.modelcontextprotocol.io/v2/)
|
|
190
|
-
(`@modelcontextprotocol/server`), not a hand-written loop: the server answers the stateless
|
|
191
|
-
`2026-07-28` revision and falls back to the 2025 handshake for clients that still open with
|
|
192
|
-
`initialize`. A protocol revision therefore reaches this package as a dependency bump.
|
|
157
|
+
Use `"html"` when you need the page structure. Browser support is available for JavaScript pages.
|
|
158
|
+
You can choose a fetch provider in **Page fetch**; check its supported formats and costs, and supply
|
|
159
|
+
an API key if required. Page fetching allows public URLs by default.
|
|
193
160
|
|
|
194
161
|
## Behaviour worth relying on
|
|
195
162
|
|
|
@@ -199,11 +166,8 @@ The wire protocol is the [official TypeScript SDK](https://ts.sdk.modelcontextpr
|
|
|
199
166
|
not; total failures say the search failed. Failed calls are never cached.
|
|
200
167
|
- **Per-call strategy, saved config untouched.** `backends`, `exclude` and `compact` apply to that one
|
|
201
168
|
call, so a narrow lookup and a broad sweep can coexist without editing the file.
|
|
202
|
-
- **Reddit is anonymous by default.** No account needed
|
|
203
|
-
|
|
204
|
-
- **X thread reading follows the site, not a scraper.** The adapter reads the operation the web app
|
|
205
|
-
embeds in the post page and calls it directly, so it survives front-end releases without a
|
|
206
|
-
transaction-id signer.
|
|
169
|
+
- **Reddit is anonymous by default.** No account is needed.
|
|
170
|
+
- **X discussions include replies.** Use session mode with valid account cookies.
|
|
207
171
|
|
|
208
172
|
## Troubleshooting
|
|
209
173
|
|
package/README.zh.md
CHANGED
|
@@ -24,38 +24,34 @@ websearch-mcp --print-config > ~/.config/websearch-mcp/config.json
|
|
|
24
24
|
|
|
25
25
|
1. 打开 `~/.config/websearch-mcp/config.json`
|
|
26
26
|
2. 在 `search.backends` 里把想用的那几家改成 `"enabled": true`。匿名档的 Keenable、Exa、You.com、AnySearch、Parallel、Reddit 不需要额外配置
|
|
27
|
-
3.
|
|
27
|
+
3. 按「客户端配置」把服务注册到你的 MCP 客户端
|
|
28
28
|
4. 让客户端搜点东西
|
|
29
29
|
|
|
30
30
|
想先看看有什么可用又不花钱,调 `list_backends`:它列出每个后端的模式、费用档、启用状态以及有没有凭证,但不会启用任何东西。
|
|
31
31
|
|
|
32
|
+
## 搜索结果
|
|
33
|
+
|
|
34
|
+
每条结果都会标注找到它的后端,同一页面可以保留多个来源。响应还会说明本次使用了哪些后端,
|
|
35
|
+
以及是否命中缓存。
|
|
36
|
+
|
|
32
37
|
## 配置页面
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
**这个页面由 MCP 服务器自己提供**——一个进程,不需要额外的单元、容器或端口转发:
|
|
39
|
+
在配置页面选择后端、查看费用、填写凭证,也可以直接测试是否可用:
|
|
36
40
|
|
|
37
41
|
```sh
|
|
38
|
-
WEBSEARCH_MCP_UI_PORT=7799 WEBSEARCH_MCP_UI_TOKEN
|
|
42
|
+
WEBSEARCH_MCP_UI_PORT=7799 WEBSEARCH_MCP_UI_TOKEN=replace-with-a-long-random-token websearch-mcp
|
|
39
43
|
```
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- 保存用服务端同一套 schema 校验。被拒的保存不动文件,按字段路径列出问题;通过的保存先写
|
|
49
|
-
`config.json.bak-<本地时间>`(保留 5 份),再原子替换并设为 0600。服务一直在 watch 这个文件,
|
|
50
|
-
所以保存完下一次 `web_search` 就用新配置。
|
|
51
|
-
- 文件解析不了时保留上一份可用配置,并在 stderr 说明原因。
|
|
52
|
-
- 配置旁边如果有 `config.container.json`,每次保存会连它一起重写:loopback 端点换成
|
|
53
|
-
`host.containers.internal`,浏览器登录态文件映射到 `/host/home`。没有这个文件就不会凭空创建。
|
|
54
|
-
|
|
55
|
-
不想起 MCP 客户端、只想看一眼页面:
|
|
45
|
+
打开 `http://127.0.0.1:7799/?token=replace-with-a-long-random-token`,页面会随 MCP 服务一起运行。
|
|
46
|
+
需要更改监听地址时设置 `WEBSEARCH_MCP_UI_HOST`。不设令牌时页面无需登录,向本机以外开放前请设置令牌。
|
|
47
|
+
|
|
48
|
+
页面分为搜索、可靠性、诊断、后端、浏览器和页面抓取几个部分。保存后下一次调用即使用新配置,
|
|
49
|
+
无需重启服务;无效配置不会保存,近期配置会自动备份。
|
|
50
|
+
|
|
51
|
+
只运行配置页面:
|
|
56
52
|
|
|
57
53
|
```sh
|
|
58
|
-
websearch-mcp --ui --
|
|
54
|
+
websearch-mcp --ui --port 7799 --token replace-with-a-long-random-token
|
|
59
55
|
```
|
|
60
56
|
|
|
61
57
|
## 客户端配置
|
|
@@ -93,11 +89,11 @@ websearch-mcp --ui --host 0.0.0.0 --port 7799 --print-url # --print-url 只打
|
|
|
93
89
|
}
|
|
94
90
|
```
|
|
95
91
|
|
|
96
|
-
环境变量没有时,可以用配置文件里的 `credentials.<后端-id>` 直接写值。值是字面字符串,`${...}`
|
|
92
|
+
环境变量没有时,可以用配置文件里的 `credentials.<后端-id>` 直接写值。值是字面字符串,`${...}` 不会被展开。
|
|
97
93
|
|
|
98
94
|
## 需要浏览器的搜索
|
|
99
95
|
|
|
100
|
-
|
|
96
|
+
小红书搜索和笔记读取需要浏览器容器。按 [packages/core/image](../core/image/README.zh.md) 起容器、在 VNC 里登录,然后把它配进来:
|
|
101
97
|
|
|
102
98
|
```json
|
|
103
99
|
{
|
|
@@ -115,47 +111,42 @@ websearch-mcp --ui --host 0.0.0.0 --port 7799 --print-url # --print-url 只打
|
|
|
115
111
|
}
|
|
116
112
|
```
|
|
117
113
|
|
|
118
|
-
端点令牌写在 `DSH_SEARCH_BROWSER_TOKEN
|
|
114
|
+
端点令牌写在 `DSH_SEARCH_BROWSER_TOKEN` 或文件里的 `credentials.browser`。
|
|
115
|
+
`statePath` 填容器保存登录态的文件路径,`maxConcurrentReads`(1–8)控制同一站点的并发读取数。
|
|
116
|
+
|
|
117
|
+
读取笔记时,向 `xiaohongshu_note` 传入 App 中复制的完整分享链接,或之前搜索返回的笔记 id。
|
|
119
118
|
|
|
120
119
|
## 工具
|
|
121
120
|
|
|
122
121
|
| 工具 | 做什么 |
|
|
123
122
|
| --- | --- |
|
|
124
|
-
| `web_search` |
|
|
125
|
-
| `read_thread` |
|
|
126
|
-
| `xiaohongshu_note` |
|
|
127
|
-
| `list_backends` |
|
|
123
|
+
| `web_search` | 搜索指定后端。必填 `query`,可选 `backends`、`allBackends`、`exclude`、`compact`、`maxResults`。只指定一个后端就只搜这一家,不指定则搜索所有已启用后端。 |
|
|
124
|
+
| `read_thread` | 读取 Reddit 帖子和评论,或 X 帖子和回复,包括配图。X 需要会话模式。 |
|
|
125
|
+
| `xiaohongshu_note` | 读取笔记正文、作者、互动数据、标签和配图,可选读取评论。需要启用小红书后端的 browser 模式并配置浏览器。 |
|
|
126
|
+
| `list_backends` | 查看后端、接入模式、费用、启用状态和凭证是否就绪。 |
|
|
127
|
+
| `web_extract` | 读取单个网页,返回 Markdown 或 HTML。默认关闭,在「页面抓取」中启用。 |
|
|
128
128
|
|
|
129
|
-
`compact: true`
|
|
129
|
+
`compact: true` 不返回摘要,保留链接、标题、日期和来源后端。
|
|
130
130
|
|
|
131
131
|
## 页面抓取
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
出现在 `tools/list` 里,而配置、凭证、设置页与库 API 仍然可用。
|
|
133
|
+
用 `web_extract` 读取已知 URL,返回 Markdown 或 HTML。在设置页启用,或将配置文件中的
|
|
134
|
+
`search.tools.webExtract` 设为 `true`。
|
|
136
135
|
|
|
137
|
-
```
|
|
138
|
-
|
|
136
|
+
```json
|
|
137
|
+
{ "url": "https://example.com/article", "format": "markdown" }
|
|
139
138
|
```
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
服务商都只返回原生 Markdown,因此 `format: "html"` 由 HTTP 或浏览器路由提供,只支持 Markdown 的服务商
|
|
144
|
-
会在不发请求的情况下被跳过。
|
|
145
|
-
|
|
146
|
-
## 协议版本
|
|
147
|
-
|
|
148
|
-
线上协议交给[官方 TypeScript SDK](https://ts.sdk.modelcontextprotocol.io/v2/)
|
|
149
|
-
(`@modelcontextprotocol/server`),不是手写循环:服务端会说无状态的 `2026-07-28`,对仍在用
|
|
150
|
-
`initialize` 开场的客户端回退到 2025 握手。协议改版因此是升依赖,不是重写连接层。
|
|
140
|
+
需要查看页面结构时使用 `"html"`。支持读取需要 JavaScript 的页面,也可以在「页面抓取」中选择服务商。
|
|
141
|
+
使用前请查看支持的格式和费用,需要 API Key 的模式应先填写凭证。默认只允许公网地址。
|
|
151
142
|
|
|
152
143
|
## 可以依赖的行为
|
|
153
144
|
|
|
154
145
|
- **不切换。** 后端只按你选定的模式、你给的凭证、配置里的端点工作。重试不会换服务商、不会换模式。
|
|
155
146
|
- **失败看得见。** 部分失败返回成功的那部分并点名失败的;全部失败就说搜索失败。失败的调用不会进缓存。
|
|
156
|
-
- **单次策略不动配置。** `
|
|
157
|
-
- **Reddit 默认匿名。**
|
|
158
|
-
- **X
|
|
147
|
+
- **单次策略不动配置。** `backends`、`exclude`、`compact` 只作用这一次,所以窄查询和广撒网可以并存,不用来回改文件。
|
|
148
|
+
- **Reddit 默认匿名。** 不需要账号。
|
|
149
|
+
- **X 讨论支持读取回复。** 需要使用会话模式,并提供有效的账号 Cookie。
|
|
159
150
|
|
|
160
151
|
## 常见问题
|
|
161
152
|
|
package/dist/sdk.js
CHANGED
|
@@ -100,10 +100,25 @@ export function render(value) {
|
|
|
100
100
|
return record.text;
|
|
101
101
|
if (Array.isArray(record.sources)) {
|
|
102
102
|
const lines = [];
|
|
103
|
+
for (const [key, label] of [['enabledBackends', 'Enabled backends'], ['requestedBackends', 'Requested backends'], ['selectedBackends', 'Selected backends'], ['executedBackends', 'Executed backends']]) {
|
|
104
|
+
const ids = record[key];
|
|
105
|
+
if (Array.isArray(ids))
|
|
106
|
+
lines.push(`${label}: ${ids.join(', ') || '(none)'}.`);
|
|
107
|
+
else if (ids === 'all')
|
|
108
|
+
lines.push(`${label}: all enabled (before exclusions).`);
|
|
109
|
+
}
|
|
110
|
+
if (typeof record.cached === 'boolean')
|
|
111
|
+
lines.push(`Cache hit: ${record.cached ? 'yes; no upstream requests were made' : 'no'}.`);
|
|
112
|
+
if (Array.isArray(record.backendStats)) {
|
|
113
|
+
for (const stats of record.backendStats) {
|
|
114
|
+
lines.push(`[${stats.backend}] ${stats.ok ? 'OK' : 'FAILED'}; attempts=${stats.attempts}; sourceCount=${stats.sourceCount} (before filtering and deduplication).`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
103
117
|
if (typeof record.report === 'string' && record.report !== '')
|
|
104
118
|
lines.push(record.report);
|
|
105
119
|
for (const source of record.sources) {
|
|
106
|
-
|
|
120
|
+
const provenance = source.backends?.length ? ` [backends: ${source.backends.join(', ')}]` : '';
|
|
121
|
+
lines.push(`- ${source.title ?? source.url ?? ''} <${source.url ?? ''}>${provenance}`);
|
|
107
122
|
}
|
|
108
123
|
return lines.join('\n') || 'No sources returned.';
|
|
109
124
|
}
|
package/dist/tools.js
CHANGED
|
@@ -56,7 +56,7 @@ export function createTools(config, identity, engine, readers = { reddit: fetchR
|
|
|
56
56
|
};
|
|
57
57
|
const searchTool = {
|
|
58
58
|
name: 'web_search',
|
|
59
|
-
description: 'Search the web through the enabled backends and return citeable sources. The backends array is the whole strategy: one id runs that backend alone, several ids run in parallel, allBackends with exclude is the same choice written as a set, and leaving it out runs every enabled backend. Failures are named instead of being hidden behind an empty result, and the response reports every request that failed. Nothing falls back to another backend, access mode or credential.',
|
|
59
|
+
description: 'Search the web through the enabled backends and return citeable sources. The backends array is the whole strategy: one id runs that backend alone, several ids run in parallel, allBackends with exclude is the same choice written as a set, and leaving it out runs every enabled backend. Failures are named instead of being hidden behind an empty result, and the response reports every request that failed. Nothing falls back to another backend, access mode or credential. The response distinguishes enabled, requested, selected and executed backends, reports cache hits and per-backend statistics, and each merged source carries a backends array naming every backend that found it.',
|
|
60
60
|
inputSchema: {
|
|
61
61
|
type: 'object',
|
|
62
62
|
properties: {
|
|
@@ -83,11 +83,25 @@ export function createTools(config, identity, engine, readers = { reddit: fetchR
|
|
|
83
83
|
...(int(args.maxResults) !== undefined ? { maxResults: int(args.maxResults) } : {}),
|
|
84
84
|
};
|
|
85
85
|
const result = await search.search({ query }, signal, undefined, overrides);
|
|
86
|
+
const selectedBackends = result.outcomes.map(outcome => outcome.backend);
|
|
86
87
|
return {
|
|
87
88
|
sources: result.sources,
|
|
88
89
|
truncated: result.truncated,
|
|
89
90
|
report: result.content,
|
|
90
|
-
|
|
91
|
+
enabledBackends: enabledBackendIds(config),
|
|
92
|
+
requestedBackends: overrides.backends ?? 'all',
|
|
93
|
+
selectedBackends,
|
|
94
|
+
// A selected backend can fail before sending a request; cache hits send none at all.
|
|
95
|
+
executedBackends: result.cached ? [] : result.outcomes.filter(outcome => outcome.attempts > 0).map(outcome => outcome.backend),
|
|
96
|
+
backends: selectedBackends,
|
|
97
|
+
cached: result.cached,
|
|
98
|
+
backendStats: result.outcomes.map(outcome => ({
|
|
99
|
+
backend: outcome.backend,
|
|
100
|
+
ok: outcome.ok,
|
|
101
|
+
attempts: result.cached ? 0 : outcome.attempts,
|
|
102
|
+
sourceCount: outcome.sources.length,
|
|
103
|
+
...(outcome.error ? { error: outcome.error } : {}),
|
|
104
|
+
})),
|
|
91
105
|
};
|
|
92
106
|
},
|
|
93
107
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nite07/websearch-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "MCP server for multi-backend web search plus Reddit and X thread reading, built on @nite07/search-core.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "nite07",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
46
|
-
"@nite07/search-core": "0.2.
|
|
46
|
+
"@nite07/search-core": "0.2.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^22.10.2",
|