@nite07/websearch-mcp 0.2.4 → 0.2.5

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.
Files changed (3) hide show
  1. package/README.md +56 -84
  2. package/README.zh.md +50 -73
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -21,21 +21,34 @@ run is the caller's decision: one id in `backends` runs one backend, several run
21
21
 
22
22
  ```sh
23
23
  npm install -g @nite07/websearch-mcp
24
+ mkdir -p ~/.config/websearch-mcp
24
25
  websearch-mcp --print-config > ~/.config/websearch-mcp/config.json
25
26
  ```
26
27
 
27
- `--print-config` writes a complete, valid configuration with every backend disabled except Keenable
28
- and Reddit, which need no account.
28
+ This creates the initial settings with Keenable and Reddit enabled; neither needs an account.
29
+ You do not need to edit the generated file. Use the settings page or ask your agent to make changes.
30
+
31
+ ## Connect your MCP client
32
+
33
+ Add a **stdio** MCP server in your client's MCP settings:
34
+
35
+ | Field | Value |
36
+ | --- | --- |
37
+ | Name | `websearch` |
38
+ | Command | `websearch-mcp` |
39
+ | Arguments | None |
40
+
41
+ The command must be available to the client. If it cannot find it, use the full path to the installed
42
+ executable. Clients that only accept a configuration file have their own setup format; follow that
43
+ client's instructions for adding a stdio server.
29
44
 
30
45
  ## First search
31
46
 
32
- 1. Open `~/.config/websearch-mcp/config.json`.
33
- 2. Under `search.backends`, set `"enabled": true` on the providers you want. Anonymous tiers —
34
- Keenable, Exa, You.com, AnySearch, Parallel, Reddit — need nothing else.
35
- 3. Register the server with your MCP client (see **Client configuration**).
36
- 4. Ask the client to search. To see what is available without spending anything, call
37
- `list_backends` first: it reports each backend's modes, cost tier, enabled state and whether a
38
- credential is present. It never enables anything.
47
+ Ask your agent to search using the default backends, or ask it to list the available providers first.
48
+ For example: “Search for recent self-hosting news using Keenable and Reddit.”
49
+
50
+ To choose providers, check costs or change search preferences, use the settings page below or ask the agent to
51
+ manage the settings for you. There is no need to write configuration by hand.
39
52
 
40
53
  ## Search results
41
54
 
@@ -64,99 +77,58 @@ To run only the settings page:
64
77
  websearch-mcp --ui --port 7799 --token replace-with-a-long-random-token
