Npm Advisor Mcp

io.github.YashviGupta15由 GitHub 帳號 YashviGupta15 發布v0.1.3更新於 Oct 25, 2026

MCP server to search, compare, and recommend npm packages by size, popularity, and maintenance.

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

概覽

AI 產生的概覽

一個本機 MCP 伺服器,讓助理依體積、熱門度、維護狀況與 TypeScript 支援搜尋、比較、稽核並推薦 npm 套件。

可以做什麼
依功能或關鍵字搜尋 npm 套件,回傳含體積、下載量與品質評分的排序結果。並排比較 2–5 個套件,並針對瀏覽器、Node、React 或 CLI 情境給出加權推薦。查看單一套件的詳細中繼資料、回答技術問題、尋找替代套件並檢查是否已棄用。稽核已知 CVE 漏洞,並產生 npm、yarn、pnpm 與 bun 的安裝指令。從 GitHub、GitLab 或 Bitbucket 取得更新日誌,並診斷某個套件解析到的倉庫位址與驗證資訊。
適用情境
適合在挑選 JavaScript 函式庫時,希望依體積、採用度、維護狀況與安全性的證據做比較,而不是憑感覺決定。也適合從已棄用的套件遷移,或檢查某個相依套件是否有已知漏洞。
執行需求
以 npm 套件形式透過 stdio 在本機執行,需要 Node.js 18+ 與 npm 9+。不需 API 金鑰,但需要網路存取 npm registry、npm downloads、npm audit、npms.io、Bundlephobia 以及 GitHub/GitLab/Bitbucket。若位於會攔截 TLS 的代理後方,可能需要透過 NODE_EXTRA_CA_CERTS 指定企業 CA 憑證路徑。
安裝前請注意
伺服器會直接讀取使用者的 ~/.npmrc,其中包含倉庫驗證權杖,用於解析私有套件;這些權杖會用於倉庫與稽核請求。它只讀取套件資料並產生安裝指令,本身不執行安裝。私有套件無法取得體積與 npms.io 評分。README 中的範例設定自動核准了所有工具。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

npm-advisor-mcp

A Model Context Protocol (MCP) server that acts as an intelligent npm package advisor. Describe the feature you need, and it will search the registry, compare candidates, audit for vulnerabilities, and recommend the best library based on bundle size, popularity, maintenance, TypeScript support, and more.


Features

  • Search by feature — describe what you need (e.g., "date manipulation", "PDF generation") and get ranked results
  • Side-by-side comparison — compare 2–5 packages on key metrics in a clean table format
  • Deep package details — full breakdown of a single package: README, dependencies, scores, links
  • Weighted recommendations — algorithm-driven pick with dynamic weights per use case (browser, Node.js, React, CLI)
  • Security audit — check for known CVEs with severity breakdown and patch availability
  • Deprecation check — detect deprecated, abandoned, or unmaintained packages with a clear verdict
  • Find alternatives — discover competing packages when migrating away from a deprecated library
  • Install command generator — copy-paste commands for npm, yarn, pnpm, and bun with peer deps included
  • Changelog viewer — fetch recent release notes from GitHub, GitLab (cloud + self-hosted), or Bitbucket
  • Technical Q&A — ask specific questions about a package and get contextual answers from its metadata
  • In-memory caching — all API responses are cached with TTL to eliminate redundant network calls

Architecture

npm-advisor-mcp/├── package.json                  # Project manifest (ESM, Node 18+)├── tsconfig.json                 # TypeScript strict config (ES2022/Node16)├── mcp-config.json               # Ready-to-use Kiro MCP configuration snippet├── src/│   ├── index.ts                  # MCP server entry point (stdio transport)│   ├── models/│   │   └── types.ts              # Shared interfaces and scoring weights│   ├── services/│   │   ├── cache.ts              # In-memory TTL cache (2/5/10 min tiers)│   │   ├── npm-registry.ts       # registry.npmjs.org client│   │   ├── npm-audit.ts          # npm security advisory API client│   │   ├── bundlephobia.ts       # Bundle size data (bundlephobia.com)│   │   ├── npms-io.ts            # Quality/maintenance/popularity scores│   │   └── scoring.ts            # Weighted recommendation engine + license checker│   └── tools/│       ├── search-packages.ts│       ├── compare-packages.ts│       ├── package-details.ts│       ├── recommend.ts│       ├── resolve-doubt.ts│       ├── audit-package.ts│       ├── find-alternatives.ts│       ├── check-deprecation.ts│       ├── generate-install-command.ts│       └── get-changelog.ts└── dist/                         # Compiled output (generated by `npm run build`)

Prerequisites

  • Node.js 18+ (uses native fetch)
  • npm 9+

No API keys required — all data sources are public and free.


Installation

