safe-audit-fix
Provides tools for scanning npm vulnerabilities, planning fixes, and safely applying them with automatic rollback on test failure.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@safe-audit-fixsafely fix the vulnerabilities in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
safe-audit-fix
Fix npm vulnerabilities without breaking your app.
npm audit fix --force can silently jump major versions, downgrade packages, and break your build. safe-audit-fix takes the opposite approach — like a careful surgeon instead of a sledgehammer:
Plan first — every fix is risk-labeled (
low/moderate/high-breaking) before anything changes.One fix at a time — never a big-bang change.
Test after every fix — your own test command runs after each step.
Auto-revert — if install or tests fail, that fix is instantly undone (package.json + lockfile restored, node_modules re-synced).
Breaking upgrades are opt-in — major-version jumps are skipped unless you pass
--include-major, and even then they are test-protected.Full undo —
safe-audit-fix revertrestores everything from before the run.
It works two ways from one shared engine:
┌────────────────────┐
you ──────────► CLI │
├────────────────────┤──► core engine: scan → plan → fix one → test → keep/revert
AI assistant ─► MCP server │
(Claude Code, └────────────────────┘
Cursor, ...)Requirements
Node.js ≥ 18, npm ≥ 7 (needs the modern
npm audit --jsonformat)A
package-lock.jsonin the target project (runnpm installonce if missing)
Related MCP server: locklens
Install
Try it instantly — no install (run inside your project folder):
npx safe-audit-fix scan
npx safe-audit-fix fixOr install globally:
npm install -g safe-audit-fix
safe-audit-fix scanOr from source:
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 globallyCLI usage
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 runAll commands accept --dir <path> to target another project, and scan/plan accept --json.
Before any fix is applied, your tests are run once as a baseline — if they already fail, the tool refuses to start (otherwise every fix would be wrongly blamed and reverted).
MCP server (use it from Claude Code, Cursor, etc.)
Register the server, then just ask your AI assistant: "safely fix the vulnerabilities in my project".
Claude Code:
claude mcp add safe-audit-fix -- npx -y --package=safe-audit-fix safe-audit-fix-mcpOr via .mcp.json / MCP config file:
{
"mcpServers": {
"safe-audit-fix": {
"command": "npx",
"args": ["-y", "--package=safe-audit-fix", "safe-audit-fix-mcp"]
}
}
}(If you installed globally, you can use safe-audit-fix-mcp directly as the command instead of npx.)
Exposed tools:
Tool | What it does | Changes files? |
| Structured audit report | No |
| Ordered, risk-labeled fix plan | No |
| The fix-test-revert loop ( | Yes |
| Undo the last fix run | Yes |
How it compares
|
| Asking an AI in chat | safe-audit-fix | |
Fixes in-range vulns | ✅ | ✅ | manual | ✅ |
Fixes breaking (major) vulns | ❌ | ✅ silently | manual | ✅ opt-in |
Runs your tests after each change | ❌ | ❌ | ❌ | ✅ |
Auto-reverts a bad fix | ❌ | ❌ | ❌ | ✅ |
Shows a risk-labeled plan first | ❌ | ❌ | ⚠️ | ✅ |
One-command full undo | ❌ | ❌ | ❌ | ✅ |
Usable by AI assistants (MCP) | ❌ | ❌ | — | ✅ |
Library usage
The engine is importable directly:
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);Roadmap
--explain: use an LLM to summarize the changelog/breaking changes of a planned major upgradeReachability analysis: skip vulnerabilities whose vulnerable code path is never called from your code
Automatic
overridessuggestions for transitive vulnerabilities with no parent fixSupport for pnpm / yarn
License
MIT
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseBqualityFmaintenanceAudits npm package dependencies for security vulnerabilities, providing detailed reports and fix recommendations with MCP integration.14656MIT
- AlicenseBqualityDmaintenanceAudits package lockfiles for vulnerabilities, supporting npm, yarn, and pnpm. Runs via CLI or as an MCP server over stdio.11685MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that scans project dependencies for security vulnerabilities (CVEs) and provides fix instructions directly in VS Code via Copilot.3
- AlicenseAqualityCmaintenanceMCP server that audits npm dependencies against the live registry, providing per-dependency reports on versions behind, deprecation, and license.28MIT
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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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