Slopsquat Scanner

io.github.4hmetuyar由 GitHub 帳號 4hmetuyar 發布v0.1.1更新於 Oct 24, 2026

Checks declared npm/PyPI dependencies against real registries to catch slopsquatting

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

本機 MCP 伺服器,將專案宣告的 npm 與 PyPI 相依套件與真實套件庫比對,找出搶註或幻覺產生的套件名稱。

可以做什麼
  • 掃描目錄中 package.json 宣告的 npm 相依套件並逐一查詢 npm 套件庫
  • 檢查 requirements.txt 或 pyproject.toml 中的 pip 相依套件是否存在於 PyPI
  • 自動辨識並同時檢查同一目錄下的 npm 與 pip 清單
  • 針對 npm 或 PyPI 檢查單一套件名稱是否存在
  • 以 dependency_not_found(嚴重)或 dependency_recently_published(低)回報結果,並可輸出 SARIF 供 CI 使用
適用情境
適合在 AI 程式助理建議或寫入套件名稱後、安裝之前確認這些套件確實存在。也適合在 CI 流程中讓未在任何套件庫發布的名稱導致建置失敗。
執行需求
以 stdio 方式在本機執行,通常透過 npx 啟動已發布的 npm 套件。需要 Node.js 以及連線至公開 npm 套件庫與 PyPI JSON API 的網路;不需 API 金鑰或帳號。
安裝前請注意
每次檢查都是對 npm/PyPI 的即時 HTTP 請求,相依套件多的專案會產生大量請求,套件庫故障或限流會顯示為工具錯誤。只檢查直接宣告的相依套件,不檢查間接相依,也不評估版本鎖定範圍。最近發布的訊號含意模糊,不能當作惡意證據。遙測預設關閉;設定 GUARDBEE_TELEMETRY=1 後會把伺服器、工具、成功狀態、耗時與檔案路徑等短參數值傳送給遙測套件。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

@guardbee/mcp-slopsquat-scanner

🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch

[npm version] [npm downloads] [License: MIT]

An MCP (Model Context Protocol) server that checks every dependency declared in a project's own manifest (package.json, requirements.txt, pyproject.toml) against the real npm/PyPI registry — not a local database, an actual network lookup.

LLM coding assistants hallucinate plausible-sounding package names at a measurable rate — research on open-source models puts it around 21.7%. Attackers know this and pre-register exactly those names on npm/PyPI, so the next person who copies the same suggestion doesn't get an install error — they get the attacker's code instead. This is slopsquatting, and unlike a typo-squat, there's no misspelling to catch by eye: the hallucinated name is often more plausible-sounding than the real package it was meant to be.

Telemetry is off by default. With GUARDBEE_TELEMETRY=1 it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields like content, token or password are replaced with a placeholder. See @guardbee/mcp-telemetry.

Claude ──► slopsquat-scanner ──► registry.npmjs.org / pypi.org              │              ├─ dependency_not_found            (name isn't published anywhere — critical)              └─ dependency_recently_published    (exists, but published <30 days ago — low/informational)

Why a live registry lookup, not a local list

There's no way to maintain a local "known bad" list for this — the whole point of a slopsquat is that it's a new name, registered specifically to catch a specific hallucination, possibly hours before someone runs npm install. A static pattern can't know that; only asking the registry "does this exact name exist right now" can. This package only checks a project's own directly declared dependencies (the dependencies/devDependencies/peerDependencies/optionalDependencies sections of package.json, or requirements.txt/pyproject.toml for Python) — not the full resolved lockfile tree. Transitive dependencies were already vetted by whichever maintainer published the package that depends on them; the actual risk moment is when a new name gets typed (by a human or an AI assistant) directly into your own manifest.

A name that doesn't exist at all is unambiguous and reported critical — verify the correct name before you or a teammate installs it. A name that does exist but was only published in the last 30 days is reported low/informational, not critical: this is routine for real new packages too, and on its own doesn't prove anything malicious — it's a "worth a second look" signal, not a verdict.


Features

  • Checks npm and PyPI — package.json, requirements.txt, and pyproject.toml (both PEP 621 [project] dependencies and Poetry's [tool.poetry.dependencies])
  • Direct dependencies only — fast, and matches where the actual slopsquatting risk moment is
  • Scoped npm packages (@scope/name) handled correctly — found and fixed a real URL-encoding bug during development (encodeURIComponent on the whole name double-encodes the registry's own @scope%2Fname convention, producing a URL the registry doesn't recognize as a single package)
  • No API key required — queries the public, unauthenticated npm registry and PyPI JSON API directly
  • SARIF 2.1.0 output — CI/CD integration (GitHub Code Scanning, etc.)
  • 18 unit tests covering the manifest parsers (including a check that transitive lockfile entries are correctly not included) and the severity classification logic, all against real, deterministic fixtures — no mocked network calls, since parsing and classification are pure functions that don't need one. End-to-end verified against the real npm and PyPI registries with a fixture mixing real packages (react, vitest, requests) and deliberately hallucinated ones — caught both hallucinated names, zero false positives on the real ones. Also run against this monorepo's own package.json files as a dogfooding check: zero false positives on real dependencies, and one genuinely correct low-severity finding (@guardbee/mcp-telemetry, itself only ~2 weeks old on npm at the time) — exactly the intended "worth a look, not an alarm" behavior.

Quick Start

Claude Desktop / MCP Client

json
{  "mcpServers": {    "guardbee-slopsquat-scanner": {      "command": "npx",      "args": ["-y", "@guardbee/mcp-slopsquat-scanner"]    }  }}

CLI (CI/CD)

bash
npx @guardbee/mcp-slopsquat-scanner scan . --fail-on=critical --format=sarif > results.sarif

MCP Tools

ToolDescription
scan_npmChecks every declared npm dependency in a directory's package.json
scan_pipChecks every declared pip dependency (requirements.txt / pyproject.toml)
check_packageChecks a single package name against npm or PyPI
scan_directoryAuto-detects and checks both npm and pip manifests

Detected Patterns

PatternSeverityMeaning
dependency_not_foundcriticalDeclared package name doesn't exist on the registry at all
dependency_recently_publishedlowPackage exists, but was first published less than 30 days ago

Configuration (guardbee.yml)

yaml
slopsquat-scanner:  fail-on: critical    # critical | low | none  include-dev: false

Limitations (by design)

  • Direct dependencies only. A hallucinated or squatted name inside a transitive dependency (something a package you depend on itself depends on) isn't checked — that package's own maintainers already resolved it against a real registry when they published.
  • The "recently published" signal is genuinely ambiguous. Real new packages get published constantly; this is reported at low severity specifically because it is not proof of anything, only a "look closer" prompt.
  • Network-dependent. Every check is a live HTTP request to the npm/PyPI registry — a project with many dependencies means many requests (bounded to 8 concurrent at a time), and a registry outage or rate limit will show up as a tool error, not a false "doesn't exist" finding (registry errors are reported separately from a genuine 404).
  • No version-pin awareness. This checks whether the name exists, not whether the specific version range you've pinned is itself suspicious — that's a different, already-covered problem (see @guardbee/mcp-dependency-auditor for known-CVE checking).

Development

bash
npm run buildnpm test             # 18 unit tests

License

MIT — GuardBee

Feedback

Questions, ideas, or a false positive? Start a thread in GitHub Discussions or open an issue. If GuardBee is useful to you, a ⭐ on the repository helps others find it.

來源:packages/slopsquat-scanner/README.md,提交 040e072

工具

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

版本歷史

1
  1. v0.1.1最新Sep 29, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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