Mcp Web Research

io.github.Opafex由 GitHub 帳號 Opafex 發布v0.1.0更新於 Oct 26, 2026

Web search (Brave) and SSRF-safe page fetching, extraction and comparison for agents

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理搜尋網頁、把頁面抓取為純文字、擷取指定欄位並比較多個頁面,抓取過程具 SSRF 防護。

可以做什麼
  • 搜尋網頁,回傳標題、網址與摘要,可限定單一網域
  • 抓取網址並回傳標題與純文字、連結或兩者
  • 研究主題:先搜尋再讀取前幾筆結果,依來源整理關鍵句
  • 從單一頁面擷取指定欄位,例如價格或聯絡方式
  • 比較二到五個頁面,可聚焦某個主題
  • 回傳伺服器名稱、版本、工具與資源,方便自我檢查
適用情境
適合助理需要最新網路資訊,或需要閱讀並比較公開網頁而非依賴記憶的情況。頁面類工具不需任何金鑰即可使用,因此也可只用於唯讀的頁面擷取。
執行需求
透過 npx 在本機執行,需要 Node.js 20 以上版本。搜尋類工具需要 BRAVE_SEARCH_API_KEY 中的 Brave Search API 金鑰,沒有金鑰時只有頁面工具可用。可選設定包括逾時、大小上限、快取時間、User-Agent 與搜尋提供者。需要網路存取。
安裝前請注意
Brave 金鑰以環境變數傳入,應避免寫進共用的設定檔。抓取的網址由模型挑選,請求會從你的機器送出;SSRF 檢查會阻擋私有位址與雲端中繼資料位址,但文件說明了 DNS 重新綁定這項已知缺口,若本機有敏感內部服務,應在網路層限制對外連線。可選的 DuckDuckGo 抓取方式並非官方,其條款不允許自動查詢。頁面不執行 JavaScript,且只接受文字類內容。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Web Research,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@opafex/mcp-web-research

MCP server for web research — search the web, fetch pages as clean text, pull named sections out of a page, compare pages side by side, and run a two-stage "search then read the top results" pass.

No LLM is involved: research_topic and compare_pages organise extracted text, they do not generate it. Every page fetch is SSRF-checked, including every redirect hop.

Search uses the Brave Search API (free tier available). Without a key, the four page tools still work and the two search tools return an error telling you which variable to set.

Installation

bash
npx -y @opafex/mcp-web-research

Requires Node.js 20+. No other dependencies to install.

Quick Start

Claude Code

bash
claude mcp add web-research -e BRAVE_SEARCH_API_KEY=your-key -- npx -y @opafex/mcp-web-research

Or add it to .mcp.json in your project root:

json
{  "mcpServers": {    "web-research": {      "command": "npx",      "args": ["-y", "@opafex/mcp-web-research"],      "env": {        "BRAVE_SEARCH_API_KEY": "your-key"      }    }  }}

Claude Desktop

Add the same block to claude_desktop_config.json (Settings → Developer → Edit Config):

json
{  "mcpServers": {    "web-research": {      "command": "npx",      "args": ["-y", "@opafex/mcp-web-research"],      "env": {        "BRAVE_SEARCH_API_KEY": "your-key"      }    }  }}

Omit BRAVE_SEARCH_API_KEY to run with the page tools only.

Tools

ToolWhat it doesNeeds a search provider
web_searchSearch the web; returns title, URL and snippet per resultYes
fetch_webpageFetch a URL and return its title and clean text, links, or bothNo
research_topicSearch a topic, fetch the top results, and compile the key sentences from each, by sourceYes
extract_structured_dataFetch a page and return the section around each requested field (e.g. pricing, contact)No
compare_pagesFetch 2–5 pages and compare them, optionally around one focus areaNo
server_infoServer name, version, tools and resources (built in, from @opafex/mcp-shared)No

web_search

ParameterTypeRequiredDescription
querystringYesSearch query
maxResultsnumberNo1–20, default 10
domainstringNoRestrict results to this domain (e.g. "example.com"); adds site: and filters the result URLs

