NetLens

io.github.pzalutski-pixel由 GitHub 帳號 pzalutski-pixel 發布v0.2.3更新於 Oct 25, 2026

Read any web page as clean, ad-stripped Markdown past robots.txt and bot blocks, plus web search.

概覽

AI 產生的概覽

NetLens 是本地 MCP 伺服器,可將網頁抓取為去除廣告的整潔 Markdown,並提供回傳真實連結的網頁搜尋。

可以做什麼
搜尋網頁並回傳真實結果連結(標題、網址、摘要),可依呼叫或預設選擇搜尋引擎,並回報被略過的引擎。抓取任意網址並以整潔 Markdown 回傳整頁內容,支援 article、full、raw、outline 模式,或只取某個標題下的章節。可用字元上限截斷輸出,或只在需要正文時去掉連結網址。辨識由用戶端渲染的頁面並如實提示,而不是把空結果當成成功。
適用情境
當助理內建的網頁工具回傳空頁面、只給摘要而非全文,或輸出夾雜廣告與導覽時適用。適合有選擇地閱讀長文章,以及先搜尋再閱讀的流程。
執行需求
透過 npx(netlens-mcp)或 uvx 以 stdio 在本機執行;需要 Python 3.10+ 與系統 curl,缺少時改用 urllib。需要連線目標網站與搜尋引擎的網路。選用環境變數:NETLENS_SEARCH_ENGINE 與 NETLENS_SEARXNG_URL(指向 SearXNG 實例),以及逾時、快取、大小與 User-Agent 設定。未宣告驗證。
安裝前請注意
它刻意不遵守 robots.txt,並送出類似瀏覽器的請求標頭以繞過機器人攔截,可能與網站條款或政策衝突。抓取的頁面內容會進入助理的上下文,請求直接送往第三方網站。它不處理 CAPTCHA 或 JavaScript 挑戰頁。快取與同主機請求間隔可設定。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

NetLens

[npm] [PyPI] [CI] [License: Apache 2.0] [Python 3.10+]

An MCP server for unobstructed web reading. It fetches any URL directly with browser-like headers — past robots.txt and naive bot blocks — and returns the full page as clean, ad-stripped Markdown, not a summary. Plus web search that returns real links. Zero dependencies: pure Python standard library.

Built for AI Agents

AI agents constantly hit pages their built-in tools can't read. NetLens fixes the three usual reasons a fetch comes back empty or useless:

Native web toolsNetLens
Honor robots.txt, so crawler-disallowed pages return nothingReads like the browser you'd open yourself — doesn't consult robots.txt
Blocked by header/User-Agent bot filters (403/202 to non-browser clients)Sends real browser headers via the system curl; commonly turns 403 → 200
Return a summary of the pageReturns the full page content as Markdown
Leave ads, cookie banners, nav, and related-links chrome in the outputStrips boilerplate locally so only the content reaches your context

It does not try to defeat JavaScript/Cloudflare challenge pages or CAPTCHAs — that's out of scope by design. When a page is a hard block, the HTTP status is surfaced honestly rather than faked.

Installation

npm (via npx):

json
{  "mcpServers": {    "netlens": {      "command": "npx",      "args": ["-y", "netlens-mcp"]    }  }}

PyPI (via uvx):

json
{  "mcpServers": {    "netlens": {      "command": "uvx",      "args": ["netlens-mcp"]    }  }}

Add either to your MCP client config (e.g. .mcp.json for Claude Code), then restart the session so the tools load.

Tools

web_search

Search the web and return real result links (title, URL, snippet), parsed locally — links, not summaries. Follow up with web_fetch to read a result.

ArgumentTypeDescription
querystring (required)The search query
limitintegerOptional cap; default returns the full first page (~10)
enginestringauto (default), duckduckgo, bing, mojeek, searxng
pageintegerResult page, 1-based. SearXNG only
time_rangestringday, week, month, year. SearXNG only
categoriesstringe.g. it, science, news. SearXNG only

The result reports which engine answered and what happened to any that were skipped, so falling through to a different backend is visible rather than silent:

json
{  "query": "…",  "engine": "mojeek",  "results": [ … ],  "engines_skipped": [ { "engine": "duckduckgo", "outcome": "HTTP 202" } ]}

Outcomes are observations, not conclusions — HTTP 202 is what the server sent; whether that is throttling, changed markup or genuinely no matches cannot be determined from the response. With SearXNG configured, direct answers, infoboxes and suggestions appear alongside the results.

A search fetches a single result page (~10 results), returned in full by default so nothing at position 9/10 is dropped. There's no deep pagination — if the answer isn't in the first page, refine the query.

web_fetch

Fetch any page and return its full content as clean Markdown.