bash
cd C:\Users\617500221\Projects\AI-Tools\npm-advisor-mcpnpm installnpm run build

Configuration (Kiro MCP)

Add this to your ~/.kiro/settings/mcp.json inside the "mcpServers" object:

json
"npm-advisor": {  "command": "node",  "args": [    "C:\\Users\\617500221\\Projects\\AI-Tools\\npm-advisor-mcp\\dist\\index.js"  ],  "disabled": false,  "autoApprove": [    "search_packages",    "compare_packages",    "get_package_details",    "recommend_package",    "resolve_technical_doubt",    "audit_package",    "find_alternatives",    "check_deprecation",    "generate_install_command",    "get_changelog"  ]}

After saving, the server will appear in the Kiro MCP panel and reconnect automatically.


Tools Reference

1. search_packages

Search npm for packages matching a feature or keyword.

ParameterTypeRequiredDescription
querystringYesFeature or keyword (e.g., "form validation", "state management")
limitnumberNoMax results to return (default: 8, max: 15)

Example prompt:

"Search for packages that handle PDF generation in Node.js"

Returns: Ranked list with description, weekly downloads, gzip size, quality/maintenance/popularity scores, and tree-shaking support.


2. compare_packages

Compare 2–5 packages side-by-side on all key metrics.

ParameterTypeRequiredDescription
packagesstring[]YesArray of package names (2–5 items)

Example prompt:

"Compare dayjs, date-fns, and moment for date manipulation"

Returns: Markdown table with version, gzip size, minified size, downloads/week, TypeScript support, tree-shaking, dependency count, maintenance score, quality score, last publish date, and license.


3. get_package_details

Deep dive into a single package with full metadata.

ParameterTypeRequiredDescription
package_namestringYesThe npm package name

Example prompt:

"Get details about the zod package"

Returns: Version, description, quick stats table (downloads, sizes, deps, TS support, license, publish date), quality scores, dependency list, peer dependencies, links, keywords, and a README excerpt.


4. recommend_package

Get a weighted recommendation from a list of candidates. Scoring weights automatically adjust based on your target environment.

ParameterTypeRequiredDescription
packagesstring[]YesArray of package names to evaluate (2–10)
max_size_kbnumberNoMax acceptable gzip size in KB — packages exceeding this get penalized
require_typescriptbooleanNoIf true, packages without TS types are penalized more
use_casestringNobrowser, node, react, cli, or general — adjusts scoring weights

Example prompt:

"Recommend a date library from dayjs, date-fns, moment, and luxon for a browser app — must be under 10KB gzipped"

Returns: Winner with rationale, runner-up alternatives, a detailed score breakdown table, and a license compatibility column.

Default Scoring Weights (general)
CriterionWeightWhat it measures
Bundle size (gzip)25%Smaller is better; relative within comparison group
Weekly downloads20%Community adoption (log-scaled)
Maintenance20%npms.io maintenance score
TypeScript support15%Built-in types (100) > @types (60) > none (20)
Dependency count10%Fewer runtime deps = less risk
Freshness10%More recently published = better
Use Case Weight Adjustments
Criterionbrowsernodereactcli
Bundle size40%10%30%5%
Downloads15%20%20%20%
Maintenance15%25%15%30%
TypeScript15%15%20%10%
Dependencies10%20%10%20%
Freshness5%10%5%15%

5. resolve_technical_doubt

Answer a specific technical question about a package.

ParameterTypeRequiredDescription
package_namestringYesThe npm package name
questionstringYesYour technical question

Example prompts:

"Does dayjs support timezone conversion out of the box?" "Is lodash tree-shakeable?" "What are the peer dependencies of @angular/material?" "Is chalk still actively maintained?"

Returns: Contextual answer pulling from metadata, bundle analysis, dependency tree, scores, and README content. Automatically detects question category (size, TypeScript, dependencies, maintenance, tree-shaking) and surfaces relevant data.


6. audit_package

Check a package for known security vulnerabilities.

ParameterTypeRequiredDescription
package_namestringYesThe npm package name to audit

Example prompt:

"Are there any known vulnerabilities in lodash?"

Returns: Total vulnerability count, severity breakdown (critical/high/moderate/low), per-CVE details with affected version ranges, patch availability, advisory links, and a deprecation warning if applicable.


7. find_alternatives

Find similar or competing packages as alternatives to a given one.

ParameterTypeRequiredDescription
package_namestringYesThe package to find alternatives for
limitnumberNoMax alternatives to return (default: 6, max: 10)

Example prompts:

"Find alternatives to moment.js" "What can I use instead of request?"

Returns: Ranked list of alternatives with descriptions, weekly downloads, bundle sizes, quality scores, and tree-shaking support. Flags if the original package is deprecated.


8. check_deprecation