65
78
  ```
66
79
 
67
- ## Client configuration
68
-
69
- ```json
70
- {
71
- "mcpServers": {
72
- "websearch": {
73
- "command": "websearch-mcp",
74
- "env": { "WEBSEARCH_MCP_CONFIG": "/home/you/.config/websearch-mcp/config.json" }
75
- }
76
- }
77
- }
78
- ```
79
-
80
- `--config <path>` works too when you would rather pass the file explicitly. Without either, the
81
- server reads `~/.config/websearch-mcp/config.json`.
82
-
83
80
  ## Credentials
84
81
 
85
- Credential names are fixed by search-core, not configuration fields: a backend id is uppercased with
86
- hyphens turned into underscores, then suffixed with `_KEY`. So Brave is `DSH_SEARCH_BRAVE_KEY` and
87
- Zhihu site search is `DSH_SEARCH_ZHIHU_SITE_KEY`.
88
-
89
- Put them where your client can see them:
90
-
91
- ```json
92
- {
93
- "mcpServers": {
94
- "websearch": {
95
- "command": "websearch-mcp",
96
- "env": {
97
- "WEBSEARCH_MCP_CONFIG": "/home/you/.config/websearch-mcp/config.json",
98
- "DSH_SEARCH_BRAVE_KEY": "…"
99
- }
100
- }
101
- }
102
- }
103
- ```
104
-
105
- If an environment value is absent, `credentials.<backend-id>` may hold the value itself inside the
106
- config file. Values are literal strings: `${...}` is not expanded.
82
+ Enter a provider's API key or account credential on its card in the settings page and save.
83
+ You can also authorize the agent to set or remove a credential with `search_manage`.
84
+ Credential values are never returned by that tool. Do not paste secrets into a shared conversation.
107
85
 
108
86
  ## Browser-backed search
109
87
 
110
- Xiaohongshu search and note reading need a browser container. Start
111
- it from [packages/core/image](../core/image/README.md), sign in over VNC, then point the server at it:
112
-
113
- ```json
114
- {
115
- "search": {
116
- "browser": {
117
- "endpoint": "ws://127.0.0.1:3000/ws",
118
- "statePath": "/path/to/search-browser/data/state.json",
119
- "timeoutMs": 60000,
120
- "maxConcurrentReads": 2
121
- },
122
- "backends": {
123
- "xiaohongshu": { "enabled": true, "mode": "browser" }
124
- }
125
- }
126
- }
127
- ```
88
+ Xiaohongshu search and note reading need a browser container:
128
89
 
129
- The endpoint token goes in `DSH_SEARCH_BROWSER_TOKEN`, or in `credentials.browser` inside the file.
130
- Set `statePath` to the container's saved session file. `maxConcurrentReads` (1–8) controls concurrent
131
- reads on the same site.
90
+ 1. Start the [browser container](../core/image/README.md) and sign in to Xiaohongshu over VNC.
91
+ 2. In the settings page's **Browser** section, enter the endpoint and endpoint token shown by the
92
+ container. If you use a saved session file, enter its path there too.
93
+ 3. Enable Xiaohongshu in browser mode in **Backends** and save.
132
94
 
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`.
95
+ Then ask your agent to search Xiaohongshu or read a full share link copied from the app.
135
96
 
136
97
  ## Tools
137
98
 
138
99
  | Tool | What it does |
139
100
  | --- | --- |
140
101
  | `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. |
102
+ | `reddit_thread` | Read a Reddit post, comments and pictures. |
103
+ | `x_thread` | Read an X post, replies and pictures. Requires the X backend in session mode. |
142
104
  | `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
105
  | `list_backends` | List available backends, access modes, costs, enabled state and credential readiness. |
106
+ | `search_manage` | Inspect or change settings and credentials, test a backend, or test page fetching. |
144
107
  | `web_extract` | Read one page as Markdown or HTML. Disabled by default; enable it in **Page fetch**. |
145
108
 
146
109
  `compact: true` omits snippets while keeping links, titles, dates and backend provenance.
147
110
 
148
- ## Page fetching
111
+ The former `read_thread` tool has been replaced by `reddit_thread` and `x_thread`; update existing
112
+ calls to use the platform's tool without a `source` argument.
149
113
 
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.
114
+ ## Agent settings management
152
115
 
153
- ```json
154
- { "url": "https://example.com/article", "format": "markdown" }
155
- ```
116
+ Ask the agent to use `search_manage` to view settings, change backends or page-fetch options, and
117
+ set or remove credentials. It can also test a saved backend or page-fetch setup. Credential values
118
+ are never returned. Changes take effect without restarting the MCP server.
119
+
120
+ For example: “Show me the available free backends, enable Keenable, and save.”
121
+ Tests make real requests and may incur charges. Configuration changes, credential changes and tests
122
+ require your authorization.
123
+
124
+ ## Page fetching
125
+
126
+ Enable **web_extract** in the settings page's **Page fetch** section, or ask the agent to enable it.
127
+ Then ask it to read a URL as Markdown, or return HTML when you need the page structure.
156
128
 
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.
129
+ Browser support is available for JavaScript pages. You can choose a fetch provider on the same page;
130
+ check its supported formats and costs, and supply an API key if required. Public URLs are allowed by
131
+ default.
160
132
 
161
133
  ## Behaviour worth relying on
162
134
 
@@ -173,10 +145,10 @@ an API key if required. Page fetching allows public URLs by default.
173
145
 
