Linkrot

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 6, 2026

Docs link checker separating dead, moved, and bot-blocked links from healthy ones.

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,用來檢查儲存庫 Markdown 中的連結,驗證相對檔案與錨點,外部連結僅標示為未檢查。

可以做什麼
  • 檢查整個目錄或單一 Markdown 檔案中的連結,自動略過 node_modules、.git 與 dist
  • 對照檔案系統驗證相對檔案連結與標題錨點,回報缺少的目標檔案與缺少的錨點
  • 回傳 JSON 報告,統計檔案數、連結數、失效連結、缺少錨點與未檢查的外部連結,並給出 OK 或 FINDINGS 結論
  • 擷取行內連結、圖片連結與參照式定義,忽略圍欄程式碼區塊中的連結
適用情境
適合在維護文件時讓助理於發布前找出失效的相對連結與過期的錨點。也適合離線或隔離環境的檢查,此時不應抓取外部網址。
執行需求
以 stdio 方式在本機執行,可透過 npx 使用 npm 套件,或使用 Docker 映像。不需要帳號、API 金鑰、環境變數或網路存取,只需提供要檢查的路徑。
安裝前請注意
它會讀取所給路徑下的檔案,請將該路徑限定在目標儲存庫內。外部連結不會被抓取,只標示為未檢查,因此無法確認遠端頁面是否可用。它只產生報告,不會修改檔案。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

linkrot

Docs link checker that separates failure kinds instead of calling every bad response a dead link. Relative links and anchors are verified against the filesystem. External links are classified by what actually happened: healthy, dead, moved, bot-blocked, or error. A 403 from a bot wall is not a dead link, and linkrot never reports it as one.

What it does

  • Walks a target directory for markdown files (skipping node_modules, .git, and dist) or checks a single markdown file.
  • Extracts inline links (image links count), reference-style definitions, and reference usages that resolve to a definition. Links inside fenced code blocks are ignored. Bare URLs in prose and autolinks are not extracted.
  • Checks each link by class:
    • RELATIVE-FILE: the path part is resolved relative to the markdown file. A missing target is a DEAD-RELATIVE finding (high).
    • RELATIVE-ANCHOR: the file exists but the anchor slug is not among the target file heading slugs. That is an ANCHOR-MISSING finding (medium). Slugs are built by lowercasing, stripping punctuation, and turning spaces into hyphens.
    • SAME-FILE-ANCHOR: a link like #section in the same file, checked against that file heading slugs with the same ANCHOR-MISSING rule.
    • EXTERNAL: http and https links are reported as UNCHECKED info entries in offline mode. They are counted and never fail the check.
    • MAILTO and other schemes are skipped silently and counted under skipped.

Install

bash
npx @reneturcios/linkrot check .

Or install globally:

bash
npm install -g @reneturcios/linkrot

CLI

bash
linkrot check [path] [--json]linkrot mcplinkrot --version
  • check runs the offline check on a path (default: current directory). Exit code is 0 when the verdict is OK and 1 for any other verdict. Use --json for the machine-readable report.
  • mcp starts the MCP server on stdio.
  • --version prints the version.

MCP

The MCP server exposes one tool:

  • check_links with a path argument. It returns the same JSON report as linkrot check --json.

Offline by default

Offline mode is the default and the shipped default. The core is synchronous and performs no network requests.

This is deliberate. The founding observation behind linkrot is that automated fetches routinely hit bot walls, login gates, and rate limits. A checker that fetches every external URL and treats any non-2xx response as dead will report healthy pages as broken whenever a site blocks bots. Offline mode avoids that failure entirely: it proves what can be proven locally (relative files and anchors) and reports external links honestly as UNCHECKED instead of guessing.

Link classes and status vocabulary

When an online mode checks external URLs in the future, each HTTP status maps to exactly one class:

ClassMeaning
healthy2xx, plus 3xx redirects that are not permanent moves (for example 302, 304, 307)
dead404 or 410: the page is gone
movedA redirect to a new location. Permanent redirects (301, 308) get the distinct label moved-permanent.
bot-blocked401, 403, or 429: a bot wall, auth gate, or rate limit answered. The page may be fine for a human.
error5xx and anything else: the check itself could not get a trustworthy answer

The function classifyStatus(status) implements this table and is unit tested. Keeping bot-blocked separate from dead is the point of the tool: conflating them turns every Cloudflare or login wall into a false dead-link report.

Verdict rules

  • Verdict is OK when there are no DEAD-RELATIVE and no ANCHOR-MISSING findings.
  • Verdict is FINDINGS otherwise.
  • UNCHECKED external entries never affect the verdict in offline mode.

The report counts files, links, dead, anchorsMissing, and externalUnchecked, plus per-class counts: relativeFile, relativeAnchor, sameFileAnchor, external, and skipped.

Limits

  • The offline core checks relative links and anchors only.
  • External liveness is not checked offline. External links are reported UNCHECKED, never guessed as healthy or dead. A future online mode will classify them with the vocabulary above.
  • Extraction covers inline links and reference definitions (with full and collapsed reference usages resolved). Shortcut reference links, bare URLs, and autolinks are not extracted.
  • Anchor checks apply when the link target is a markdown file. Anchors pointing into non-markdown files are not verified.
  • Heading slugs follow a simplified GitHub rule: lowercase, strip punctuation, spaces to hyphens, with duplicate headings suffixed -1, -2, and so on.

Development

bash
npm installnpm run buildnpm test

來源:README.md,提交 238fac3

工具

1

版本歷史

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

評分

已滿足適用檢查項的 90%

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

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

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

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