npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-vulnerability-checker

v1.0.1

Published

A modular Model Context Protocol (MCP) server providing comprehensive security vulnerability intelligence tools

Readme

mcp-vulnerability-checker

一个基于 Model Context Protocol (MCP) 的前端工程安全审计服务。通过 stdio 启动为 MCP 服务器,提供一组可组合的工具:从解析项目(本地/远程仓库)、生成锁文件,到执行依赖漏洞审计并渲染为 Markdown 报告。

功能特性

  • 解析本地路径或远程 GitHub 仓库,生成标准 package.json(无需克隆完整仓库)
  • 生成锁文件(隔离环境,便于稳定审计)
  • 统一封装 npm audit 并标准化结果结构
  • 渲染为可读性良好的 Markdown 漏洞报告
  • 实用的文件写入与临时工作目录管理工具

运行环境

  • Node.js >= 18.18
  • Windows/Linux/macOS 均可

安装与构建

# 安装依赖
npm install

# 构建(产物位于 build/)
npm run build

# 以独立方式启动(便于本地调试 stdout/stderr)
node build/index.js

# 或:清理并启动
npm run start

在 Cursor(或任何 MCP 客户端)中使用

方式一:使用 npm 包(推荐)

该工具已发布到 npm,可通过 npx 直接使用。以 Cursor 为例,创建/修改 ~/.cursor/mcp.json(Windows: C:\Users\<你用户名>\.cursor\mcp.json):

{
  "mcpServers": {
    "mcp-vulnerability-checker": {
      "command": "npx",
      "args": ["-y", "mcp-vulnerability-checker"]
    }
  }
}

方式二:本地构建使用

如果你想使用本地构建版本,可以这样配置:

{
  "mcpServers": {
    "mcp-vulnerability-checker": {
      "command": "node",
      "args": ["D:\\Codes\\MCP\\learn-project\\mcp-vulnerability-checker\\build\\index.js"]
    }
  }
}

保存配置后重启 Cursor,助手即可发现并调用以下工具。

提供的工具(Tools)

  • createWorkDir

    • 功能:在指定基路径下创建唯一工作目录
    • 入参:basePath: string
    • 返回:工作目录绝对路径
  • parseProject

    • 功能:解析本地路径或远程仓库 URL,返回 package.json 字符串
    • 入参:projectRoot: string
    • 返回:package.json 的 JSON 字符串
  • generateLock

    • 功能:根据 package.json 在工作目录生成锁文件
    • 入参:workDir: string, packageJson: string
    • 返回:ok
  • auditDependencies

    • 功能:执行依赖审计并返回规范化结果 JSON 字符串
    • 入参:workDir: string, packageJson: string
    • 返回:标准化的审计结果 JSON 字符串
  • renderAuditReport

    • 功能:将审计结果与 package.json 渲染为 Markdown 文本
    • 入参:auditResult: string, packageJson: string
    • 返回:Markdown 文本
  • writeFile

    • 功能:写入内容至目标路径(自动创建父目录)
    • 入参:targetPath: string, content: string
    • 返回:目标文件绝对路径
  • deleteWorkDir

    • 功能:删除指定工作目录
    • 入参:workDir: string
    • 返回:ok

典型工作流示例:审计远程仓库并保存报告

以下示例展示如何审计 [email protected],并将报告保存到指定目录。该流程可在任何 MCP 客户端内通过依次调用工具实现。

  1. 创建工作目录
  • 调用:createWorkDir
  • 入参:basePath = D:\\Codes\\MCP\\learn-project\\mcp-vulnerability-checker\\work
  • 返回:例如 D:\\...\\workdir_XXXXXXXXXXXX
  1. 解析远程仓库,获取 package.json
  • 调用:parseProject
  • 入参:projectRoot = https://github.com/webpack/webpack-dev-server/tree/v4.9.3
  • 返回:package.json 字符串
  1. 生成锁文件
  • 调用:generateLock
  • 入参:workDir(步骤 1 返回)与 packageJson(步骤 2 返回)
  1. 执行依赖审计
  • 调用:auditDependencies
  • 入参:同上,返回标准化审计结果 JSON 字符串
  1. 渲染 Markdown 报告
  • 调用:renderAuditReport
  • 入参:auditResult(步骤 4 返回)、packageJson(步骤 2 返回)
  1. 写入报告文件
  • 调用:writeFile
  • 入参:
    • targetPath = D:\\Codes\\MCP\\learn-project\\mcp-vulnerability-checker\\work\\<your-report-name>.md
    • content =(步骤 5 返回的 Markdown)
  1. 清理临时目录(可选)
  • 调用:deleteWorkDir

注:你也可以将上述步骤封装到你自己的自动化脚本或助手提示词中,作为“一键审计”。

开发生命令

{
  "scripts": {
    "dev": "tsc -w",
    "clean": "rimraf build",
    "build": "tsc && node -e \"try{require('fs').chmodSync('build/index.js',0o755)}catch(e){}\"",
    "start": "npm run clean && npm run build && node build/index.js"
  }
}

许可协议

  • ISC

维护者

  • liuhang