Detect if a package is deprecated, unmaintained, or potentially abandoned.

ParameterTypeRequiredDescription
package_namestringYesThe npm package name to check

Example prompts:

"Is request still maintained?" "Is moment.js deprecated?"

Returns: npm deprecation flag, days since last publish, maintenance score, weekly downloads, and a clear verdict — actively maintained / moderately stale / potentially abandoned / officially deprecated.


9. generate_install_command

Generate ready-to-paste install commands across all major package managers.

ParameterTypeRequiredDescription
package_namestringYesThe npm package name
include_peer_depsbooleanNoInclude peer dependencies (default: true)
devbooleanNoInstall as a dev dependency (default: false)

Example prompts:

"Give me the install command for @tanstack/react-query" "How do I install eslint as a dev dependency with pnpm?"

Returns: Install commands for npm, yarn, pnpm, and bun. Automatically appends peer dependencies and adds a separate @types/ install block if the package lacks built-in TypeScript types.


10. get_changelog

Fetch recent release notes for a package from its git repository. Supports GitHub, GitLab (cloud and self-hosted), and Bitbucket.

ParameterTypeRequiredDescription
package_namestringYesThe npm package name
limitnumberNoNumber of recent releases to show (default: 5, max: 10)

Example prompts:

"What changed in the last few versions of zod?" "Show me the recent releases for vite" "What's new in @ATLAS/info-panel?"

Returns: Release history with version tags, publish dates, and formatted release notes (truncated at 800 chars per release).

Git host detection

The tool reads the repository field from the package's package.json and auto-detects the host:

Pattern in repository URLDetected asAPI used
github.com/...GitHubGitHub Releases API
gitlab.com/...GitLab cloudGitLab Releases API
gitlab.yourcompany.com/...Self-hosted GitLabGitLab Releases API (same path, different base URL)
git.yourcompany.com/...Self-hosted GitLabGitLab Releases API
bitbucket.org/...BitbucketBitbucket Tags API
None of the above—Falls back to npm versions page link

Note for private/internal packages: The tool reads the repository field from the package metadata fetched from your registry. If your internal package.json doesn't include a repository field, or uses an SSH URL like git@internal-git:atlas/info-panel without a recognisable hostname, the tool won't be able to detect the host. Add a full HTTPS URL to fix this:

json
"repository": "https://gitlab.yourcompany.com/atlas/info-panel"

11. check_registry (diagnostic)

Shows which registry URL and auth credentials the server resolves for a given package name, based on ~/.npmrc. Run this first when debugging private registry access.

ParameterTypeRequiredDescription
package_namestringYesThe package name to check resolution for

Example prompt:

"Check registry for @ATLAS/info-panel"

Returns: Resolved registry URL, whether an auth token was found, and guidance if it's resolving to the public registry unexpectedly.


Data Sources

APIBase URLWhat it providesAuth
npm Registryresolved from .npmrc (default: registry.npmjs.org)Package metadata, versions, README, deps, deprecationVia .npmrc
npm Downloadsapi.npmjs.org/downloadsWeekly download countsNone
npm Auditresolved from .npmrc + /-/npm/v1/security/auditsKnown CVEs and advisoriesVia .npmrc
npms.ioapi.npms.io/v2Search + quality/maintenance/popularity scoresNone
Bundlephobiabundlephobia.com/apiMinified size, gzip size, tree-shaking, side effectsNone
GitHub APIapi.github.comRelease notes and changelogNone
GitLab APIgitlab.com/api/v4 or self-hosted /api/v4Release notes and changelogNone (public) / token if private
Bitbucket APIapi.bitbucket.org/2.0Tags used as release historyNone

All requests include timeouts (10–15s) and graceful fallbacks — if one API is slow or unavailable, the tool still returns partial results rather than failing. Responses are cached in-memory to avoid redundant calls within a session.


Private Registry Support (.npmrc)

The server reads ~/.npmrc directly to resolve the registry URL and auth token for each package. No shell subprocess is involved — it parses the file the same way npm does, so it works regardless of how the MCP server process was spawned.

This means scoped private packages like @your-company/some-lib work out of the box as long as your .npmrc is configured correctly — for example:

ini
@ATLAS:registry=https://your-company-registry.example.com///your-company-registry.example.com/:_authToken=your-token

Scope names in .npmrc are matched case-insensitively — @ATLAS, @atlas, and @Atlas all match the same entry.

Registry resolution logic

For every package fetch, the server:

  1. Reads ~/.npmrc and looks for a scoped registry override matching the package scope (e.g. @ATLAS:registry=...)
  2. If found, uses that registry URL with the corresponding auth token
  3. If not found, uses the default registry value from .npmrc (or registry.npmjs.org if not set)
  4. If the resolved registry fails and it wasn't already the public registry, automatically retries against registry.npmjs.org — so public packages always work even if a custom default registry is configured

