Skip to main content
Glama

safe-audit-fix

npm version license M8ven Score safe-audit-fix MCP server Sponsor

npmの脆弱性を、アプリを壊さずに修正します。

npm audit fix --force は、メジャーバージョンへの更新、パッケージのダウングレードを黙って行い、ビルドを壊してしまうことがあります。safe-audit-fix はその逆のアプローチを取ります。大ハンマーではなく、慎重な外科医のように:

  1. 先に計画 — すべての修正は、変更前にリスクラベル(low / moderate / high-breaking)が付けられます。

  2. 一度に1つの修正 — すべてを一度に変更するビッグバン方式は行いません。

  3. 修正のたびにテスト — 各ステップの後に、あなた自身のテストコマンドが実行されます。

  4. 自動で元に戻す — インストールまたはテストが失敗した場合、その修正は即座に取り消されます(package.json + lockfile が復元され、node_modules が再同期されます)。

  5. 破壊的なアップグレードはオプトイン--include-major を渡さない限りメジャーバージョンジャンプはスキップされ、渡した場合でもテストによって保護されます。

  6. 完全な元に戻しsafe-audit-fix revert で、実行前の状態をすべて復元できます。

1つの共有エンジンから、2つの方法で利用できます:

                 ┌────────────────────┐
   you ──────────►      CLI            │
                 ├────────────────────┤──► core engine: scan → plan → fix one → test → keep/revert
   AI assistant ─►   MCP server        │
   (Claude Code, └────────────────────┘
    Cursor, ...)

要件

  • Node.js ≥ 18、npm ≥ 7(新しい npm audit --json 形式が必要)

  • 対象プロジェクトに package-lock.json があること(ない場合は、一度 npm install を実行してください)

Related MCP server: locklens

インストール

すぐに試す — インストール不要(プロジェクトフォルダ内で実行):

npx safe-audit-fix scan
npx safe-audit-fix fix

またはグローバルにインストール:

npm install -g safe-audit-fix
safe-audit-fix scan

またはソースから:

git clone https://github.com/pasindudilshan1/safe-audit-fix.git
cd safe-audit-fix
npm install
npm link        # makes the `safe-audit-fix` command available globally

CLI の使い方

safe-audit-fix scan                 # show vulnerabilities + whether each fix is safe or breaking
safe-audit-fix plan                 # show the ordered fix plan (changes nothing)
safe-audit-fix fix                  # apply fixes one at a time, testing after each
safe-audit-fix fix --include-major  # also attempt breaking upgrades (test-protected)
safe-audit-fix fix --dry-run        # preview only
safe-audit-fix fix --test "npm run test:unit"   # custom verify command
safe-audit-fix fix --no-test        # skip test verification (install failures still revert)
safe-audit-fix revert               # undo the entire last fix run

すべてのコマンドは --dir <path> で別のプロジェクトをターゲットにでき、scan / plan--json にも対応しています。

修正を適用する前に、テストがベースラインとして一度実行されます。もしその時点でテストが失敗していれば、ツールは開始を拒否します(そうしないと、すべての修正が誤って原因とみなされて元に戻されてしまうためです)。

MCP サーバー(Claude Code、Cursor などで利用)

サーバーを登録して、AI アシスタントに "私のプロジェクトの脆弱性を安全に修正して" と頼むだけです。

Claude Code:

claude mcp add safe-audit-fix -- npx -y --package=safe-audit-fix safe-audit-fix-mcp

または .mcp.json / MCP 設定ファイル経由:

{
  "mcpServers": {
    "safe-audit-fix": {
      "command": "npx",
      "args": ["-y", "--package=safe-audit-fix", "safe-audit-fix-mcp"]
    }
  }
}

(グローバルにインストールした場合は、npx の代わりに safe-audit-fix-mcp をコマンドとして直接使うことができます。)

公開されているツール:

ツール

説明

ファイルを変更するか

scan_vulnerabilities

構造化された監査レポート

なし

plan_fixes

リスクラベル付きの修正計画を順序付けして表示

なし

apply_fixes_safely

修正 → テスト → 元に戻す、のループ(dryRunincludeMajortestCommand オプション)

あり

revert_last_session

最後に行った修正を元に戻す

あり

比較

npm audit fix

npm audit fix --force

チャットでAIに依頼

safe-audit-fix

範囲内の脆弱性を修正

手動

破壊的な(メジャー)脆弱性を修正

✅ 黙って

手動

✅ オプトイン

変更のたびにテストを実行

失敗した修正を自動で元に戻す

最初にリスクラベルの計画を表示

⚠️

ワンコマンドで完全に元に戻す

AI アシスタントが使える(MCP)

ライブラリとしての利用

エンジンを直接インポートできます:

import { scan, planFix, fixAll, revertSession } from 'safe-audit-fix';

const result = fixAll('/path/to/project', { includeMajor: false });
console.log(result.applied, result.failed, result.blocked);

ロードマップ

  • --explain: LLM を使って、予定されているメジャーアップグレードの変更ログ / 破壊的な変更をまとめる

  • 到達可能性分析: 脆弱なコードパスがあなたのコードから一度も呼び出されない脆弱性をスキップする

  • 修正手段のない間接的な脆弱性に対して、overrides を自動提案する

  • pnpm / yarn のサポート

ライセンス

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.

  • Scans MCP servers for tool poisoning, prompt injection and supply chain risks.

  • Scan any public GitHub MCP-server repo for security issues. 37 MCP-specific L1 rules, 8 languages.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pasindudilshan1/safe-audit-fix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server