swarm-search
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
swarm-search
Parallel "swarm" research for Claude, ChatGPT and Gemini clients, with zero dependencies.
One question goes in. A planner splits it into sub-questions, N cheap workers run in parallel
(web search, or a scan of local files), and one synthesizer merges everything into an answer with
[n] references and a Sources list. Workers default to Claude Haiku through your Claude Code
subscription; GPT (Codex CLI / OpenAI API) and Gemini (Antigravity CLI / Gemini CLI / Gemini API)
are one flag away, and provider: "mixed" spreads the workers across model families so the
synthesis shows where they disagree.
Ships as:
a Claude Code plugin (
/swarm-search, skill, MCP server),an MCP server over stdio for Claude Desktop, Codex CLI / ChatGPT desktop Codex, Antigravity, Gemini CLI,
an MCP server over Streamable HTTP for ChatGPT connectors and any remote client,
a CLI (
swarm-search run "...").
How it works
question ──► planner (1 call) ──► N sub-questions (N chosen by the planner, 1–8)
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
worker 1 (web) worker 2 (web) ... worker N (web) ← Haiku / GPT / Gemini
└────────────────────┼────────────────────┘
▼
optional round 2: gap-filling follow-ups or cross-critique
▼
synthesizer (1 call) ──► answer + [n] sourcesWho decides how many workers? By default the planner: it reads the question and returns one
sub-question per genuinely independent angle, so a narrow fact costs one worker and a five-way
comparison gets five. Pass workers: N to force a number.
Do workers talk to each other? Not in round 1: independence is what makes the synthesis catch
errors. With rounds: 2 they do, after the fact:
round2: "gaps"(default) — an auditor reads all round-1 reports, lists contradictions and unanswered parts, and a few targeted follow-up workers resolve just those. Cheap: 1 + up to 4 calls.round2: "critique"— every worker sees the anonymized reports of the others and replies with Confirmed / Disputed / Retracted / Missing, with sources. N extra calls. Strongest withprovider: "mixed", where Claude, GPT and Gemini check each other.
In files mode (paths given) the corpus is sharded instead: every worker reads a slice of files
with line numbers and reports path:line findings; the synthesizer merges them. Round 2 in files
mode re-reads the shards that had findings with the follow-up questions.
Files mode never sends secrets to workers: .env* (templates .env.example/.sample/.template
are kept), *.pem, *.key, *.p12, *.pfx, *.keystore, *.jks, *.tfstate, id_* SSH keys,
credentials/credentials.json, .npmrc, .netrc, .git-credentials, .pgpass, .pypirc,
secrets.{json,yaml,yml,toml,env,ini}, kubeconfig, .kube/config, .docker/config.json and
*service-account*.json are dropped both while walking a directory and when named explicitly. Workers run without web access in files mode: Claude CLI gets
no web tools, Codex gets web_search="disabled", Gemini CLI gets a policy that denies
google_web_search/web_fetch, and agy-cli (whose web search cannot be turned off) is skipped
for files shards and synthesis.
Files priority: Claude CLI → Codex CLI → Gemini CLI → APIs (Anthropic, OpenAI, Google, OpenRouter). AgentRouter gets the reserved first priority in #6.
Worker and critique prompts carry a data boundary: text from web pages, files and other reports is
data, embedded instructions are not followed but listed under ## Uncertain / ## Not found.
Before worker reports and file slices go into the gap-audit, critique and synthesis prompts, the code
neutralizes role spoofing in them: lines that pose as a chat turn (System:, User:, Assistant:,
Human:, Developer: at line start, also after markdown or 12| line numbers) become
[quoted User]:, and chat-template markup (<|im_start|>, <|system|>, <|User|>, [INST],
<<SYS>>, <system>, <s> …) gets its brackets swapped for ‹ ›. Each report or slice is then
wrapped in <<<DATA <tag> …>>> / <<<END DATA <tag>>>> lines with a random tag per run, and any
wrapper-like line inside the content is broken, so the content cannot close the block and talk as
the orchestrator. Wording and line numbers stay intact, so path:line citations still hold.
The MCP tool output starts with a note that the content was compiled from untrusted sources.
Answer quality checks done in code, not only in prompts:
Fact provenance and data gaps. Each worker in
report.workers/report.round2addsfacts: [{text, line, source_url, fetched_at, status, reason?}]. Web fact status isokonly after HTTP 200 and a matching quote,unavailableafter a failed fetch or an explicit worker admission, andpartialwhen evidence is incomplete (including no quote).fetched_atis a code-produced ISO UTC time for the completed fetch/check attempt, ornullwhen none was made; it is not the publication date. Worker-levelfetched_atrecords report collection, andsource_urlis the single cited source ornullfor multiple/unknown sources. Local findings usepath:lineas their source reference and the time the report was processed; external URLs in files mode remainpartialwithout network access. The existingtext,sources: [{url, title}]and numeric HTTPsourceVerification[].statusare retained. Unavailable findings are withheld from audit, critique and synthesis; unattributed claims in a report with unavailable sources are also withheld.report.unavailableSourceslists the missing sources with worker ids, timestamps and reasons. Synthesis receives that list and is told not to guess; a code-generated “Data gaps” notice keeps incomplete coverage visible even if the model omits it. Raw diagnostic worker text remains available and must be interpreted together with its fact statuses.Source check. After synthesis every URL and
path:linein the Sources list and in the answer text must appear in a round-1 or round-2 worker report as a whole token: URLs match exactly (only a trailing/is ignored),path:linematches the same path with the line inside a line or range the worker cited (src/a.mjs:12is found insrc/a.mjs:10-14, not insrc/a.mjs:120). Refs that don't match are marked "source not found in worker reports"; a Sources entry with no URL orpath:lineis marked "no URL or path:line, cannot verify" and counts as unverified. Every[n]in the text must be in the list and vice versa, mismatches are listed in a "Source check" line. The footer showssources traced to worker reports k/n, details are inreport.sourceCheck(bodyUnverifiedlists unverified refs from the text). For web sources, URL presence alone is insufficient: at each worker stage Node fetches sources with a same-lineQuote: "exact passage". Only HTTP 200 and that quote found in the fetched page grantVERIFIED=yes. Otherwise the label isVERIFIED=unverified (no_fetch|http_<code>|quote_not_found|blocked_address|no_fetch_files_mode); missing quotes, network failures and timeouts areno_fetch. Loopback, private and link-local destinations areblocked_address: all DNS answers are checked before connecting, connections use only those checked addresses, and up to three redirects are checked separately. Model labels and claimed fetch metadata are ignored. Worker receipts are insourceVerification, final evidence inreport.sourceCheck.verification. This confirms the quoted passage, not its interpretation. Files mode keeps its existingpath:linechecks and performs no web fetches or source DNS lookups; URLs in files reports remainVERIFIED=unverified (no_fetch_files_mode).Grounded retractions. In
critiquea worker may move a claim to## Retractedonly with the refuting source (URL orpath:line) taken from another worker's report. Retractions without one are removed before synthesis, so a correct fact is not dropped just because the majority said otherwise; the footer counts them (report.retractions). A bullet continued on indented lines is kept or dropped as a whole,- none/- None of my claims.are not counted.Failover. A worker that fails with HTTP 402/429/5xx, a timeout, a rate-limit/quota error or an empty answer is retried once on the next pool slot with a different provider (e.g.
provider: "openrouter,claude-cli"ormixed); 429 waitsSWARM_RETRY_BACKOFF_MSfirst. The footer showsretried k, each retried worker hasretriedFromin the report.File ranking (files mode). When the corpus is larger than
SWARM_RANK_CHARS(480k chars ≈ 8 shards), files are ranked by BM25 against the question (path tokens weigh more, files named in the question come first) and only the top files that fit the budget are sharded. The footer saysranked files: kept/total kept, N dropped, and the synthesizer is told coverage is partial.rank: "on"always orders files by relevance,"off"disables ranking.
Related MCP server: MCP-Deep-Researcher
Page URLs and SERP
Web workers preserve page URLs (paths, query strings and fragments) in their text and
report.workers[].sources: [{url, title}]. The worker and web report have status: "partial"
when page sources are missing or only a bare domain is available; sourceIssues explains why.
Web research conservatively requires page URLs, so a homepage alone also receives this status.
This status describes source completeness; quote verification remains a separate check.
swarm-search run "как начать вайбкодинг с нуля" --serp --top-n 3 --region RU --json
# --mode serp is equivalent to --serpMCP: swarm_search({query: "как начать вайбкодинг с нуля", mode: "serp", top_n: 3, region: "RU"}).
The CLI keeps {markdown, report}; MCP keeps text content and adds structuredContent with
the report. SERP data is in report.serp: {query, topN, region, provider, status, reason, results},
where each result is {position, url, title, fetched_at}. fetched_at is the adapter's retrieval
timestamp, not a publication date. top_n / --top-n defaults to 10 (1–100); omitted region
means provider default, reported as null if unknown. A requested region must be confirmed
by the provider. Incomplete native positions are partial and keep their actual numbers.
Current LLM adapters do not expose native organic SERP positions. They return
status: "unavailable", an explanatory reason and results: [], without an LLM call.
Citation numbering and model-written rankings never become search positions. A future native
adapter must implement searchSerp({query, topN, region, signal, timeoutMs}) and return
{region, results} with explicit positions, full page URLs, titles and retrieval timestamps.
SERP skips planning/synthesis and cannot be combined with file paths.
Requirements
Node.js
^22.23.4 || ^24.22.1 || >=26.12.1(releases with the Brotli security patch; any other version, including Node 20 and the end-of-life lines 23 and 25, gets anengineswarning on install, and an install withengine-strictfails)at least one worker backend:
provider id | what it uses | needs | default model |
|
| Claude subscription, |
|
|
| ChatGPT subscription, |
|
|
| Antigravity login, |
|
|
| Google login / |
|
| Messages API |
|
|
| Responses API |
|
|
| Gemini API |
|
|
| chat/completions |
|
|
swarm-search providers shows which ones are usable on your machine. auto picks the first
available in the order above; every default model can be overridden with SWARM_<PROVIDER>_MODEL.
In mixed mode OpenRouter brings a separate model family, deepseek/deepseek-v4.1-flash
(SWARM_OPENROUTER_MIXED_MODEL), instead of a second Haiku. A cheap DeepSeek worker by hand:
--provider openrouter:deepseek/deepseek-v4.1-flash.
claude-cli workers run without MCP servers, skills, plugins and your CLAUDE.md
(--strict-mcp-config --disable-slash-commands --setting-sources ''), so one web worker uses about
6k tokens of context instead of hundreds of thousands. SWARM_CLAUDE_LEAN=0 restores the full harness.
The answer footer shows tokens for all calls, cost (where the provider reports it) and the cost per useful worker answer.
Install
Claude Code (plugin)
claude plugin marketplace add jumpleGo/swarm-search
claude plugin install swarm-search@jumplegoThen in any session:
/swarm-search what changed in Node.js 24 LTS vs 22, should we migrate now?
/swarm-search where are request timeouts handled --files src,server --workers 6or just ask for a swarm search — the bundled skill tells Claude when to reach for the
swarm_search tool.
Claude Desktop, Codex, Antigravity, Gemini CLI (stdio MCP)
git clone https://github.com/jumpleGo/swarm-search ~/swarm-search
cd ~/swarm-search
node bin/swarm-search.mjs install claude-desktop --write # or: codex | agy | gemini-cli | claude-codeWithout --write the command only prints the config snippet. It registers the server as:
{ "mcpServers": { "swarm-search": { "command": "node", "args": ["/abs/path/bin/swarm-search.mjs", "mcp"] } } }Codex gets a [mcp_servers.swarm-search] block in ~/.codex/config.toml (also read by the
ChatGPT desktop app's Codex mode). Antigravity is registered with agy mcp add.
ChatGPT (remote MCP connector)
ChatGPT only connects to remote HTTPS MCP servers, so run the HTTP transport and expose it:
SWARM_HTTP_TOKEN=$(openssl rand -hex 16) node bin/swarm-search.mjs mcp --http --port 8787
# in another shell
ngrok http 8787 # or: cloudflared tunnel --url http://localhost:8787In ChatGPT enable Developer mode in settings and create a connector with URL
https://<your-tunnel>/mcp and Bearer auth using that token. The server is stateless
(JSON responses on POST /mcp, GET /health). The Gemini consumer app has no custom MCP
support; use Antigravity or Gemini CLI for Gemini.
Files mode is disabled for HTTP clients by default (a tunnel arrives on loopback, so every
HTTP request counts as remote). To allow it, list the directories remote clients may read with
SWARM_FILES_ROOTS=/srv/docs,/srv/repo or --files-roots /srv/docs,/srv/repo: each path is
resolved with realpath and must lie inside one of the roots, so symlinks and .. cannot escape;
hidden files and directories inside a root (.git, .ssh, .npmrc, …) are refused even when
named explicitly. Stdio clients are not restricted.
HTTP clients also never get workers that can read the server's disk on their own: codex-cli
(its -s read-only sandbox still lets shell commands read any file), agy-cli (file tools are
auto-approved in plan mode) and gemini-cli (reads the server's working directory) are skipped
for remote calls in every mode, workers and synthesis alike. Use claude-cli (web tools only) or
an API provider; a pool with only those three CLIs fails with an error.
Usage
MCP tool swarm_search
argument | meaning |
| the question (required) |
|
|
| files/dirs to scan → files mode |
| fixed worker count (max 12); omit for auto sizing by the planner |
|
|
|
|
|
|
| worker model override |
| use a stronger model for the final synthesis only |
| your own sub-questions, skips the planner |
| force answer language |
| files mode: |
swarm_providers lists usable backends.
CLI
swarm-search run "state of WebGPU in 2026: browser support, frameworks, gotchas" --workers 6
swarm-search run "where do we validate JWT?" --paths src,server --provider codex-cli
swarm-search run "is Bun ready for production?" --provider mixed --rounds 2 --round2 critique --synth-provider claude-cli:sonnet
swarm-search run "..." --json # full report with per-worker output
swarm-search doctor # free installation/config/network diagnosticsdoctor prints one line per check: ok, warn, not configured or fail, with a
fix: command for anything needing attention. It checks Node against package.json
engines, Claude Code plugin registration and files, the bundled MCP config and entry
point, provider configuration/reachability, and cache/temp directory permissions.
Only fail sets exit code 1; missing optional plugins, CLIs or API keys exit 0.
API probes open TCP/TLS connections in parallel (1.5-second timeout each), without
sending HTTP requests or keys. CLI checks inspect executable files without launching
them. Login, key validity, quota and MCP client activation are not verified. Network
probes use direct connections; a failed probe suggests restoring DNS/network access
and a curl -I command to investigate. No configuration or cache files are written.
--mcp-config /path/to/config.json checks another stdio JSON config (mcpServers
or the plugin's direct format). --cache-dir /path/to/dir checks another existing
directory. By default the cache check uses the workers' actual temp directory
(os.tmpdir(), including TMPDIR); there is no separate persistent swarm cache.
These flags only affect diagnostics. For example, to use a writable worker directory:
mkdir -p .swarm-cache && export TMPDIR="$PWD/.swarm-cache".
Environment
variable | default | purpose |
|
| default provider spec |
| unset = auto | fixed default worker count |
|
| upper bound for auto sizing |
|
| default rounds and round-2 mode |
|
| per-call timeout |
|
| max characters per files-mode shard |
|
| files-mode ranking: |
|
| corpus size that turns ranking on and the budget of kept files |
|
| pause before retrying a worker that got HTTP 429 |
| – | bearer token for |
| – | comma-separated browser origins allowed besides localhost ( |
| – | comma-separated directories remote |
| see table | per-provider default model |
Cost and time
A 4-worker web run is 6 model calls (1 plan + 4 workers + 1 synthesis) and takes 1–3 minutes with
CLI backends. Round 2 adds 1 audit + up to 4 follow-ups (gaps) or N critiques (critique). CLI providers run on your subscriptions; API providers bill per token. Workers are
read-only: claude -p gets only WebSearch/WebFetch, codex exec runs with -s read-only,
agy/gemini run in plan mode. Read-only still means codex, agy and gemini can read local files,
so for local runs a prompt injection in a page or file could make them quote one; remote HTTP
clients never get these providers (see above).
Development
npm test # unit tests (no network)
node bin/swarm-search.mjs providers
node bin/swarm-search.mjs run "..." --workers 2Offline fact evaluation
The pipeline returns { markdown, report } in src/swarm.mjs; report.workers and
report.round2 contain worker text and extracted facts. The CLI's run --json saves this
envelope. MCP returns the answer in content and the report in structuredContent.
Tests live in test/*.test.mjs and run with npm test.
eval/questions.json contains 20 stable questions, required fact strings, aliases and official
source URLs. Score existing output without calling any provider:
node eval/score.js saved.json --judge-diff
node eval/score.js test/fixtures/eval-twenty.json --judge-diff # fixture: 31/31 facts, judge agreement 65%A single CLI/MCP answer is matched by report.query; use --question id to select it explicitly.
A batch is { "answers": [{ "id": "dns-transport", "markdown": "...", "report": {} }] };
missing questions score zero. Coverage uses literal facts/aliases, excluding source lists,
citations and diagnostics; worker rounds are scored separately. Unexpected URLs are listed.
Optional annotation.facts and judge.facts are boolean arrays in the question's fact order;
judge.score can instead be a number from 0 to 1. --judge-diff compares against manual labels
when present, otherwise literal matches. Only all 20 manually labelled answers with judge scores
produce a suitability verdict: below 70% agreement means unsuitable; incomplete data means
insufficient_data. To measure incorrect claims, enumerate every assertion in
annotation.claims as { "text": "...", "correct": true } (or false); the error rate uses
annotated claims only, with annotatedQuestions showing coverage. Without claims it is null.
Provider benchmark
Before switching the cheap default model, compare providers on a fixed set: bench/questions.json
holds 15 questions with checkable facts (12 web, 3 files queries over this repo).
npm run bench -- claude-cli openrouter:deepseek/deepseek-v4.1-flash openrouter:minimax/minimax-m3.1-flash
npm run bench -- codex-cli --only rust-1.0,files-http-port --workers 1 --out bench/codex.jsonEach argument is one provider spec (workers and synthesis both run on it). The JSON result has per
provider: accuracy (share of facts found in the answer), successes (answers with all facts),
nonEmptyRate, costPerSuccessUsd (total cost / successful answers, null if any run was not
fully priced), avgSec, sourcesVerified/sourcesTotal and per-question runs. The benchmark calls
real models and costs money; npm test only runs it against fakes.
Layout: src/swarm.mjs pipeline · src/providers/* one file per backend · src/corpus.mjs
file sharding · src/mcp.mjs stdio + HTTP transports · src/install.mjs client configs ·
.claude-plugin/, commands/, skills/, .mcp.json Claude Code plugin surface.
Adding a provider: export { id, family, kind, label, defaultModel, detect(), complete({ system, prompt, model, web, timeoutMs, signal }) → { text, usage? } }
and add it to PROVIDERS in src/providers/index.mjs.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Fan out deep research across multiple AI providers, synthesize into one unified report.
Multi-LLM AI Research & Analysis — smart routing, consensus analysis, due diligence reports
Neural search synthesizer, deep research dossier compiler, and citation tools.
Web search, fetch, extract, and research for AI agents. Markdown output + AI-synthesized answers.
Related MCP Servers
- AlicenseDqualityNot gradedmaintenanceMulti-agent research server that runs multiple LLM providers in parallel with web search capabilities, synthesizing their responses into comprehensive answers for complex queries.24 npm8-
- AlicenseAqualityDmaintenanceA multi-agent research system that decomposes complex queries into targeted sub-questions, searches the web in parallel, scores source credibility, and synthesizes findings into structured markdown reports.11MIT
- AlicenseAqualityDmaintenanceEnables querying multiple AI models in parallel (Claude, Gemini, O3) and synthesizing their responses using anonymous analysis to reduce bias, providing a comprehensive answer.140 npm193MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform deep web research and generate comprehensive reports using a multi-agent divide and conquer approach.1-