Result URLs that fail the SSRF check (below) are dropped before they are returned.

Example response
json
[  {    "title": "Model Context Protocol",    "url": "https://modelcontextprotocol.io/",    "snippet": "An open protocol that enables seamless integration between LLM applications and external data sources and tools."  }]

fetch_webpage

ParameterTypeRequiredDescription
urlstringYeshttp or https URL
extractMode"text" | "links" | "all"NoDefault "text"
maxLengthnumberNoMaximum characters of text returned, default 4000

Scripts, styles, <nav> and <footer> are removed. finalUrl is included when the page was reached through redirects.

Example response
json
{  "title": "Example Domain",  "text": "Example Domain\nThis domain is for use in illustrative examples in documents.",  "url": "http://example.com/",  "fetchedAt": "2026-10-24T12:00:00.000Z"}

research_topic

ParameterTypeRequiredDescription
topicstringYesWhat to research
depth"quick" | "standard" | "deep"NoSearch 3 / 5 / 10 results and read 2,000 / 4,000 / 8,000 characters of each. Default "standard"
maxSourcesnumberNo1–10 sources to fetch, default 5

Key points are the sentences that mention the topic's words, up to five per source. A source that cannot be fetched falls back to its search snippet.

extract_structured_data

ParameterTypeRequiredDescription
urlstringYesPage to read
fieldsstring[]YesField names to look for (e.g. ["pricing", "features", "contact"])

For each field, returns the first line mentioning it and the ten lines after, up to 1,000 characters — or No "<field>" section found on page. This is heading matching, not a schema extractor.

compare_pages

ParameterTypeRequiredDescription
urlsstring[]Yes2–5 URLs
focusstringNoA field to pull from every page (e.g. "pricing")

A page that fails to fetch is listed with "(fetch failed)" and the reason; the others are still compared.

Resources

ResourceDescription
web-research://statusSearch provider in use (or why search is unavailable), cache stats and configuration
web-research://cacheSearch queries currently cached

Search providers

ProviderHow to selectNotes
Brave Search API (recommended)Set BRAVE_SEARCH_API_KEYAn official API with a free tier. Up to 20 results per query.
DuckDuckGo HTML scraperSet WEB_RESEARCH_SEARCH_PROVIDER=duckduckgoOpt-in only — see below
noneNeither of the aboveweb_search and research_topic return an error naming BRAVE_SEARCH_API_KEY; the other tools work

About the DuckDuckGo option. It parses the results page at html.duckduckgo.com. That is not an API: it breaks whenever DuckDuckGo changes its markup, it may be rate-limited or blocked, and DuckDuckGo's terms do not permit automated querying. It sends this server's honest user agent rather than pretending to be a browser, which makes blocking more likely. It is kept for personal experimentation; if you turn it on, you are responsible for complying with DuckDuckGo's terms. Use Brave for anything you depend on.

Environment Variables