174
146
  | Symptom | Cause and fix |
175
147
  | --- | --- |
176
- | The client shows no tools | The server failed to start. Run `websearch-mcp --config <path>` by hand and read the error. |
177
- | Every search fails | No backend is enabled. Call `list_backends`, then enable one and restart the client. |
178
- | A keyed backend reports a missing credential | The environment variable is named after the backend id. Check the exact name with `list_backends`. |
179
- | Xiaohongshu reports no endpoint | `search.browser.endpoint` is empty and the backend has none. |
148
+ | The client shows no tools | The server failed to start. Run `websearch-mcp` in a terminal and read the startup error. |
149
+ | Every search fails | No backend is enabled. Enable one in the settings page or ask the agent to enable it, then retry. |
150
+ | A keyed backend reports a missing credential | Enter the credential on the provider card, or authorize the agent to set it. |
151
+ | Xiaohongshu reports no endpoint | Fill in the endpoint in the settings page’s Browser section. |
180
152
  | Xiaohongshu reports not signed in | The container's session expired. Sign in again over VNC; the next read reloads the state file. |
181
153
 
182
154
  ## Development
package/README.zh.md CHANGED
@@ -15,19 +15,32 @@
15
15
 
16
16
  ```sh
17
17
  npm install -g @nite07/websearch-mcp
18
+ mkdir -p ~/.config/websearch-mcp
18
19
  websearch-mcp --print-config > ~/.config/websearch-mcp/config.json
19
20
  ```
20
21
 
21
- `--print-config` 生成一份完整且合法的配置,除了 Keenable 和 Reddit(这两家不需要账号)之外全部关闭。
22
+ 这会生成初始设置,默认启用无需账号的 Keenable 和 Reddit。无需编辑生成的文件,后续在 Web UI 中操作,或让 Agent 帮你修改即可。
23
+
24
+ ## 接入 MCP 客户端
25
+
26
+ 在客户端的 MCP 设置中添加一个 **stdio** 服务:
27
+
28
+ | 字段 | 填写内容 |
29
+ | --- | --- |
30
+ | 名称 | `websearch` |
31
+ | 命令 | `websearch-mcp` |
32
+ | 参数 | 留空 |
33
+
34
+ 客户端需要能找到该命令;找不到时,填安装后的可执行文件完整路径。如果客户端只接受配置文件,
35
+ 按该客户端的说明添加 stdio 服务即可。
22
36
 
23
37
  ## 第一次搜索
24
38
 
25
- 1. 打开 `~/.config/websearch-mcp/config.json`
26
- 2. 在 `search.backends` 里把想用的那几家改成 `"enabled": true`。匿名档的 Keenable、Exa、You.com、AnySearch、Parallel、Reddit 不需要额外配置
27
- 3. 按「客户端配置」把服务注册到你的 MCP 客户端
28
- 4. 让客户端搜点东西
39
+ 让 Agent 使用默认后端搜索,也可以先让它列出可用服务商。例如:
29
40
 
30
- 想先看看有什么可用又不花钱,调 `list_backends`:它列出每个后端的模式、费用档、启用状态以及有没有凭证,但不会启用任何东西。
41
+ > 用 Keenable 和 Reddit 搜一下最近的自托管新闻。
42
+
43
+ 想更换后端、查看费用或调整搜索偏好,可以使用下面的 Web UI,或直接让 Agent 操作,无需手写配置。
31
44
 
32
45
  ## 搜索结果
33
46
 
@@ -54,91 +67,55 @@ WEBSEARCH_MCP_UI_PORT=7799 WEBSEARCH_MCP_UI_TOKEN=replace-with-a-long-random-tok
54
67
  websearch-mcp --ui --port 7799 --token replace-with-a-long-random-token