Use the check_registry tool to verify what registry and auth the server resolves for any package before running other tools.

Public vs private package support

SourcePublic packagesPrivate registry packages
Registry metadata✅ Full✅ Full (via .npmrc auth)
Weekly downloads✅✅ (npm downloads API is public)
Bundle size✅❌ Bundlephobia only indexes public npm
npms.io scores✅❌ npms.io only indexes public npm
Security audit✅⚠️ Also checks public npm advisory DB as fallback
Changelog✅ GitHub / GitLab / Bitbucket✅ If repository field has a full HTTPS URL

For private packages, tools that depend on bundlephobia or npms.io (search_packages, find_alternatives, bundle size in comparisons) will show N/A for those fields but will still return all registry metadata correctly.


Caching

All API responses are cached in-memory with tiered TTLs:

TierTTLUsed for
Short2 minDownload counts, npms.io scores, search results
Medium5 minnpm registry metadata, GitHub releases
Long10 minBundle sizes, security audit results

The cache is process-scoped — it resets when the MCP server restarts.


Development

bash
# Watch mode (recompiles on save)npm run dev
# Single buildnpm run build
# Run directlynpm start

Project Scripts

ScriptCommandDescription
buildtscCompile TypeScript to dist/
startnode dist/index.jsRun the MCP server
devtsc --watchWatch mode for development

Tech Stack

TechnologyVersionPurpose
Node.js18+Runtime (native fetch)
TypeScript~5.5Type safety
@modelcontextprotocol/sdk^1.12MCP server framework
zod^3.23Schema validation for tool inputs

Zero runtime dependencies beyond the MCP SDK and zod. No database, no external auth.


How It Works

  1. User asks a question in Kiro (e.g., "find me a library for CSV parsing")
  2. Kiro routes to the appropriate tool based on the prompt
  3. The tool checks the in-memory cache — returns instantly if data is fresh
  4. On cache miss, fetches live data from npm registry, npms.io, bundlephobia, and GitHub in parallel
  5. Results are scored, formatted, and returned as structured markdown
  6. Kiro presents the answer in the chat with tables, scores, and actionable recommendations

The server runs as a stdio process — Kiro spawns it on demand and communicates via JSON-RPC over stdin/stdout.


Extending

To add a new tool:

  1. Create src/tools/your-tool.ts with a handler function
  2. Register it in src/index.ts using server.tool(name, description, zodSchema, handler)
  3. Add the tool name to autoApprove in mcp-config.json
  4. Rebuild: npm run build

To add a new data source:

  1. Create src/services/your-source.ts with fetch functions
  2. Wrap responses with cache.set / cache.get from services/cache.ts
  3. Import and use it in the relevant tool handlers
  4. Add timeout + graceful fallback for resilience

Troubleshooting

IssueSolution
Server doesn't appear in KiroCheck mcp.json path is correct; ensure dist/index.js exists
"Cannot find module" errorsRun npm run build after any source changes
Timeout errors from APIsNormal behind corporate proxies — results will be partial
Bundle size shows "N/A"Bundlephobia can't analyze all packages (native addons, etc.)
Audit returns no resultsnpm advisory API may not have data for that package version
Changelog shows no releasesPackage may not use GitHub/GitLab releases, or repository field is missing/SSH-only in package.json
Private package returns "not found"Run check_registry to verify the registry URL and auth token are resolving correctly from ~/.npmrc
check_registry shows wrong registryCheck ~/.npmrc has @SCOPE:registry=https://... and //host/:_authToken=... entries

If running behind a corporate proxy that intercepts HTTPS (e.g., Zscaler), add your corporate CA certificate to the MCP config:

json
"env": {  "NODE_EXTRA_CA_CERTS": "C:\\path\\to\\your\\corporate-ca.pem"}

This is the recommended fix. Node's native fetch does not respect NODE_TLS_REJECT_UNAUTHORIZED=0 in all cases, and disabling TLS verification entirely is a security risk. Using NODE_EXTRA_CA_CERTS adds your corporate CA to Node's trust store without disabling verification for everything else.

To find your corporate CA cert path, check with your IT team or look in your system certificate store. On Windows it is typically exported from certmgr.msc → Trusted Root Certification Authorities.

If you also need an explicit proxy:

json
"env": {  "NODE_EXTRA_CA_CERTS": "C:\\path\\to\\your\\corporate-ca.pem",  "HTTPS_PROXY": "http://your-proxy:8080"}

License

ISC

來源:npm-advisor-mcp/README.md,提交 d6f033d

工具

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

版本歷史

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

評分

已滿足適用檢查項的 40%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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

    請在儲存庫或註冊中心條目中宣告授權條款。