VariableTypeDefaultDescription
BRAVE_SEARCH_API_KEYstring—Brave Search API key. Enables web_search and research_topic
WEB_RESEARCH_SEARCH_PROVIDERbrave | duckduckgoBrave if a key is set, else noneChoose the search provider explicitly
USER_AGENTstringopafex-mcp-web-research/<version> (+https://github.com/Opafex/opafex-mcps)User-Agent sent with every request
FETCH_TIMEOUT_MSnumber10000Timeout per page, across all its redirect hops
MAX_HTML_SIZEnumber (bytes)1000000Bytes read from a page body; the download stops there
SEARCH_CACHE_TTLnumber (seconds)900 (15 min)How long search results are cached
PAGE_CACHE_TTLnumber (seconds)3600 (1 h)How long fetched pages are cached

Security

The page tools fetch URLs chosen by a model, from the machine the server runs on. Without protection, that machine's private network and cloud metadata service are one tool call away (server-side request forgery). Every fetch is checked first, and refused if:

  • the scheme is not http or https;
  • the host is localhost, *.localhost, or a cloud metadata name (metadata.google.internal);
  • the host is a literal IP — IPv4, or bracketed IPv6 — in a non-public range. Odd IPv4 spellings (http://2130706433/, http://0x7f.1/) are normalised before the check;
  • any address the hostname resolves to, IPv4 (A) or IPv6 (AAAA), is in a non-public range. One public A record does not excuse a private AAAA record;
  • the hostname cannot be resolved. The check fails closed: an address that could not be checked is not fetched.

Blocked ranges:

IPv4IPv6
0.0.0.0/8 this network:: unspecified, ::1 loopback
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 privatefc00::/7 unique local
100.64.0.0/10 carrier-grade NATfe80::/10 link-local, fec0::/10 site-local
127.0.0.0/8 loopbackff00::/8 multicast
169.254.0.0/16 link-local, incl. cloud metadata 169.254.169.254::ffff:0:0/96 IPv4-mapped — judged by the IPv4 address inside
192.0.0.0/24, 198.18.0.0/15 reserved / benchmarking64:ff9b::/96 NAT64 and 2002::/16 6to4 — judged by the IPv4 address inside
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 documentation::/96 IPv4-compatible, 64:ff9b:1::/48, 2001::/32 Teredo, 2001:db8::/32
224.0.0.0/4 multicast, 240.0.0.0/4 reserved, broadcastanything outside global unicast 2000::/3

Redirects are followed by hand, and every hop is checked again — at most 5 hops. A public page that redirects to http://169.254.169.254/ is refused before the second request is made. Search result URLs are checked too, and dropped if they fail.

Known limit — DNS rebinding. The check resolves the hostname, then fetch resolves it again to connect. A hostile DNS server with a very short TTL could answer the two lookups differently. Closing that gap means pinning the connection to the checked address, which Node's built-in fetch does not expose without an extra dependency. If this server runs somewhere with sensitive internal services, also limit what it can reach at the network level (container network policy, egress firewall).

Limits

  • Text only. Pages must be text/*, application/xhtml+xml or application/json; PDFs, images and other binary types are refused.
  • No JavaScript. Pages are fetched as served. Content rendered client-side will be missing.
  • Regex-based HTML parsing. Fast and dependency-free, but not a full HTML parser; unusual markup can leak into the text.
  • Heuristic extraction. research_topic key points and extract_structured_data sections are keyword matching, not understanding.
  • In-memory cache, per process, lost on restart.
  • UTF-8 assumed. Pages in other encodings may decode with replacement characters.
  • Not a crawler. No robots.txt handling; it fetches the URLs it is given.

Development

bash
npm run build    # Compile TypeScriptnpm run dev      # Run with tsx (no build needed)npm test         # Run tests (no network — fetch and DNS are faked)npm start        # Run compiled server

Contributing

Found a bug or have a feature request? Open an issue.

Pull requests welcome — see the main repo for development setup.

License

MIT — see LICENSE.

來源:packages/web-research/README.md,提交 f85607b

工具

6

fetch_webpage

Fetch a URL and extract clean text content. Includes SSRF protection (blocks private IPs, localhost, cloud metadata). Supports extracting text, links, or both.

輸入參數url必填maxLengthextractMode

research_topic

Two-stage interpreted search: searches the web for a topic, fetches top results, and compiles a structured summary organized by source. No LLM involved — extracts key sentences and organizes them. Needs a search provider, like web_search.

輸入參數depthtopic必填maxSources

extract_structured_data

Extract specific data fields from a webpage. Fetches the page and searches for sections matching the requested field names (e.g. "pricing", "features", "contact").

輸入參數url必填fields必填

compare_pages

Fetch multiple URLs and compare their content. Returns page metadata and a text comparison, optionally focused on a specific aspect.

輸入參數urls必填focus

server_info

Returns server metadata: name, version, registered tools, and registered resources. Useful for introspection and health checks.

無需輸入參數。

版本歷史

1
  1. v0.1.0最新Oct 25, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分