55
68
  ```
56
69
 
57
- ## 客户端配置
58
-
59
- ```json
60
- {
61
- "mcpServers": {
62
- "websearch": {
63
- "command": "websearch-mcp",
64
- "env": { "WEBSEARCH_MCP_CONFIG": "/home/you/.config/websearch-mcp/config.json" }
65
- }
66
- }
67
- }
68
- ```
69
-
70
- 想显式指定文件时也可以用 `--config <path>`。两者都没有时,服务读取 `~/.config/websearch-mcp/config.json`。
71
-
72
70
  ## 凭证
73
71
 
74
- 凭证名字由 search-core 固定,不是配置项:后端 id 转大写、连字符换下划线,再加 `_KEY`。Brave 是 `DSH_SEARCH_BRAVE_KEY`,知乎站内是 `DSH_SEARCH_ZHIHU_SITE_KEY`。
75
-
76
- 放到客户端能看到的地方:
77
-
78
- ```json
79
- {
80
- "mcpServers": {
81
- "websearch": {
82
- "command": "websearch-mcp",
83
- "env": {
84
- "WEBSEARCH_MCP_CONFIG": "/home/you/.config/websearch-mcp/config.json",
85
- "DSH_SEARCH_BRAVE_KEY": "…"
86
- }
87
- }
88
- }
89
- }
90
- ```
91
-
92
- 环境变量没有时,可以用配置文件里的 `credentials.<后端-id>` 直接写值。值是字面字符串,`${...}` 不会被展开。
72
+ 在 Web UI 的服务商卡片中填写 API Key 或账号凭证并保存,也可以授权 Agent 通过 `search_manage`
73
+ 设置或清除凭证。该工具不会返回凭证值。不要把密钥粘贴到共享对话中。
93
74
 
94
75
  ## 需要浏览器的搜索
95
76
 
96
- 小红书搜索和笔记读取需要浏览器容器。按 [packages/core/image](../core/image/README.zh.md) 起容器、在 VNC 里登录,然后把它配进来:
97
-
98
- ```json
99
- {
100
- "search": {
101
- "browser": {
102
- "endpoint": "ws://127.0.0.1:3000/ws",
103
- "statePath": "/path/to/search-browser/data/state.json",
104
- "timeoutMs": 60000,
105
- "maxConcurrentReads": 2
106
- },
107
- "backends": {
108
- "xiaohongshu": { "enabled": true, "mode": "browser" }
109
- }
110
- }
111
- }
112
- ```
77
+ 小红书搜索和笔记读取需要浏览器容器:
113
78
 
114
- 端点令牌写在 `DSH_SEARCH_BROWSER_TOKEN` 或文件里的 `credentials.browser`。
115
- `statePath` 填容器保存登录态的文件路径,`maxConcurrentReads`(1–8)控制同一站点的并发读取数。
79
+ 1. 按[浏览器容器说明](../core/image/README.zh.md)启动容器,在 VNC 中登录小红书。
80
+ 2. 在 Web UI 的「浏览器」部分填写容器提供的端点和端点令牌;使用登录态文件时,也在这里填写路径。
81
+ 3. 在「后端」中启用小红书的 browser 模式并保存。
116
82
 
117
- 读取笔记时,向 `xiaohongshu_note` 传入 App 中复制的完整分享链接,或之前搜索返回的笔记 id。
83
+ 随后就可以让 Agent 搜索小红书,或读取从 App 复制的完整分享链接。
118
84
 
119
85
  ## 工具
120
86
 
121
87
  | 工具 | 做什么 |
122
88
  | --- | --- |
123
89
  | `web_search` | 搜索指定后端。必填 `query`,可选 `backends`、`allBackends`、`exclude`、`compact`、`maxResults`。只指定一个后端就只搜这一家,不指定则搜索所有已启用后端。 |
124
- | `read_thread` | 读取 Reddit 帖子和评论,或 X 帖子和回复,包括配图。X 需要会话模式。 |
90
+ | `reddit_thread` | 读取 Reddit 帖子、评论和配图。 |
91
+ | `x_thread` | 读取 X 帖子、回复和配图,需要 X 后端处于会话模式。 |
125
92
  | `xiaohongshu_note` | 读取笔记正文、作者、互动数据、标签和配图,可选读取评论。需要启用小红书后端的 browser 模式并配置浏览器。 |
126
93
  | `list_backends` | 查看后端、接入模式、费用、启用状态和凭证是否就绪。 |
94
+ | `search_manage` | 查看或修改设置与凭证,测试后端或页面抓取。 |
127
95
  | `web_extract` | 读取单个网页,返回 Markdown 或 HTML。默认关闭,在「页面抓取」中启用。 |
128
96
 
129
97
  `compact: true` 不返回摘要,保留链接、标题、日期和来源后端。
130
98
 
131
- ## 页面抓取
99
+ 原 `read_thread` 已由 `reddit_thread` 和 `x_thread` 替代,已有调用请改用对应平台的工具,不再传入 `source`。
132
100
 
133
- 用 `web_extract` 读取已知 URL,返回 Markdown 或 HTML。在设置页启用,或将配置文件中的
134
- `search.tools.webExtract` 设为 `true`。
101
+ ## 让 Agent 管理设置
135
102
 
136
- ```json
137
- { "url": "https://example.com/article", "format": "markdown" }
138
- ```
103
+ 可以让 Agent 用 `search_manage` 查看设置、调整后端或页面抓取选项、设置或清除凭证,
104
+ 也可以测试已保存的后端与抓取配置。工具不会返回凭证值,修改后无需重启 MCP 服务。
105
+
106
+ 例如:
107
+
108
+ > 帮我看看有哪些免费后端,启用 Keenable 并保存。
109
+
110
+ 测试会发出真实请求,可能产生费用。修改配置、凭证或运行测试前,都需要你的授权。
111
+
112
+ ## 页面抓取
113
+
114
+ 在 Web UI 的「页面抓取」中启用 **web_extract**,或让 Agent 帮你启用。
115
+ 随后让它读取指定网页,返回 Markdown;需要查看页面结构时,可以要求返回 HTML。
139
116
 
140
- 需要查看页面结构时使用 `"html"`。支持读取需要 JavaScript 的页面,也可以在「页面抓取」中选择服务商。
141
- 使用前请查看支持的格式和费用,需要 API Key 的模式应先填写凭证。默认只允许公网地址。
117
+ 支持读取需要 JavaScript 的页面,也可以在同一页面选择抓取服务商。使用前请查看支持的格式和费用,
118
+ 需要 API Key 的模式先填写凭证。默认只允许公网地址。
142
119
 
143
120
  ## 可以依赖的行为
144
121
 
@@ -152,10 +129,10 @@ websearch-mcp --ui --port 7799 --token replace-with-a-long-random-token
152
129
 
153
130
  | 现象 | 原因与处理 |
154
131
  | --- | --- |
155
- | 客户端里看不到工具 | 服务没起来。手动跑一次 `websearch-mcp --config <path>` 看报错。 |
156
- | 每次搜索都失败 | 没有启用任何后端。先调 `list_backends`,启用一家,再重启客户端。 |
157
- | 某个要 Key 的后端报缺凭证 | 环境变量名是按后端 id 生成的,用 `list_backends` 核对准确名字。 |
158
- | 小红书报没有端点 | `search.browser.endpoint` 是空的,后端自己也没配端点。 |
132
+ | 客户端里看不到工具 | 服务没起来。在终端运行 `websearch-mcp` 查看启动报错。 |
133
+ | 每次搜索都失败 | 没有启用任何后端。在 Web UI 中启用一家,或让 Agent 帮你启用,再重试。 |
134
+ | 某个要 Key 的后端报缺凭证 | 在服务商卡片中填写凭证,或授权 Agent 设置。 |
135
+ | 小红书报没有端点 | 在 Web UI 的「浏览器」部分填写端点。 |
159
136
  | 小红书报未登录 | 容器的登录态过期了。去 VNC 里重新登录,下次读取会重新加载会话文件。 |
160
137
 
161
138
  ## 开发
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nite07/websearch-mcp",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
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",