@eogee-tech/eosearch 0.0.0-stage → 0.2.1

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Open-WebSearch MCP Server Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,37 @@
1
+ eosearch
2
+ Copyright 2026 eosearch contributors
3
+
4
+ This product includes software developed as part of the Open-WebSearch project.
5
+
6
+ Open-WebSearch MCP Server
7
+ Copyright 2025 Open-WebSearch MCP Server Contributors
8
+ https://github.com/Aas-ee/open-webSearch
9
+ Licensed under the Apache License, Version 2.0
10
+
11
+ Derivative portions of this product (the search engine adapters and network
12
+ utility layer, located under src/engines/, src/utils/, src/core/, src/types/,
13
+ src/config.ts, src/types.ts and src/runtime/) are derived from Open-WebSearch
14
+ and remain licensed under the Apache License, Version 2.0, with the exception
15
+ of the eogee vertical engine adapter (src/engines/eogee/) and the bilibili
16
+ vertical engine adapter (src/engines/bilibili/), which are original eosearch
17
+ code (connecting to the eogee.com knowledge-base gateway and to the Bilibili
18
+ on-site search API, respectively) and are not derived from Open-WebSearch.
19
+
20
+ Modifications made by eosearch contributors include: wiring the Zhihu engine
21
+ and Zhihu article fetcher into the runtime, replacing the original entrypoint
22
+ and MCP tool layer with the eosearch aggregation pipeline (intent routing,
23
+ fusion ranking, TTL caching, circuit-breaker health monitoring, deep search
24
+ and the eosearch tool set), adding native freshness (time-range) parameters
25
+ to the Baidu, Sogou, DuckDuckGo and Hacker News engine adapters together with
26
+ the corresponding shared search execution context field, extending the shared
27
+ web content extractor (src/engines/web/fetchWebContent.ts) so that same-type
28
+ container candidates are concatenated for list-style pages instead of taking
29
+ the first match and a much-shorter Readability result no longer overrides a
30
+ longer built-in extraction, registering a new bilibili vertical search engine
31
+ in the supported engine list (src/core/search/searchEngines.ts), and unwrapping
32
+ Baidu/Sogou redirect-wrapped result links in the aggregation pipeline, and
33
+ related refactoring.
34
+
35
+ The eosearch aggregation layer (src/eosearch/, src/tools/, src/index.ts) is
36
+ Copyright 2026 eosearch contributors and is likewise licensed under the
37
+ Apache License, Version 2.0.
package/README.md CHANGED
@@ -1,3 +1,210 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # EoSearch
2
+
3
+ 本地优先、透明可验证的 Agent 搜索基础设施。查询经意图路由分发到多引擎并行搜索,结果融合去重、透明评分后返回结构化数据;正文抽取内置站点适配器与通用正文提取,`deep_search` 一步产出 token 预算内的干净检索上下文。
4
+
5
+ **三种交付形态**:
6
+
7
+ - **MCP 服务**:部署在服务端,用户通过 Streamable HTTP 端点接入,源码不出服务器;
8
+ - **CLI 命令行客户端**:npm 包 `@eogee-tech/eosearch`(命令名 `eosearch`),薄客户端只封装服务端调用,Agent 与人都能在 Shell 里直接用;npm 包内不含任何引擎与聚合代码;
9
+ - **Skill 开通入口**:`skill/SKILL.md` 交付给最终用户,放入客户端技能目录即生效——Agent 按其中指引完成接入,用户填入API密钥后 EoSearch 能力即开放;纯文档零代码。
10
+
11
+ **鉴权与计费**:与 eogee.com 极会员体系打通——极会员个人密钥即 EoSearch 的访问凭证,按 Key 计配额;不提供匿名通道,未携带有效 Key 的请求一律拒绝。
12
+
13
+ 引擎爬取层派生自开源项目 [Open-WebSearch](https://github.com/Aas-ee/open-webSearch)(Apache License 2.0),聚合管线为原创实现。协议与归属声明见 [NOTICE](./NOTICE)。
14
+
15
+ ## MCP 工具
16
+
17
+ | 工具 | 用途 | 关键参数 |
18
+ |------|------|---------|
19
+ | `eosearch_search` | 多引擎融合搜索,结果带透明评分 | `query` 必填;`limit`、`engines`、`zone`、`searchMode`、`freshness`、`includeDomains`、`excludeDomains`、`format` 可选 |
20
+ | `eosearch_batch_search` | 一次调用并行跑多个独立搜索(默认至多 5 条),每条独立路由与评分 | `queries` 必填(字符串或对象数组);`zone`、`format` 可选 |
21
+ | `eosearch_fetch` | 正文抽取,CSDN/掘金/知乎/Linux.do/GitHub 自动走站点适配器 | `url` 必填;`maxChars`、`readability`、`renderMode` 可选 |
22
+ | `eosearch_deep_search` | 搜索 + 选源 + 并行抓取正文,返回 token 预算内的检索摘录 | `query` 必填;`topN`、`tokenBudget`、`zone`、`engines`、`freshness`、`includeDomains`、`excludeDomains`、`format` 可选 |
23
+
24
+ 每条搜索结果携带 `score`(0-100)、`engines`(来源引擎)与 `reasons`(可读排序理由,如 `#1 on csdn`、`also found by bing`、`download-page penalty`),评分机制完全透明。
25
+
26
+ **委派抓取**:反爬拦截、需 JS 渲染或非文本(PDF/图片)的页面,服务端无法直接提取正文时会返回带 `[委派]` 标记的分级接力指引,由调用方 Agent 用用户本机的浏览器工具完成读取(浏览器直读 → 打印 PDF 交 MinerU 免 Key 极速版 → 精确解析兜底),详见 Skill 文档。
27
+
28
+ **时效与域名过滤**:`freshness`(day/week/month/year)在 baidu、sogou、duckduckgo、hackernews 上走引擎原生时间过滤,其余引擎按标题与描述中可解析的日期做后置兜底(无日期结果保留,不误杀);`includeDomains`/`excludeDomains` 做子域名级的站内/站外过滤。被过滤掉的结果数通过 `filteredOut` 字段透明返回。
29
+
30
+ ## 服务用户接入
31
+
32
+ 用户开通 EoSearch 的标准路径:把 `skill/SKILL.md` 安装到客户端技能目录(如 `.zcode/skills/`、`.claude/skills/`),Agent 按其中指引完成接入;用户填入极会员个人密钥(eogee.com 个人中心「MCP密钥」申请)后,能力即开放、无需其他配置。密钥占位与各客户端(ZCode、Claude Code、Cherry Studio、Cursor 等)的完整配置示例都在 Skill 中。核心配置形如:
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "eosearch": {
38
+ "type": "http",
39
+ "url": "https://eogee.com/search/v1/mcp",
40
+ "headers": { "X-API-Key": "极会员个人密钥" }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## CLI 命令行客户端
47
+
48
+ npm 包 `@eogee-tech/eosearch` 提供 `eosearch` 命令,面向所有能用 Shell 的场景:Agent 的 Bash 工具、CI、一次性沙箱容器、管道组合。服务端与 MCP 共用同一端点与配额,CLI 每次工具调用计 1 次配额,握手不计。
49
+
50
+ ```bash
51
+ npm install -g @eogee-tech/eosearch # 或免安装:npx @eogee-tech/eosearch
52
+ export EOSEARCH_API_KEY=<你的API密钥> # 或在 ~/.eosearchrc 写 {"apiKey":"..."}
53
+ eosearch whoami # 自检:密钥有效即接入完成
54
+ eosearch search "llama.cpp 新版本" --json --limit 5
55
+ eosearch deep "2026 国产大模型对比" --top-n 3
56
+ eosearch batch "量子计算现状" "相关ETF" --json
57
+ eosearch fetch https://github.com/ggml-org/llama.cpp
58
+ ```
59
+
60
+ CLI 每次启动会在后台最多每日检查一次 npm 新版本(缓存 `~/.eosearch-update.json`),有更新时在 stderr 提示,不阻塞当前命令;`CI` / `NO_UPDATE_NOTIFIER=1` 关闭,`--json` 调用不提示。
61
+
62
+ | 子命令 | 对应 MCP 工具 | 说明 |
63
+ |--------|--------------|------|
64
+ | `search <query>` | `eosearch_search` | `--limit`、`--engines`、`--zone`、`--search-mode`、`--freshness`、`--include-domains`、`--exclude-domains`、`--json` |
65
+ | `batch <q1> ... <q5>` | `eosearch_batch_search` | 并行 1-5 条查询,配额计 1 次 |
66
+ | `fetch <url>` | `eosearch_fetch` | `--max-chars`、`--no-readability`、`--render-mode`、`--json` |
67
+ | `deep <query>` | `eosearch_deep_search` | `--top-n`、`--token-budget`、其余过滤项同 search |
68
+ | `whoami` | initialize 握手 | 验证密钥与服务连接,不计配额 |
69
+
70
+ 设计约定:密钥只从环境变量或 `~/.eosearchrc` 读取(不进命令行参数,避免泄漏进 Shell 历史);数据走 stdout、诊断走 stderr;`--json` 输出与服务端 MCP 工具字段一致;语义化退出码——0 成功、1 业务空结果、2 用法错误、3 鉴权失败、4 配额限流、5 服务不可用或执行失败;报错固定三段式(错误/原因/下一步)。
71
+
72
+ 薄客户端边界:npm 包 `files` 只含 `build-cli/`(`src/cli/` 的编译产物),引擎爬取层与聚合层代码不出仓库;顶层 `eosearch` 包名已被无关包占用,故发布名为 `@eogee-tech/eosearch`,命令名仍为 `eosearch`。
73
+
74
+ ## 服务端部署
75
+
76
+ ```bash
77
+ npm install && npm run build
78
+ EOSEARCH_EOGEE_AUTH=true EOSEARCH_REQUIRE_KEY=true MODE=http PORT=3000 node build/index.js
79
+ ```
80
+
81
+ 前置 Nginx 反代并终止 TLS 即可对外服务。生产环境务必配置:
82
+
83
+ 1. `EOSEARCH_REQUIRE_KEY=true`(拒绝匿名访问,当前生产口径);
84
+ 2. `EOSEARCH_API_KEYS` 预留若干静态 Key 供内部测试。
85
+
86
+ 服务本身零 LLM 依赖:搜索与摘录全部由确定性代码完成,理解与总结交给调用方 Agent。
87
+
88
+ 健康检查端点 `GET /health` 无需鉴权,返回各引擎熔断状态,可接入监控。
89
+
90
+ ## 极会员体系集成
91
+
92
+ 启用 `EOSEARCH_EOGEE_AUTH=true` 后,用户传入的密钥会回源 `https://eogee.com/kb/v1/mcp`(MCP 网关)校验:无效密钥网关返回 401,有效密钥返回 200。校验结果带 TTL 缓存(有效 10 分钟、无效 2 分钟),不会每次调用都回源。
93
+
94
+ - 密钥头兼容两种写法:`X-API-Key: <key>`(eogee 生态惯例)与 `Authorization: Bearer <key>`;
95
+ - 回源失败时默认拒绝(503,保收费),设 `EOSEARCH_EOGEE_FAIL_OPEN=true` 改为放行(保可用);
96
+ - 极会员校验与静态 Key(`EOSEARCH_API_KEYS`)可叠加,静态 Key 优先命中。
97
+
98
+ ### 两档配额
99
+
100
+ | 档位 | 判定条件 | 每日 | 每分钟 |
101
+ |------|---------|------|--------|
102
+ | 极会员 | 有效 Key 且等级为 premium | 不限 | 60 次 |
103
+ | 普通用户 | 有效 Key 且等级为 regular | 100 次 | 10 次 |
104
+ | 匿名 | 无 Key | 拒绝(401) | — |
105
+
106
+ 匿名通道不开放:生产配置 `EOSEARCH_REQUIRE_KEY=true`,未携带有效 Key 的请求一律 401。引擎层的匿名配额能力(`EOSEARCH_ANON_*`)仅供自用/内测模式。
107
+
108
+ ### 普通用户 Key 的等级识别(eogee.com 侧对接契约)
109
+
110
+ eogee.com 签发普通用户 Key 后,EoSearch 用以下任一机制识别等级,**可先用地一再升级**:
111
+
112
+ 1. **Key 前缀约定(零后端改动)**:普通用户 Key 统一带固定前缀(如 `reg_`),EoSearch 侧配置 `EOSEARCH_REGULAR_KEY_PREFIX=reg_` 即可自动归入普通档;
113
+ 2. **网关响应头(推荐,最终形态)**:网关在 initialize 响应中回传 `X-Member-Level: premium` 或 `X-Member-Level: regular` 头,EoSearch 自动解析并缓存,前缀规则随之不再依赖。
114
+
115
+ 两种机制同时存在时,响应头优先。
116
+
117
+ ## 鉴权与配额
118
+
119
+ | 变量 | 默认值 | 说明 |
120
+ |------|--------|------|
121
+ | `EOSEARCH_API_KEYS` | 空 | 逗号分隔的静态 Key 列表;为空且未开极会员时鉴权整体关闭(自用模式) |
122
+ | `EOSEARCH_EOGEE_AUTH` | `false` | 启用 API 密钥回源校验 |
123
+ | `EOSEARCH_EOGEE_MCP_URL` | `https://eogee.com/kb/v1/mcp` | 极会员校验网关地址 |
124
+ | `EOSEARCH_EOGEE_FAIL_OPEN` | `false` | 校验后端不可达时 true 放行 / false 拒绝 |
125
+ | `EOSEARCH_EOGEE_CACHE_TTL_MS` | `600000` | 有效密钥缓存时长 |
126
+ | `EOSEARCH_EOGEE_INVALID_TTL_MS` | `120000` | 无效密钥缓存时长(短于有效期,密钥吊销后尽快生效) |
127
+ | `EOSEARCH_EOGEE_CACHE_MAX_ENTRIES` | `5000` | 校验结果缓存容量上限(LRU 驱逐,防恶意喷射 Key 撑爆内存) |
128
+ | `EOSEARCH_REQUIRE_KEY` | `false` | `true` 时拒绝匿名访问(纯会员模式) |
129
+ | `EOSEARCH_REGULAR_KEY_PREFIX` | 空 | 普通用户 Key 前缀约定(如 `reg_`),命中则归入普通档 |
130
+ | `EOSEARCH_KEY_DAILY_LIMIT` | `0`(不限) | 极会员每日配额,营销口径"不限次数" |
131
+ | `EOSEARCH_KEY_MINUTE_LIMIT` | `60` | 极会员每分钟限速(防滥用的真正防线) |
132
+ | `EOSEARCH_REGULAR_DAILY_LIMIT` | `100` | 普通用户每日配额 |
133
+ | `EOSEARCH_REGULAR_MINUTE_LIMIT` | `10` | 普通用户每分钟限速 |
134
+ | `EOSEARCH_ANON_DAILY_LIMIT` | `50` | 匿名每日配额,0 = 不限(仅自用/内测模式,生产拒绝匿名) |
135
+ | `EOSEARCH_ANON_MINUTE_LIMIT` | `10` | 匿名每分钟限速,0 = 不限(仅自用/内测模式) |
136
+
137
+ 配额只计实际工具调用(`tools/call`),连接握手与工具列表查询不计费;一次 `eosearch_batch_search` 无论含几条 query 都只计 1 次调用(单次批量的 query 数上限由 `EOSEARCH_BATCH_MAX_QUERIES` 控制,默认 5)。超限返回 429 并携带 `Retry-After`;成功调用响应携带 `X-Quota-Remaining-Today`。
138
+
139
+ ## 工作原理
140
+
141
+ ```mermaid
142
+ graph LR
143
+ A[MCP 四工具] --> H[鉴权与配额<br/>极会员 / 普通用户两档]
144
+ H --> B[意图路由<br/>语言与领域识别]
145
+ B --> C[引擎健康门<br/>熔断剔除]
146
+ C --> D[多引擎并行<br/>SERP 缓存]
147
+ D --> E[融合评分<br/>去重与透明 score]
148
+ A --> F[抽取管线<br/>站点适配器 + Readability]
149
+ A --> G[deep_search<br/>选源与 token 预算]
150
+ F --> G
151
+ ```
152
+
153
+ 1. **意图路由**:识别查询语言与意图(技术文档 / 代码 / 资讯 / 通用),自动选择引擎组合。中文技术查询优先 CSDN、掘金、Bing;英文代码查询优先 DuckDuckGo、Hacker News。显式传 `engines` 可绕过路由。
154
+ 2. **融合评分**:按归一化 URL 去重聚合,评分 = 引擎内排名 + 多引擎佐证 + 查询词相关性 + 引擎权威度加权;下载站与文库页自动降权,全部分量写入 `reasons`;融合后可再按 `freshness` 与 `includeDomains`/`excludeDomains` 做后置过滤,剔除数透明计入 `filteredOut`。
155
+ 3. **健康监控**:单引擎连续失败触发熔断(冷却后半开重试),单引擎调用有超时竞速,个别引擎卡死不拖慢整体。
156
+ 4. **抽取管线**:CSDN、掘金、知乎、Linux.do 文章与 GitHub README 走专用适配器,失败自动回落通用抓取(Mozilla Readability)。
157
+ 5. **缓存**:SERP 与页面带 TTL 进程内缓存,重复查询零网络开销。
158
+
159
+ ## 环境变量(引擎层,沿用上游)
160
+
161
+ | 变量 | 默认值 | 说明 |
162
+ |------|--------|------|
163
+ | `MODE` | `both` | `stdio`、`http` 或 `both` |
164
+ | `PORT` | `3000` | HTTP 端口 |
165
+ | `DEFAULT_SEARCH_ENGINE` | `bing` | 显式指定未知引擎时的默认引擎 |
166
+ | `ALLOWED_SEARCH_ENGINES` | 全部 | 逗号分隔的引擎白名单 |
167
+ | `USE_PROXY` / `PROXY_URL` | 关闭 | 引擎层 HTTP 代理 |
168
+ | `SEARCH_MODE` | `auto` | Bing 搜索策略 |
169
+ | `EOSEARCH_ROUTE_TOPK` | `3` | 自动路由选择的引擎数量(1-6) |
170
+ | `EOSEARCH_ENGINE_TIMEOUT_MS` | `15000` | 单引擎调用超时 |
171
+ | `EOSEARCH_BREAKER_THRESHOLD` | `3` | 连续失败熔断阈值 |
172
+ | `EOSEARCH_BREAKER_COOLDOWN_MS` | `300000` | 熔断冷却时长 |
173
+ | `EOSEARCH_CACHE_TTL_MS` | `600000` | 搜索结果缓存 TTL |
174
+ | `EOSEARCH_FETCH_CACHE_TTL_MS` | `1800000` | 页面抽取缓存 TTL |
175
+ | `EOSEARCH_BATCH_MAX_QUERIES` | `5` | 单次批量搜索的 query 数上限(1-20) |
176
+ | `EOSEARCH_BATCH_CONCURRENCY` | `2` | 批量搜索的批内并发度(1-10) |
177
+ | `EOSEARCH_EOGEE_KB_API_KEY` | 空 | eogee KB 垂直引擎的服务 Key;配置后 eogee.com 站内内容接入搜索路由,留空则引擎不启用 |
178
+ | `EOSEARCH_EOGEE_KB_MCP_URL` | 同 `EOSEARCH_EOGEE_MCP_URL` | KB 网关地址,同机部署可指向内网回环 |
179
+
180
+ Playwright 浏览器兜底为可选能力,配置方式与上游一致,详见 [Open-WebSearch README](https://github.com/Aas-ee/open-webSearch#readme)。
181
+
182
+ ## 支持的搜索引擎
183
+
184
+ baidu、bing、csdn、duckduckgo、exa、brave、juejin、startpage、sogou、hackernews、zhihu、linuxdo(上游标记暂不可用,显式指定仍可尝试)、eogee(eogee.com 知识库垂直源,原创实现)。
185
+
186
+ eogee 引擎把 eogee.com 站内教程与资讯接入中文技术文档与资讯意图的优先路由:配置 `EOSEARCH_EOGEE_KB_API_KEY` 后自动启用(未配置则不参与路由),通过 MCP 协议调用知识库网关 `search_articles`,多词 query 自动分词多探针并行搜索并按命中覆盖度合并。生产与 KB 同机部署时建议将 `EOSEARCH_EOGEE_KB_MCP_URL` 指向内网回环地址。
187
+
188
+ ## 本地开发
189
+
190
+ ```bash
191
+ git clone <本仓库>
192
+ cd eosearch
193
+ npm install
194
+ npm run build # 编译到 build/
195
+ npm run smoke # 冒烟测试:路由单测 + 真实搜索/抓取/deep_search
196
+ node test/auth-http-test.mjs <极会员Key> # 鉴权集成测试(需先以测试配置起服务)
197
+ npx @modelcontextprotocol/inspector build/index.js # MCP 调试器
198
+ ```
199
+
200
+ ## 许可证与商业化说明
201
+
202
+ Apache License 2.0。引擎爬取层派生自 Open-WebSearch 项目,归属与修改声明见 [NOTICE](./NOTICE)。
203
+
204
+ Apache 2.0 的源码公开义务仅在**分发**软件时触发;将本项目部署于自有服务器对外提供服务不属于分发,源码无需公开。前提:本仓库保持私有、不发布 npm 包。依赖链均为 MIT / Apache 2.0,无 GPL 传染。
205
+
206
+ 使用提示:本项目通过抓取公开搜索引擎结果页工作,引擎自身的服务条款与反爬策略不受本项目控制,请保持合理调用频率,生产环境依靠缓存命中率与限流设计控制风险。
207
+
208
+ ## 数据留存说明
209
+
210
+ 服务进程只在内存中缓存查询词与搜索结果(TTL 到期即弃,进程重启即清零),不落盘、无第三方统计与遥测组件。搜索引擎调用会把查询词转发给相应的搜索引擎(百度、必应、搜狗等),其各自的隐私政策不在本项目控制范围;极会员鉴权仅向 eogee.com 网关回源校验密钥有效性,不做其他数据外传。HTTP 访问日志由 Nginx 等前置网关按运维侧策略管理。