websearch
Searches the web through Brave as a primary keyless search engine, returning title/URL/snippet result blocks.
Searches the web through DuckDuckGo as a primary keyless search engine, returning title/URL/snippet result blocks.
Fetches GitHub repository READMEs as Markdown by rewriting github.com/o/r URLs to the GitHub README API, avoiding the repository UI chrome.
Provides fallback web search through Google when the primary keyless search tier returns no results.
Searches the web through Mojeek as a primary keyless search engine, returning title/URL/snippet result blocks.
Searches the web through Startpage as a primary keyless search engine, returning title/URL/snippet result blocks.
Searches Wikipedia as one of the primary keyless search tiers, returning result titles, URLs, and snippets.
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.
mcp-websearch
web_search as an external MCP tool for Qwen Code, ported from Unsloth Studio's server-side tool
loop. Same engine tiers, same SSRF and domain-policy gates, same result format. No API key needed.
If ~/.qwen/websearch-keys.json holds a SerpApi key, a sweep that fails on all free tiers falls back
to it; an honest empty sweep never does.
Qwen Code ─MCP/stdio→ server.py → ddgs → tier 1: wikipedia brave duckduckgo mojeek startpage
└────→ tier 2: grokipedia google yahoo (only if tier 1 is empty)
└────→ tier 3: serpapi.com (only if both tiers fail, key set)Engines outside those tiers — Yandex, Bing, the mullvad mirrors — are never contacted. Tier 3 is this fork's own paid fallback, not upstream, and is inert without a key.
A tier is a fan-out, not a choice: every engine in the tier is asked at once, so one query reaches
all five tier-1 hosts, and up to eight plus the Wikipedia API when the free tiers come back empty.
UNSLOTH_SEARCH_ENGINES trades that coverage for fewer parties learning the query — see
Narrowing the sweep.
Web archives (wayback tool, fork-owned)
A second tool reads archived copies of pages that are gone, changed, or unreachable. It is not
upstream and never runs on its own: when web_search url mode fails on an HTTP error, a dead host
or a timeout, the result only suggests a wayback call, which the client confirms like any other.
wayback {url} → Wayback Machine latest capture, else Arquivo.pt
wayback {url, timestamp: "2015"} → capture closest to that date (YYYY / YYYYMMDD / YYYYMMDDhhmmss)
wayback {url, list_snapshots: true} → readable captures from both archives, newest first
wayback {url, archive: "arquivo"} → one archive onlyHosts:
archive.organdarquivo.pt, nothing else. Every request carries a policy admitting only the archive that serves it, so a redirect cannot leave it.Guards: every byte goes through upstream's unchanged fetcher — SSRF refusal, DNS pinning, redirect re-checks, body cap, html→md.
Policy:
allowed_domains/blocked_domainsjudge the original URL, not the archive. Literal private/loopback addresses are refused even though the bytes would come from the archive.Known limit: a Wayback capture that was itself a redirect replays as a hop to another capture inside archive.org; that target's original domain is not re-judged by your policy.
Related MCP server: websearch-skill
Install
cd mcp-websearch
python3 -m venv .venv
.venv/bin/python -m pip install --require-hashes --no-deps -r requirements.lock
.venv/bin/python scripts/align.py --sync # clone, safety gate, generate, test, egress gates, anchor-m pip and -m pytest, never .venv/bin/pip: a venv is not relocatable, so its script
shebangs break the moment the directory moves.
Supply chain
requirements.lock is the boundary. 45 exact pins, 778 sha256 digests, installed with
--require-hashes --no-deps — so a compromised PyPI release cannot be adopted silently, and a new
or changed dependency only enters by a diff you commit.
pyproject.tomlpinsmcp==2.2.0, not a range. An open bound means every install silently takes the newest SDK.tests/test_supply_chain.pyfails if any pin is unhashed, if any installed dist is not named by the lock, or if a*exporter*telemetry package appears anywhere in the set.opentelemetry-apiis unavoidable (mcprequiresopentelemetry-api>=1.28.0). API only, no exporter installed, so nothing exports — recorded here so its presence is a decision, not a discovery. An exporter appearing is a hard finding.
Egress gate
scripts/check_egress_mcp.py is the MCP-side mirror of the fork's §18. A CONNECT-only proxy on
loopback records which hosts the tiers actually reach — the tunnel is never decrypted, so no CA is
installed and nothing is a man in the middle. Test-time only: normal operation has no proxy.
.venv/bin/python scripts/check_egress_mcp.pyExit 0 = every destination inside the tiers · 1 = a host outside them · 2 = the detector is
blind (self-test canary missed, or primp bypassed the proxy). The allowlist is derived from
_SEARCH_ENGINE_TIERS through ENGINE_HOSTS, so adding an engine without mapping its host fails
the build rather than widening egress silently.
.venv/bin/python scripts/check_egress_mcp.py --wayback # archive hosts only: archive.org, arquivo.ptThe archive run sets UNSLOTH_STUDIO_DISABLE_DNS_PINNING=1 in its own process: a pinned CONNECT
names an IP, and the gate judges hostnames. Search mode must never reach an archive host.
Run it: every release · every requirements.lock bump · after realignment · after any change to
fetch.py or the tier list. It issues one live query.
Verified on primp 2.0.1 / ddgs 9.14.4: the tiers do honour HTTPS_PROXY — all eight
engine hosts arrive as CONNECT records and the search still succeeds. The proxy is a real control
point here, not a dead one.
Narrowing the sweep
The tier list maximises the chance that some engine answers, which means it deliberately does not
minimise how many companies learn the query. For callers who want the opposite trade,
UNSLOTH_SEARCH_ENGINES is an opt-in allowlist in the server's env:
"env": {
"UNSLOTH_SEARCH_ENGINES": "brave,mojeek"
}It belongs in the installed server's entry (~/.qwen/settings.json, mcpServers.websearch.env),
and install.sh now reads whatever that entry already carries and replays it as -e args, so a
reinstall no longer drops the narrowing back to the full fan-out.
Three properties, each pinned by tests/test_engine_narrowing.py:
It can only remove. The accepted vocabulary is
_SEARCH_ENGINE_TIERSitself, so no value of the variable reaches a host the tier contract does not already approve. Order still comes from the tier list, never from the variable — it filters the sweep, it does not prioritise within it.A name nothing approves is refused, not dropped.
UNSLOTH_SEARCH_ENGINES=yandexfails the search before any engine is contacted and names the bad entry. Dropping it silently would answer a request to narrow with the full sweep, which is the wrong direction to be wrong in.The fallbacks are covered too. The free Wikipedia API call is gated on
wikipediaand the paid tier onserpapi, so a narrowing that excluded them cannot be undone by an empty sweep. Tier 3 is now opt-in twice over: a key and a narrowing that allows it. Unset, every behaviour above is exactly what it was.
What you give up is coverage and resilience — two engines instead of five means a rate limit on both
ends the search, and site: scoping works better on some engines than others. Keeping the sweep
small and hiding the IP are separate controls: DDGS_PROXY (ddgs reads it directly, socks5://
supported) moves the engine fan-out through a proxy, and the tiers were verified to honour
HTTPS_PROXY under the egress gate above.
Add to Qwen Code
qwen mcp add websearch "$(pwd)/.venv/bin/python" "$(pwd)/server.py" \
-t stdio -s user --description "Keyless web search, ported from Unsloth Studio"-s user → ~/.qwen/settings.json; -s project → .qwen/settings.json. A new session lists
websearch under /mcp with two tools, web_search and wayback. A session that is already running
keeps the server process it started, so it stays on the previous build until that process restarts;
scripts/installed_version.py prints which build is live and flags a stale process. The model sees it as
mcp__websearch__web_search — the mcp__<server>__ prefix is forced by the client and cannot be
overridden. Hand-edits preferred:
qwen-mcp-snippet.json.
Do not pass --trust. url mode fetches a page whose host the model chose; the client's
per-call confirmation is the gate that makes that safe, mirroring upstream's _web_search_fetches_url
prompt. Trusting the server removes it.
Use
call | what happens |
| tiered search → |
| one page → Markdown ( |
| rewritten to the GitHub README API — you get the README, not the repo's UI chrome |
| pushed in as |
| refused at policy time |
Env
var | default | |
|
| fetched-page cap |
|
| results per search |
| unset | narrows the tier sweep; approved names only, see Narrowing the sweep |
|
|
|
| unset |
|
| auto-detected | path to an unsloth clone, for |
How the port is built
58 of the 63 ported symbols are machine-generated from upstream's AST, so they cannot drift by transcription:
tools.py ──build_port.py──▶ upstream_verbatim.py (GENERATED) ──import──▶ fetch.py · search.py
└── 5 hand-adapted functionssurface | ||
|
| AST-extracted from |
|
| byte-exact |
|
| the only places local judgement was applied |
Faithful: engine tier allowlist + registry resolution, non-public-IP refusal, DNS pinning with correct SNI, one wall-clock budget across tiers and redirect hops, capped chunked body read, binary rejection by MIME then magic, HTML→Markdown, GitHub README routing, every model-facing string.
Not here (by choice): image search + thumbnail registry, PDF text extraction, <meta refresh>,
WHATWG charset prescan, context-window page sizing. Reasoning per item: ALIGNMENT-REFERENCE.md.
Stay aligned
scripts/align.py --diffReads only the pinned symbols, never all of tools.py. Reports SYNCED / REVIEW / DRIFTED / BROKEN
and prints the upstream body to apply. Full contract: ALIGNMENT-REFERENCE.md.
Layout
server.py MCP stdio entrypoint (mcp SDK v1 FastMCP and v2 MCPServer both work)
unsloth_search/
upstream_verbatim.py GENERATED — 58 symbols extracted from tools.py, do not edit
web_access_policy.py vendored byte-exact
_html_to_md.py vendored byte-exact, stdlib-only
fetch.py adapted fetch layer
search.py adapted tier loop + approved_engines()
__init__.py package edge
.align/manifest.json the sync contract (committed)
scripts/build_port.py generates upstream_verbatim.py
scripts/align.py the drift checker
tests/ tiers (mirrored upstream) + guards + fidelityAGPL-3.0-only, matching upstream (COPYING / studio/LICENSE.AGPL-3.0 in unslothai/unsloth).
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
Free web search for AI agents. No API key required. Hosted MCP in active development.
Live AI-native web search with citations. One tool for every MCP client. Flat per-request pricing.
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
Search the agentic web. 4,100+ sites, 11 tools incl. check_url + verify_mcp for probe-before-use.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables web search, scraping, extraction, and crawling through an MCP interface, allowing coding agents to access real-time web data.1MIT- AlicenseAqualityDmaintenanceEnables AI agents to perform multi-engine web search, fetch web pages, and extract clean Markdown content via MCP, with no API keys required.3252 PyPI11MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to search the live web and extract readable page content as MCP tools, with ranked results, domain filters, and news support.47 npmMIT
- FlicenseNot gradedqualityFmaintenanceEnables agents to perform web searches and fetch page content through Kimi Code's search/fetch capabilities via standard MCP tools.1-