web-search-mcpSAFE
编码 agent 查资料缺搜索 API key?免 key 搜多个引擎、优先可靠来源并抽取可读正文。 Search the web and read pages without an API key.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
编码 agent 要查最新文档或排查报错,却没有搜索 API key;普通搜索结果还常被广告和低质页面占满。这个工具让 agent 不用 key 也能联网查资料:同时搜索多个引擎,尽量把官方文档等可靠结果排前面,再提取可读的网页正文,省去你手工搜索和复制粘贴。
它以 MCP(Model Context Protocol)stdio 服务接入编码客户端;下文再说明多引擎融合、排序和正文抽取的技术细节。
[](#环境要求) [](#许可证) [](#客户端接入)
为什么选择本项目
通用搜索引擎直接喂给大模型常存在三大痛点:商业推广与 UGC 营销页挤占前排、重定向与泛首页因词面复述取得虚高得分、网页抽取丢失代码块与表格结构。
本项目通过多层质量管线解决上述问题:
- 多引擎直连与融合:中文查询并行聚合国内直连引擎(百度移动端、必应中国、搜狗),英文查询走国际引擎并行融合,经 RRF(Reciprocal Rank Fusion)多路交叉校验。
- 两级垃圾域过滤:对垃圾域名硬过滤(
remove)、对百家号/知乎/CSDN 等 UGC 域降权(lower)。代码内置一份兜底名单(垃圾 TLD + 短链域 + 策划降权域),开箱即生效;完整名单(4,300+ 规则)由npm run update:blacklist从公开上游列表本地生成 —— 该数据文件因上游为 GPL-3.0 许可而不随本仓库分发。实测真实场景查询 nDCG@5 提升 8.4% 且技术查询零回归。 - 权威源信号加权与官方文档召回:识别官方文档子站(如
docs.*、dev.*)并给予权威加权。离线评估集(40 条标注查询)总体 nDCG@5 由0.7788提升至0.9313,hit@1 由0.6667提升至0.9000;另有 8 条查询的同一份候选池在线开/关对照:信号开启时 hit@18/8、关闭时2/8。⚠️ 该 8 条是按"官方域在候选池内"挑出的,结果偏乐观,离线涨幅也相对 09-12 的旧缓存基线,不宜当作普适增益。对技术查询自动推断官方域并发起站内召回,确保官方文档页进候选池。 - API 抢救闸门:仅在生产引擎受限(候选池
raw < 12)时自动并入搜索 API(支持 Tavily / 博查 / 智谱),无 key 时保持纯免费直连。受控 A/B 实测(40 次 API 调用):中文 nDCG@50.6359 → 0.7370(+0.1011),英文逐位零影响;对照的"无条件全并入"策略虽然中文同分,却把英文打掉 5.1% —— 这正是设置闸门条件的意义。 - 结构化 Markdown 抽取:采用
linkedom+Readability+turndown抽取正文,保留标题、代码块、GFM 表格与链接,内置 GBK/GB2312 编码自动探测与解码。
环境要求
- Node.js ≥ 22.5(推荐 Node 24 LTS)
- 原因:项目内置的持久化查询缓存使用了 Node 原生
node:sqlite的DatabaseSync同步接口,无需额外编译 C++ 原生模块。
快速安装
方式 A:一行式接入(推荐,无需 clone、无需配置路径)
MCP 客户端配置里直接用 Release 包地址,npx 会自动拉取并运行:
{
"mcpServers": {
"web-search": {
"command": "npx",
"args": [
"-y",
"https://github.com/awslew/web-search-mcp/releases/download/v1.2.0/web-search-mcp-1.2.0.tgz"
]
}
}
}首次运行会拉取依赖(实测约 *30 秒 / 33 MB
408160df48a7OBSERVED · 2026-10-11Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add web-search-mcp --env BOCHA_API_KEY=${BOCHA_API_KEY} --env OFFICIAL_DOCS_PASS=${OFFICIAL_DOCS_PASS} --env TAVILY_API_KEY=${TAVILY_API_KEY} --env ZHIPU_API_KEY=${ZHIPU_API_KEY} -- npx -y [email protected]{
"mcpServers": {
"web-search-mcp": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"BOCHA_API_KEY": "${BOCHA_API_KEY}",
"OFFICIAL_DOCS_PASS": "${OFFICIAL_DOCS_PASS}",
"TAVILY_API_KEY": "${TAVILY_API_KEY}",
"ZHIPU_API_KEY": "${ZHIPU_API_KEY}"
}
}
}
}Exposed tools (3)
3 read · 0 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
site_search | read | Search within a single website (restricted to one domain). |
web_fetch | read | Fetch a URL and return its readable content as clean Markdown |
web_search | read | Search the web using Baidu + Bing China. Returns title, URL, and snippet. |
Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | PASS |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- declared (5 observation(s))
- Shell
- declared (2 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (7)
function hashQuery(q) { return crypto.createHash("sha1").update(q).digest("hex"); }HTTP_PROXY=http://127.0.0.1:<port> npm run update:blacklist # 需代理(上游列表在境外)
$env:HTTPS_PROXY="http://127.0.0.1:<proxy-port>"
export HTTP_PROXY="http://127.0.0.1:<proxy_port>"
export HTTPS_PROXY="http://127.0.0.1:<proxy_port>"
$env:HTTP_PROXY = "http://127.0.0.1:<proxy_port>"
@modelcontextprotocol/sdk, @mozilla/readability, cheerio, iconv-lite, linkedom, minisearch, turndown, turndown-plugin-gfm
Gates applied: no_behavioural_pass.
408160df48a7full audit observations/trust-audit/mcp-server/awslew__web-search-mcp.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-11 | 408160df48a7 | SAFE | B | 89 | first audit |
Questions
What is the web-search-mcp MCP server?
编码 agent 查资料缺搜索 API key?免 key 搜多个引擎、优先可靠来源并抽取可读正文。 Search the web and read pages without an API key.
What tools does web-search-mcp expose?
3 in total: 3 read-only, 0 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is web-search-mcp safe to connect to an agent?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean server reads B.
What credentials does web-search-mcp need?
It reads BOCHA_API_KEY, OFFICIAL_DOCS_PASS, TAVILY_API_KEY and ZHIPU_API_KEY from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does web-search-mcp run?
It speaks stdio, so it runs as a local process your client starts. It is published on npm as web-search-mcp at 1.2.0.
How current is this page?
The grade is for one exact copy of the source (408160df48a7), read on 2026-10-11. The repository is watched and re-audited when it changes.