locklens

locklens

Audits package lockfiles for vulnerabilities, supporting npm, yarn, and pnpm. Runs via CLI or as an MCP server over stdio.

Category
Visit Server

README

locklens

locklens 是一个基于 audit-ci 的 lockfile 审计工具,支持三种运行模式:

  • CLI / npx
  • MCP Server(stdio
  • Skill

它可以审计本地项目目录或远程 Git 仓库,并支持 npmyarnpnpm 的 lockfile。


特性

  • 支持本地项目目录与远程 Git 仓库审计
  • 支持公开仓库与私有仓库审计
  • 支持 package-lock.jsonyarn.lockpnpm-lock.yaml
  • 仅基于仓库中已存在的 lockFile 进行审计,保证结果与真实依赖状态一致
  • 支持中文、英文文本报告
  • 支持显式切换为 JSON 输出

环境要求

  • Node >=18
  • (Optional) Yarn ^1.12.3 || Yarn >=2.4.0 && <4.0.0
  • (Optional) PNPM >=4.3.0
  • (Optional) Bun

结果示例

可以直接查看仓库内的示例输出:


安装与环境

本地仓库、线上仓库审计:

# 本地相对目录审计
npx -y locklens --source ./
# 本地绝对目录审计
npx -y locklens --source /path/to/project 
# Github 远程仓库审计
npx -y locklens --source https://github.com/BARMPlus/micro-app > audit.md
# Gitlab 远程仓库审计
npx -y locklens --output-format json --source https://gitlab.com/gitlab-org/gitlab-vscode-extension.git > audit.json 

私有仓库审计:

# 对于 GitHub、GitLab、Gitee 的 HTTPS 地址,locklens 会先尝试通过 ssh -T 判断本机 SSH Key 是否可用于该 Git 服务器;
# 如果可用,会自动切换为 SSH 方式执行。其他私有 Git 服务器仍建议直接依赖本机已有权限的 SSH Key。
npx -y locklens --source https://git.company.local/group/repo.git
# 适合 CI 场景,仅支持 私有部署的 GitLab 服务器应用审计,设置 Personal access tokens 权限访问该仓库
LOCKLENS_GITLAB_PRIVATE_TOKEN=your-token npx -y locklens --source https://git.company.local/group/repo.git 

CLI 使用方法

常见示例

输出英文文本报告:

npx -y locklens --source /path/to/project --output-format-language en

输出 JSON:

npx -y locklens --source /path/to/project --output-format json

指定阈值为高危:

npx -y locklens --source /path/to/project --threshold high

跳过 devDependencies:

npx -y locklens --source /path/to/project --skip-dev

CLI 参数

参数 说明
--source <value> 必填。本地目录路径或远程 Git 仓库地址
--threshold <value> 漏洞过滤阈值,可选:lowmoderatehighcritical,默认:low
--registry <url> 自定义 npm registry,默认:https://registry.npmjs.org/
--skip-dev 跳过 dev dependencies
--retry-count <number> 审计执行重试次数
--output-format <value> 输出格式,可选:jsontext,默认:text
--output-format-language <value> 文本报告语言,可选:zhen,默认:zh
--help / -h 显示帮助
--version / -v 显示版本号

MCP 使用方法

locklens 支持通过 stdio 方式作为 MCP Server 接入,通过将以下配置添加到mcp服务器配置中。

Windows 平台:

{
  "mcpServers": {
    "locklens": {
      "command": "cmd",
      "args": ["/c", "npx", "--yes", "locklens"]
    }
  }
}

其他平台:

{
  "mcpServers": {
    "locklens": {
      "command": "npx",
      "args": ["--yes", "locklens"]
    }
  }
}

Tools

package_audit

审计指定项目目录或远程 Git 仓库的 lockfile,并返回统一格式的漏洞结果。

参数:

  • source
    • 必填。本地目录绝对路径,或远程 Git 仓库地址
  • threshold
    • 漏洞过滤阈值,可选:lowmoderatehighcritical;默认:low
  • registry
    • 自定义 npm registry 地址;默认:https://registry.npmjs.org/
  • skipDev
    • 是否跳过 dev dependencies
  • retryCount
    • 审计执行重试次数
  • outputFormat
    • 输出格式,可选:textjson;默认:text
  • outputFormatLanguage
    • 文本报告语言,可选:zhen;默认:zh

Skill

如果你的客户端支持 Skill,也可以直接使用 dependency-audit,不需要先接入 MCP。

当前仓库内的 Skill 目录位于:

dependency-audit/

默认会带上 --skip-dev,优先只带出线上风险;如果你希望带出开发和线上所有依赖风险,可以明确说明取消 --skip-dev

示例:

1. 使用 dependency-audit 审计当前项目的依赖问题
2. https://github.com/BARMPlus/micro-app 审计这个项目的依赖,告知我开发和线上所有的依赖问题
3. 输出 https://github.com/BARMPlus/micro-app 这个项目严重的依赖问题

License

Copyright (c) 2026 chenglin

locklens is released under the MIT License

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured