agg-search
This server provides multi-engine web search and layered page fetching for agent workflows.
Run parallel searches across many engines, fuse results with RRF, optionally rerank with Jina, and return ranked results with provenance and engine health.
Tune searches with
top_n, recency, include/exclude domains, snippet length, engine subsets, per-engine timeouts, and fast budget mode.Use domain profiles (
academic,code,news,platform,general) and portal overrides for specialized search behavior.Expand queries with RAG-Fusion and generate cited answers locally or via DeepSeek, optionally fetching top pages first.
Fetch one or more URLs as clean text or Markdown using DeepSeek Fetch or a static → dynamic → stealth container ladder, with tier selection, length limits, per-URL status, and error classification.
Apply SSRF protections and return structured results suitable for MCP clients.
Integrates Brave Search as one of the parallel recall engines, using a Brave API key to retrieve web results that are fused and reranked with results from other engines.
Uses a local Ollama model for RAG-Fusion query expansion and optional cited answer generation, enriching searches and producing answer summaries without requiring a hosted model API.
Integrates SearXNG as a search engine source in the multi-engine recall pool, allowing results from a SearXNG instance to be aggregated and reranked alongside other search providers.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agg-search search for the latest rust async runtime comparisons, top 5 results"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agg-search
多引擎并行召回 + RRF 融合 + Jina 精排的搜索工具链:CLI + MCP server(stdio/HTTP)+ 分层抓取,宿主机零依赖(纯 Python 标准库)。
A multi-engine search stack for agents: parallel recall across fourteen engines (three platform-native sources through the optional Agent-Reach CLI, three keyless domain sources), RRF fusion, listwise reranking, domain profiles, a local feedback loop, plus a tiered fetcher. Ships as a CLI and an MCP server — stdio, or streamable HTTP — with standard library only on the host.
真实一次运行的输出:7 个引擎返回结果,DeepSeek 因余额不足进入冷却、被跳过;空结果不阻塞其余引擎。
为什么又一个搜索聚合器
同类项目不少,但多数是「多引擎 + 简单合并」或「零 key 依赖单一索引」。这个项目的差异在六件事:
DeepSeek 搜索/抓取是一等公民 —— 官方
/v1/tools/search自带rerank_score,/v1/tools/fetch服务端取页直接给 Markdown,省掉容器。抓取是阶梯而不是一个函数 —— 平台 URL 先走 Agent-Reach 结构化读取,再 DeepSeek Fetch → 静态 → 动态 → 反爬,逐级升级,跑在隔离容器里,宿主机不装浏览器。
排序是两阶段 —— RRF 粗排前 15,再交给 Jina Reranker v3.5 listwise 精排;模型不可用链式回退 v3 → v2,全失败则保留 RRF 顺序,绝不阻塞。
韧性层是显式的 —— 5 分钟结果缓存 + 15 分钟页面缓存、按错误类型分级的冷却(额度 1h / 反爬 10min / 超时 90s)、引擎健康与延迟上报,缺 key 的引擎提前剔除不占线程。
面向 Agent 的协议面 —— MCP 双时代:无状态的
2026-07-28(server/discover、resultType、缓存提示)与走握手的2025-11-25及更早版本(含outputSchema/structuredContent、tool annotations、按门户的 prompts)、stdio 与 streamable HTTP 两种传输、按调用计的硬超时与notifications/cancelled、14 家客户端的配置生成器。领域画像 + 本地反馈回路 ——
--profile academic|code|news|platform换的是引擎组合、RRF 权重、默认时效与摘要长度(数据驱动,不改代码);search记录哪些引擎召回了结果、fetch记录哪些被真正读过,agg-search-tune据此调整引擎权重,越用越贴合本机习惯。
Related MCP server: jina-web-mcp
架构
flowchart LR
subgraph clients[Agent clients]
CC[Claude Code]
CX[Codex]
CU[Cursor]
VS[VS Code]
OC[OpenCode]
end
CC & CX & CU & VS & OC -->|stdio JSON-RPC| M[agg-search-mcp]
CC & CU & VS -->|streamable HTTP| H[agg-search-http]
M --> Q
H --> Q[query expansion<br/>local ollama]
Q --> A[exa]
Q --> B[brave]
Q --> C[serper]
Q --> D[deepseek]
Q --> E[firecrawl]
Q --> F[anysearch]
Q --> G[tavily]
Q --> Hh[searxng]
Q --> OA[openalex]
Q --> HN[hn]
Q --> ST[stack]
Q --> AG[ar_github]
Q --> AY[ar_youtube]
Q --> AB[ar_bilibili]
A & B & C & D & E & F & G & Hh & OA & HN & ST & AG & AY & AB --> R[RRF fusion<br/>profile weights ×<br/>learned multipliers]
R --> J[jina rerank v3.5<br/>fallback v3 → v2]
J --> O[top N results<br/>+ provenance + health]
O --> AN[optional cited answer]安装
# PyPI(0.2.0 起)
uvx --from agg-search agg-search-mcp # 不落盘,直接跑
# 或者装成常驻命令(6 个入口:3 个 CLI + MCP stdio/HTTP + 安装器)
uv tool install agg-search源码方式:
git clone https://github.com/TsukimioRinka/agg-search
cd agg-search
uv pip install -e .
# 或者完全不安装:
PYTHONPATH=src python3 -m agg_search.search "query"下载入口(Agent × 领域)
入口 | 说明 |
14 家 Agent × 5 个领域画像的完整入口表 | |
同一份数据的机器可读版本(给脚本/目录站用) | |
70 个 | |
机器可读门户注册表(与 | |
Cursor / VS Code | 表里是一键深链,直接带上 |
Claude Code / Codex | 一条 |
其他客户端 |
|
实测记录 | docs/agent-tests.md:6 个 CLI 客户端的门户隔离实测 |
非 general 画像注册为独立的 server 名(agg-search-academic、agg-search-code、agg-search-news),可以和默认的 agg-search 并存。
agg-search-install --portals --markdown # 重新生成 docs/portals.md
agg-search-install --portals # 打印 portals.json
agg-search-install --catalog --markdown # 重新生成 docs/catalog.md
agg-search-install --catalog # 打印 catalog.json使用
# 搜索
agg-search "rust async runtime comparison" --top-n 10 --recency month
# 域名过滤:只留 arxiv/.edu,去掉 reddit
agg-search "speculative decoding" --include-domains arxiv.org,.edu \
--exclude-domains reddit.com
# 机器可读输出(含引擎状态、延迟、冷却与过滤计数)
agg-search "MCP server examples" --json
# RAG-Fusion 查询扩展(需要本地 ollama)
agg-search "vector database tradeoffs" --expand 3
# 带引用的答案段(auto:先本地 ollama,失败可落 DeepSeek API,会产生计费;
# 想完全避免费用用 --answer local)
agg-search "what changed in Python 3.13" --answer local
# 快速模式:单池扇出,最早两个有结果的引擎就返回
agg-search "breaking news" --fast --budget-secs 20
# 诊断:打印生效配置(密钥只显示布尔值),或列出可用引擎
agg-search --show-config
agg-search --help
# 抓取正文:DeepSeek Fetch 优先,失败落容器阶梯
crawl-fetch --url https://example.com/post --tier auto --out md密钥只从环境变量读(也兼容 ~/.config/agent-env、~/.config/ai-keys.env 的 KEY= 行)。缺失的引擎会被跳过,不会让整次搜索失败。常用默认值可用 AGG_SEARCH_ENGINES、AGG_SEARCH_TOP_N、AGG_SEARCH_PER_ENGINE、AGG_SEARCH_SNIPPET_CHARS、AGG_SEARCH_FAST、AGG_SEARCH_NO_JINA、AGG_SEARCH_PROFILE、AGG_SEARCH_NO_LEARN 覆盖,命令行显式传参优先。完整变量表见 docs/environment.md。
MCP server
暴露工具按门户隔离(默认 search + fetch;academic 门户按 search -> fetch -> answer 暴露三件套):
工具 | 主要参数 | 说明 |
|
| 并行召回 + 内容去重 + 权威先验 RRF + 精排;返回文本内容 + |
|
| 分层抓取正文(SSRF 守卫由服务端环境变量控制);每 URL 一条结果 |
|
| 仅在 |
协议行为:
协议版本:
2026-07-28的请求无需握手,版本和客户端能力写在每个请求的_meta里,不支持的版本返回-32022并列出支持的版本;旧客户端用initialize协商2025-11-25/2025-06-18/2025-03-26/2024-11-05,不认识的版本回2025-11-25。服务端无法执行的工具参数(缺
query/urls、该是字符串却传了对象、数字不合法、recency等取值不在范围内)按 2025-11-25 起的规定返回isError: true的工具结果,模型能读到原因并改正;1.0 能用的写法都照旧(null视为未传,越界数字由 CLI 夹取,列表参数可写逗号字符串,未知参数忽略)。未知工具、门户未启用的工具仍是-32602。工具带
title、annotations(readOnlyHint、openWorldHint)和outputSchema;支持结构化输出的客户端直接拿structuredContent,老客户端仍拿文本。每个工具调用有硬墙钟(search 120s / fetch 300s),超时杀进程组;
notifications/cancelled同样会中断。工具调用在线程池里跑,
ping/tools/list不会被慢引擎卡住。prompts/list/prompts/get:每个门户一个研究流程提示,名字是<领域>-research(general-research、academic-research、code-research、news-research;不绑门户时为web-research),参数topic(≤500 字,剥离控制字符)。提示只列出该门户启用的工具,跨门户取不到;支持 MCP prompts 的客户端会把它显示成斜杠命令。search在 MCP 下默认fast=true(有限的召回预算),fast=false才等全部引擎。
一行接入
agg-search-install --list # 支持 14 家客户端
agg-search-install -c claude-code # 打印 claude mcp add 命令
agg-search-install -c cursor --write # 合并进 ~/.cursor/mcp.json(自动备份)
agg-search-install -c vscode --scope project # 写 .vscode/mcp.json
agg-search-install -c cursor --check # 校验文件、条目与运行时是否就绪逐客户端的路径、JSON/TOML/YAML 片段与 GUI 环境变量陷阱见 docs/adapters.md。
HTTP 传输
agg-search-http --host 127.0.0.1 --port 8765 --path /mcp多个客户端共用一个进程(共享缓存与冷却),默认只绑回环并校验 Host/Origin(防 DNS rebinding 与浏览器跨站请求),端点不带认证——对外必须先套反向代理。协议细节与 nginx 示例见 docs/http.md。
领域定向与每 agent 策略
agg-search "speculative decoding" --profile academic # openalex 优先,摘要 500 字,top 15
agg-search "sqlite wal corrupt" --profile code # stack 优先,摘要 600 字
agg-search "release notes" --profile news --top-n 5 # 默认 recency=day
agg-search "vLLM 推理优化" --profile platform # GitHub/YouTube/B站 平台源 + web 保底
agg-search --list-profiles
agg-search-install -c cursor --profile code --write # 把某个客户端钉在 code 画像上同一套数据也通过 MCP 暴露:工具参数 profile,或环境变量 AGG_SEARCH_PROFILE。优先级 flag > env > profile > 内置默认;openalex / hn / stack / arxiv 免 key,装好就能用;另有 brave_news / serper_news 新闻垂直端点(复用原 key,opt-in)。
反馈回路
search 记录每个结果由哪些引擎召回,fetch 成功读到其中某个 URL 时记一次「被使用」。
agg-search-tune 把 surfaced/used 折算成 0.5–2.0 的引擎权重乘数(样本少于 30 时保持 1.0),
之后所有搜索自动叠加,并进入缓存键——调权重不会命中旧结果。默认开启,--no-learn 或 AGG_SEARCH_NO_LEARN=1 关闭。
agg-search-tune --show # 反馈表 + 当前乘数
agg-search-tune # 写入 ~/.config/agg-search/weights.json只存哈希与计数,不存查询词、页面正文或原始 URL。机制与公式见 docs/profiles.md。
同类项目对比
只列能核实的能力,语言一列仅在仓库自述里明确时填写:
项目 | 栈 | 它强在哪 | 与本项目的差别 |
Rust | 13 个 provider,单一二进制 | 本项目免编译;多容器抓取阶梯与 DeepSeek Fetch 是一等路径 | |
TypeScript | 注入防御( | 它的内容抽取与提示注入防护比本项目完整;本项目的差异在 8 引擎并行 + RRF→Jina listwise、DeepSeek Search/Fetch、RAG-Fusion 与容器阶梯。SSRF 防护两边都有,本项目覆盖到抓取前置校验(见 | |
— | 300+ 来源、18 语言、MCP/CLI | 本项目只做通用网页检索,覆盖面窄;差异在排序链路与成本控制更细 | |
TypeScript | 托管远端端点、search/extract/map/crawl 四件套、 | 本项目可自带引擎、离线缓存与精排链,不绑定单一供应商 | |
TypeScript | 官方索引,HTTP 传输带 Origin/Host 白名单 | 本项目多引擎融合;传输层安全策略参考了它的做法 | |
TypeScript | 托管端点 + OAuth、dynamic highlights | 本项目无托管依赖,密钥和缓存都在本机 |
测试
uv venv && uv pip install -e .
python3 -m unittest discover -s tests -v220+ 个离线测试:门户隔离与降级、内容去重、权威先验、域名过滤、RRF、冷却分类、缓存键、SSRF 判定、安装器、MCP 协议面与 stdio/HTTP 端到端(不发起网络请求、不消耗额度)。CI 覆盖 Python 3.10–3.13 + ruff。
安全与隐私
仓库内不含任何密钥、账号、内网地址;
.env.example只有空占位。密钥只在进程环境里读取,不写日志、不落盘;
--show-config只输出布尔值。抓取前置 SSRF 校验:仅 http(s)、无 userinfo、私网/回环/链路本地/云元数据地址默认拒绝(
--allow-private显式放开);响应体上限 4 MiB。抓取在容器内执行,宿主机不留浏览器与爬虫依赖。
进入模型上下文的页面文本会剥离零宽与双向控制字符(隐藏指令的常见载体),MCP 指令块也声明页面内容为不可信数据。
HTTP 传输默认回环绑定 +
Host/Origin白名单,无认证时不得裸奔到公网。
稳定性
从 1.0 起按 SemVer 发版。命令名、CLI 参数、--json 字段、crawl-fetch 的输出与退出码、MCP 工具/提示与协议版本、画像/门户/引擎名、环境变量和安全行为都在承诺范围内;结果排序等质量参数会按评测数据在次版本中调整。详见 docs/stability.md。
文档
文档 | 内容 |
安装方式、环境变量全表、冒烟测试 | |
14 家客户端的接入配置 | |
HTTP 传输、安全模型、反向代理 | |
领域画像、每 agent 策略、反馈回路与调参 | |
70 个 | |
1.0 起的稳定性承诺:哪些接口受 SemVer 保护、弃用流程 | |
各项增强与领域调整的对照评测(候选 A–M)、合入与拒绝的依据 | |
6 个 CLI 客户端的门户隔离实测与清理记录 | |
交接:本机路径、凭据位置、逐层验证与发版流程 | |
分层抓取的梯子与容器 | |
RRF 与 Jina 精排、参数扫描、领域 A/B 工具( | |
环境变量与计费说明 |
License
MIT
Available Tools
2 toolsfetchFetch pages as clean textARead-onlyIdempotent
Read one or more URLs as clean text. Tries the DeepSeek Fetch API first (no container), then a static -> dynamic -> stealth container ladder for JS-heavy or anti-bot pages. Returns one result object per URL with the rung used and the page text.
Inputs: urls (required), out, tier, text_limit. Returns: results
searchMulti-engine web searchARead-only
Search the web in parallel across several engines (exa, brave, serper, deepseek, firecrawl, anysearch, tavily, searxng), fuse the rankings with reciprocal-rank fusion, rerank the head with Jina and return the top results with engine provenance. Prefer this over a single-engine search when recall matters; use fetch to read a promising result in full.
Inputs: query (required), fast, top_n, answer, +13 more. Returns: query, answer, expand, rerank, +4 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have entirely distinct roles: `search` discovers results across engines, while `fetch` reads a specific URL as text. Descriptions even cross-reference each other, explicitly steering an agent to use search for recall and fetch for reading a promising hit.
Both names are single, lowercase verbs following the same minimal convention (search, fetch), with no mixing of styles or casing. A predictable pattern is trivially evident with only two tools.
Two tools is on the thin side, though it matches a focused retrieval server's scope. The functionality is heavily parameterized internally (engine selection, fetch ladder), so the small surface is defensible but borderline.
Search plus fetch covers the core discover-then-read workflow with no dead ends for a read-only retrieval domain. Minor gaps like result caching, pagination, or structured/extraction options are absent but not blocking.
Maintenance
Related MCP Connectors
LLM-ready web search + instant answers + URL-to-clean-text fetch for agents and RAG.
Web knowledge fetching tools for your agent.
Web search for AI agents — one tool across 6 engines, routed to the cheapest + cached.
Web search, page fetch and cited research for AI agents: 26 engines, 8 tools, one key, from $15/mo.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables web content retrieval and semantic search capabilities through the Jina AI API. Provides tools to fetch content from URLs and perform intelligent web searches with natural language queries.3MIT
- FlicenseNot gradedqualityDmaintenanceEnables web search and webpage scraping using Jina AI services.-
- AlicenseNot gradedqualityDmaintenanceProvides multi-provider web search capabilities with fallback chains, semantic reranking, and content extraction for grounded agent retrieval.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to run local multi-engine web searches, fetch pages through anti-bot fallback chains, and query site-specific sources such as GitHub, npm, PyPI, Docker Hub, and Twitter/X for structured results.3MIT