Unified multi-provider web search and fetch: BYOK key pools, health monitoring, and deterministic fallback.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:A3Boy/dsh-web-tools
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
dsh-web-tools
Reliable multi-provider web search and page reading for DeepSeek Harness (DSH) and MCP clients
Automatic provider failover · Custom JSON search APIs · Focused page reading (web_read) · Local Xiaohongshu & X sessions · Standalone MCP server
[!WARNING] Xiaohongshu & Twitter / X Account Risk Notice Xiaohongshu search drives your signed-in local browser window to search, scroll, and paginate. Because the platform actively monitors automated behavior, frequent or bulk queries can get your account rate-limited or banned. Always use a secondary account, keep query frequency low, and use with caution. Twitter / X is similarly subject to per-account rate limits. You can disable either platform anytime in Settings.
What It Does
Connecting an AI agent to the web usually runs into four practical headaches:
- Single-provider fragility: One exhausted quota,
429rate limit, or network hiccup breaks the whole turn. - Hard-to-wire custom APIs: Connecting self-hosted SearXNG, Zhipu BigModel, Bocha, Elasticsearch, or an internal search gateway normally requires writing custom glue code.
- Long pages blow up context: Fetching a 100k-character documentation page via
web_fetchburns tokens and buries the actual answer in boilerplate. - Social media blind spots: Standard search APIs cannot read Xiaohongshu notes/comments or full X conversation threads.
dsh-web-tools solves these in one package:
- Three model tools:
web_search(multi-source search),web_fetch(clean full-page Markdown), andweb_read(relevant passages + page outline within a character budget). - 10 built-in providers + custom endpoints: Built-in support for Exa, Tavily, Serper (Google), Brave, Firecrawl, Keenable, You.com, Jina, Parallel, and SearXNG — plus a visual editor with one-click presets for Zhipu BigModel, Bocha, Elasticsearch, and custom REST JSON APIs.
- Automatic failover & multi-key rotation: Rotates across multiple API keys per provider, cools down failing backends, and falls back cleanly when a source times out or returns zero results.
- Works inside DSH or standalone via MCP: Ships both as a native DSH Web plugin and as a standard stdio MCP server (
dsh-web-tools-mcp) for Cursor, Claude Code, Claude Desktop, and Windsurf.
Quick Start
Option 1: Use inside DeepSeek Harness (DSH)
# Install the plugin
dsh plugin --profile web add github:A3Boy/dsh-web-tools
# Update to the latest version later
dsh plugin --profile web update dsh-web-tools
Restart dsh web and open Settings → Web Search in the sidebar:
- Click any search source to paste your API key(s) (self-hosted SearXNG needs no key by default).
- To add a custom gateway or domestic API (such as Zhipu BigModel or Bocha), click Add Custom Search Source, pick a preset at the top, enter your key, and click Test Search.
- Drag sources to set your preferred order, or switch routing and concurrency modes under Current search strategy.
In-chat controls:
- Switch search mode (
Alt+Sor/search):- Smart (Default): The agent decides when a web lookup is needed and answers directly otherwise.
- Always: Enforces at least one web tool call before finishing each turn.
- Off: Hides web tools from the session and blocks calls at the tool gate (your chosen mode is preserved when resuming past sessions).
- Target social platforms: Prefix a query with
小红书:orX:(for example,X: SQLite WAL benchmark) to route through your local platform session (use a secondary account and low frequency for Xiaohongshu).
Option 2: Standalone MCP Server (Cursor / Claude Code / Windsurf)
You can run dsh-web-tools outside DSH as a standalone stdio MCP server. Install directly from GitHub or build from source:
# Method A: Global install from GitHub
npm install -g github:A3Boy/dsh-web-tools
dsh-web-tools-mcp
# Method B: Clone and build locally
git clone https://github.com/A3Boy/dsh-web-tools.git
cd dsh-web-tools
npm install && npm run build
node bin/mcp-server.js
Cursor / Claude Desktop Configuration
Add to .cursor/mcp.json or claude_desktop_config.json (configure only the API keys you have):
{
"mcpServers": {
"web-tools": {
"command": "dsh-web-tools-mcp",
"env": {
"TAVILY_API_KEY": "tvly-...",
"EXA_API_KEY": "...",
"SERPER_API_KEY": "...",
"WEB_TOOLS_DEFAULT_PROVIDER": "tavily",
"WEB_TOOLS_ROUTING_POLICY": "adaptive",
"WEB_TOOLS_RETRIEVAL_STRATEGY": "hedged"
}
}
}
}
If running from a local clone, replace "command": "dsh-web-tools-mcp" with "command": "node", "args": ["/path/to/dsh-web-tools/bin/mcp-server.js"].
Claude Code CLI
claude mcp add web-tools -- dsh-web-tools-mcp
Core Capabilities
1. Focused Page Reading (web_read)
Instead of dumping an entire 80k-character reference page into context with web_fetch, web_read splits Markdown into structural chunks and ranks them locally with BM25 (no extra LLM calls, a few milliseconds of CPU):
- Step 1 — Ask with a focus:
web_read(url, focus: "how WAL checkpointing works")returns the lead context, the highest-scoring passages within your character budget (default6,000chars), a full section outline (s0,s1,s2...), and an 8-char SHA-256contentId. - Step 2 — Read a specific section: Pass
web_read(url, section: "s2", contentId: "...")on a follow-up call to read that section in full. If the live page changed in between,contentIdcatches the mismatch so the agent refreshes the outline instead of reading shifted text. - Short pages that already fit within
maxCharsare returned whole. - You can toggle
web_readon or off anytime under Connection test & timeout in Settings.
2. Multi-Source Routing & Concurrency
Click Edit on Current search strategy to choose how queries are dispatched:
Concurrency modes:
- Single (Default): Tries one source at a time and moves to the next on errors, timeouts, or empty results. Lowest quota use.
- Hedged: Starts your primary source first; if it has not answered after 1.2s, starts the next source in parallel. First responder wins and cancels the slower request — fast queries spend 1 request, slow queries avoid long stalls.
- Fused: Queries two sources in parallel and merges results via Reciprocal Rank Fusion (RRF). Best coverage, uses 2 requests per search.
Starting source policies:
- Ordered: Always starts from the top of your list.
- Round-robin / Random: Spreads traffic across enabled sources.
- Adaptive: Ranks sources automatically using rolling 24h success rate and latency.
- Fastest / Cheapest: Picks the lowest-latency source first, or prioritizes free self-hosted SearXNG before paid APIs.
Query hints such as recency (2026, latest, this week), site:github.com, -site:example.com, coding/research topics, and sort order (time, likes) are translated locally into each provider's native API parameters.
3. Custom Search Sources & Presets
Click Add Custom Search Source to connect internal search services or regional APIs. Six one-click templates are built in:
- Zhipu Web Search (BigModel) (
open.bigmodel.cn) - Bocha Web Search (
api.bochaai.com) - Serper (Google) (
google.serper.dev) - SearXNG (self-hosted JSON API)
- Elasticsearch / OpenSearch (
/_searchwithmulti_matchbody template) - Tavily Compatible Gateway
For arbitrary REST JSON endpoints, switch to Custom JSON API to configure headers, URL parameters, or nested JSON body templates ({{query}}, {{maxResults}}, {{apiKey}}) along with response dot-paths (itemsPath, urlPath, titlePath, snippetPath).
Outbound safety:
- Direct connections validate DNS records upfront and pin the socket to the verified IP, protocol, and port; HTTP
3xxredirects are refused so API keys never leak across origins. - Private/LAN targets and plain
http://require explicit confirmation; cloud metadata endpoints (169.254.169.254, IMDSv6, link-local) are unconditionally blocked. - Respects
HTTPS_PROXY/HTTP_PROXY, Windows system proxy settings, andNO_PROXYbypass rules while dialing authorized LAN addresses directly.
4. Local Xiaohongshu & Twitter / X Sessions
- No extra browser downloads: Connects via CDP to your existing Chrome or Edge installation using isolated profile folders (
~/.dsh/web-tools/browser-profiles/<platform>), keeping cookies strictly on disk inside your local profile. - Xiaohongshu: Supports sorting (general, latest, likes, comments, collects) and extracts note bodies, images, and loaded comment threads.
- Twitter / X: Extracts full tweets, media, and reply trees when signed in; falls back to public syndication / FxTwitter channels for individual status URLs when signed out or temporarily rate-limited in the browser.
[!CAUTION] Reminder: Xiaohongshu actively enforces anti-automation limits on logged-in accounts. Use a secondary account and keep search frequency low.
Built-in Provider Matrix
| Provider | Search | Fetch / Extract | Strengths | Quota Display |
|---|---|---|---|---|
| Exa | Yes | Yes | Strong semantic search for technical docs, papers, and code | Provider console |
| Tavily | Yes | Yes | Agent-focused search & page extraction with depth controls | Live API sync |
| Serper | Yes | — | Fast Google results + answerBox direct answers |
Provider console |
| Brave | Yes | — | Uses LLM Context summaries first; freshness & region filters | Response headers |
| Firecrawl | Yes | Yes | Clean Markdown scraping; GitHub & research category filters | Live API sync |
| Keenable | Yes | Yes | Domain & date-range scoping plus native /v1/fetch extraction |
Headers + local ledger |
| You.com | Yes | Yes | Long search highlights and domain soft-boosting | Live API sync |
| Jina | Yes | Yes | ReaderLM-v2 Markdown conversion | Response headers |
| Parallel | Yes | Yes | Objective-steered search with domain/freshness policies | Provider console |
| SearXNG | Yes | — | Free self-hosted meta-search, no API key required | Self-hosted |
Fetch fallback: When
web_fetchorweb_readruns, configured extraction-capable providers (Tavily, Exa, Firecrawl, Keenable) are tried first; if none are configured or extraction fails, the built-in local fetcher (Defuddle + automatic TOC outline for pages over 8,000 chars) handles the page automatically.
MCP Environment Variables
Pass multiple keys for any provider as a comma-separated string (key1,key2) to enable automatic key pooling:
| Variable | Description | Default |
|---|---|---|
EXA_API_KEY / TAVILY_API_KEY / SERPER_API_KEY / BRAVE_API_KEY |
Provider API key(s) | — |
FIRECRAWL_API_KEY / KEENABLE_API_KEY / YOU_API_KEY / JINA_API_KEY / PARALLEL_API_KEY |
Provider API key(s) | — |
SEARXNG_URL |
Base URL of your self-hosted SearXNG instance | — |
WEB_TOOLS_DEFAULT_PROVIDER |
Initial preferred search provider | exa |
WEB_TOOLS_ROUTING_POLICY |
ordered / round-robin / random / adaptive / fastest / cheapest |
adaptive |
WEB_TOOLS_RETRIEVAL_STRATEGY |
single / hedged / fused |
hedged |
WEB_TOOLS_TIMEOUT_MS |
Per-provider attempt timeout in ms | 10000 |
WEB_TOOLS_REQUEST_TIMEOUT_MS |
Overall timeout ceiling per MCP tool call in ms | 60000 |
FAQ
1. SearXNG returns 403 or empty results?
SearXNG disables JSON output by default. Enable json under search.formats in your SearXNG settings.yml and restart the container:
search:
formats:
- html
- json
Then enter your instance URL (e.g. http://127.0.0.1:8080) in Settings and leave the API key blank.
2. Why did custom HTTPS sources fail with unapproved authority <host>:0 on v0.3.9?
In 0.3.9, Undici passed port: "" for default HTTPS ports, which the pinned connector coerced to 0 (adding :443 manually did not help because URL parsing strips default ports). Upgrade to v0.5.1 and restart DSH — no API key or permission changes needed.
3. Does Smart (auto) mode inject duplicate prompts every turn?
No. v0.5.1 checks the effective session history visible to the model: as long as the Smart-mode note is still in context (including across session resume), later turns add nothing. It is only re-inserted if context compaction removes earlier messages or when switching back from Always / Off (Off mode is similarly deduplicated across consecutive turns).
4. Does Hedged or Fused search double my API bill?
- Single: 1 request per search unless the primary fails.
- Hedged: Only starts a second source when the first takes longer than 1.2s, and cancels the slower one immediately.
- Fused: Always queries 2 sources in parallel (~2x quota) for broader coverage.
5. What does WEB_READ_PAGE_CHANGED mean?
If a live page updates between two web_read calls, section IDs from the old outline may no longer match. Passing contentId catches that change and tells the agent to fetch a fresh outline instead of reading mismatched sections.
Development & Testing
npm install # Install dependencies
npm test # Run 700+ unit and integration tests
npm run typecheck # Typecheck host and client
npm run build # Build lib/ outputs
npm run bench:m4 # Run web_read M4 benchmark (see bench/m4/RESULTS.md)
License
Links
More in this category
Tencent/BrowserSkill#dsh-plugin-browserskill★ 10735
BrowserSkill bridge for controlling visible Chrome and Edge Agent Windows from DeepSeek Harness, with native browser tools, accessibility and VOM observations, screenshots, owned multi-session control, and a live Web UI overlay.
DDDMUC/dsh-free-search★ 1719
Free web search for DSH with 42 engines: 6 keyless (DuckDuckGo, Bing, SearXNG, Degoog, AnySearch), 6 key-or-keyless tiers (Exa, Tavily, Keenable, Firecrawl, Parallel, You.com), 5 HTML search pages, and keyed providers from Brave and Baidu to Zhihu, OpenAI and Claude. Failure-classified failover with cooldown and key rotation, allowlist switching, an editable fallback chain, zh/en language pools, Multi concurrent merge, 12 MCP tools and a standalone stdio server, with per-engine keys in settings.
omdsh-dev/dsh-browser#packages/browser/bridge-browser★ 1143
Chrome sidebar extension that lets DSH operate your browser directly, no vision capabilities required.
liustack/modsearch★ 1044
Web search bridge for text-only agents: ask the web or X, get structured JSON evidence (search, fetch, citations).
Fisfzy/dsh-ego-browser★ 577
Drive a real Chrome/Chromium browser from DeepSeek Harness with 35 structured tools for navigation, snapshots, clicks, forms, JavaScript/CDP, screenshots, downloads and tabs; a live sidebar mirrors the page and accepts mouse and keyboard input. It ships a managed CDP runtime, keeps login state across calls, and can import cookies from your everyday Chrome through a companion extension.
regrevia/Envoy#dsh-envoy★ 266
Distill any link into Markdown, a wiki or a knowledge base. Installs per host: DSH -> envoy-dsh; Claude Code/Codex -> envoy@envoy. Douyin/Bilibili video, image posts, WeChat, Xiaohongshu, PDFs, podcasts. Video is read on its own timeline with keyframes and ASR transcripts locatable to \[mm:ss], so the context carries what was said and shown instead of the title and the recommendation rail. On 60 turns with vs without: ends normally with the gaps named 22% -> 92%, times out 68% -> 0% (the A/B is exploratory: different time caps, no human correctness review). On 123 live links 80% came back usable (93% of the pages that answered).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.