ArgumentTypeDescription
urlstring (required)URL to fetch (scheme optional; https assumed)
modestringarticle (main content only, default), full (whole body), raw (unconverted HTML), outline (heading structure)
sectionstringReturn only this heading's content, plus anything nested under it
linksstringinline (default) keeps link targets; none keeps link text but drops URLs
max_charsintegerOptional cap on returned characters (truncates with a note)

Reading part of a long page

A large article can be tens of thousands of characters when you want one part of it. mode="outline" returns its shape, and section returns just that piece — on a large encyclopedia article that is 153,000 characters full, 1,000 as an outline, and 7,400 for the section actually wanted.

web_fetch(url=…, mode="outline")      → headings with each section's sizeweb_fetch(url=…, section="Gameplay")  → that section and its subsections

On link-heavy pages the URLs themselves are a large share of the output — around 40% of a big encyclopedia article — so links="none" roughly halves it when you only need the prose. Links pointing back into the same page are always rendered as plain text.

If a page turns out to be a client-rendered shell, web_fetch says so rather than returning an empty result as a success:

(note: Only 10 characters of readable text were found in 6,856 characters of HTML. This page appears to be rendered client-side by JavaScript…)

Workflow: web_search to find pages, then web_fetch to read them.

Search engines

Search is a pluggable, selectable registry. In auto mode NetLens tries engines in order and returns the first with results, so a rate-limit/challenge page on one falls through to the next.

EngineNotes
duckduckgoDefault; html.duckduckgo.com endpoint
bingAutomatic fallback
mojeekIndependent index; automatic fallback
searxngSelf-hosted/public SearXNG JSON API — set NETLENS_SEARXNG_URL

Pick per call with the engine argument, or set a default with NETLENS_SEARCH_ENGINE.

Configuration

Environment VariableDefaultDescription
NETLENS_SEARCH_ENGINEautoDefault search backend
NETLENS_SEARXNG_URL—SearXNG base URL, e.g. http://192.168.1.10:8888
NETLENS_SEARXNG_TIMEOUT8Seconds before an unreachable SearXNG is skipped
NETLENS_USER_AGENTChrome UAOverride the request User-Agent
NETLENS_MAX_BYTES10485760Cap on a single response; larger ones are truncated
NETLENS_CACHE_TTL300Seconds to reuse a fetched page; 0 disables caching
NETLENS_HOST_DELAY0.5Minimum seconds between requests to the same host
NETLENS_REQUEST_TIMEOUT120Ceiling on a single tool call

Self-hosted SearXNG

Point NETLENS_SEARXNG_URL at an instance with the JSON API enabled (search.formats must include json in its settings.yml). It is then tried first in auto mode, which removes the HTML scraping — and the rate limiting that comes with it — from the common path.

Because it is tried first, it must fail fast when the box is off: the connect timeout is bounded separately so an unreachable instance is skipped in a few seconds rather than stalling every search, and the skip is reported in the result.

How it works

  • Direct fetch. Requests go straight to the target site via the system curl (better TLS/HTTP-2/compression, so it looks like a real browser), falling back to urllib. No third-party proxy or reader is involved.
  • Local conversion. HTML → Markdown happens in-process with a hand-rolled html.parser converter — headings, lists, links (relative URLs resolved), code blocks, and GFM tables with colspan/rowspan.
  • Content selection, not deletion. NetLens picks the page's main content region — the HTML5 landmark (<main> / <article> / [role=main]) when one exists, otherwise the subtree holding the most prose relative to its link density — and converts only that. Because it selects a winner rather than deleting anything that matches a name pattern, extraction cannot silently return an empty page. Nothing inspects CSS class or id names to decide what is content.
  • Pruning by measurement. Within that region, blocks that are overwhelmingly link anchors (navboxes, tag clouds, "more from this site" grids) are dropped based on their link density. Non-rendering elements (<script>, <style>, …), explicitly hidden elements, and third-party ad-network slots (identified by vendor names like adsbygoogle, which cannot collide with real prose) are removed outright.
  • Response charset is honored (from Content-Type or <meta>), so non-UTF-8 pages don't come back garbled.

Usage from the CLI

The server is also a plain script — handy for testing before a client loads it:

sh
python -m netlens_mcp.server search "http caching best practices"python -m netlens_mcp.server fetch  https://example.com/articlepython -m netlens_mcp.server full   https://example.com   # whole bodypython -m netlens_mcp.server raw    https://example.com   # unconverted HTML

python -m netlens_mcp runs the stdio MCP server; python -m netlens_mcp.server <cmd> runs the CLI.

Development

sh
pip install -e ".[dev]"python -m pytest        # run the test suiteruff check .            # lint

Requirements

  • Python 3.10+ (and the system curl, which ships with modern Windows/macOS/Linux; falls back to urllib if absent)

License

Apache License 2.0 — see LICENSE and NOTICE.

來源:README.md,提交 0cac036

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分