mcp-lock
mcp-lock
npm ci für Ihre MCP-Server.
Jedes Mal, wenn Ihr KI-Coding-Tool startet, lädt
npx -y @scope/mcp-serverstillschweigend die neueste Version jedes MCP-Servers herunter. Keine Versionsfixierung. Keine Hash-Prüfung. Keine Aufzeichnung dessen, was gestern lief.
mcp-lockbehebt dies. Es zeichnet beim ersten Ausführen die exakte Version und den Tarball-Integritäts-Hash jedes MCP-Servers auf und überprüft bei jedem nachfolgenden Ausführen, ob sich etwas geändert hat.
Das Problem
// Your .mcp.json — right now
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem"]
// ^^^
// Downloads whatever is latest. Every. Single. Time.
}
}
}Der Supply-Chain-Angriff auf axios im März 2026 kompromittierte ein Minor-Versions-Update (1.14.1). Jeder, der ^1.14.0 verwendete, führte stillschweigend ein automatisches Upgrade durch. Die Malware lief, bevor es jemand bemerkte.
MCP-Server sind demselben Risiko ausgesetzt. Sie sind npm-Pakete. Sie laufen mit Ihren Anmeldedaten. Sie greifen auf Ihr Dateisystem und Ihre APIs zu. Und kein existierender Scanner verfolgt, ob das Paket, das Sie heute ausführen, dasselbe ist, das Sie letzte Woche überprüft haben.
Related MCP server: mcp-shield
Installation & Schnellstart
# 1. Lock all your MCP servers (one time)
npx @mcpguards/mcp-lock init
# 2. Commit the lockfile
git add .mcp.lock && git commit -m "chore: add mcp-lock lockfile"
# 3. Verify on every CI run (exits 1 if anything changed)
npx @mcpguards/mcp-lock verifyDas ist alles. Wenn sich ein Paket zwischen den Ausführungen ändert, wissen Sie es, bevor Ihr KI-Agent es ausführt.
Befehle
mcp-lock init
Erkennt alle MCP-Konfigurationen auf Ihrem Computer, löst jeden Server zu seinem npm-Paket auf und zeichnet die exakte Version + Tarball-Integritäts-Hash auf.
$ mcp-lock init
Found 4 server(s) across 2 config(s)
✔ filesystem 2026.1.1 sha512-xK3z… ✔ attestation
✔ github 2026.1.1 sha512-9mRq… ✔ attestation
✔ memory 2025.11.18 sha512-pL2t… ○ no attestation
~ python-server pypi registry — not lockable
─────────────────────────────────────────────────────────────────
3 locked 1 skipped
✔ Lockfile written to .mcp.lock
Tip: Run with --pin to add version pins to your MCP configs.Optionen:
--config <path> Scan a specific config file
--pin Rewrite configs to add @version pins
--force Overwrite existing lockfile
--global Write to ~/.mcp.lockmcp-lock verify
Vergleicht Ihre installierten Pakete mit der Lockfile. Beendet den Prozess mit 1, falls sich etwas geändert hat.
$ mcp-lock verify
mcp-lock .mcp.lock
────────────────────────────────────────────────────────────────
✔ filesystem
✔ github
⚠ memory INTEGRITY-CHANGED
integrity sha512-pL2t… → sha512-XXXX…
version 2025.11.18 → 2025.11.19
ACTION REQUIRED: Run `mcp-lock update memory` after manual review.
────────────────────────────────────────────────────────────────
2 clean 1 changed 0 skipped
✖ 1 server(s) changed since last lock.
Run 'mcp-lock update <server>' to review and accept changes.Optionen:
--sarif <path> Write SARIF 2.1.0 report for GitHub Security tab
--json Output as JSON
--global Check against ~/.mcp.lockExit-Codes:
Code | Bedeutung |
| Sauber – alle Server stimmen mit der Lockfile überein |
| Geändert – ein oder mehrere Server wurden geändert oder die Lockfile wurde manipuliert |
| Lockfile fehlt – führen Sie |
| Netzwerk- / Registry-Fehler |
| Ungültige Argumente |
mcp-lock update <server>
Zeigt genau an, was sich geändert hat, bittet um Bestätigung und aktualisiert die Lockfile.
$ mcp-lock update memory
memory
version 2025.11.18 → 2025.11.19
integrity sha512-pL2t… →
sha512-XXXX…
Accept update for memory? [y/N] y
✔ Updated 1 server(s) in .mcp.lockOptionen:
--all Update all servers
--to <version> Update to a specific version
--yes Skip confirmation prompt (for CI)
--pin Also update version pin in the MCP configmcp-lock list
Zeigt alle gesperrten (locked) Server an.
$ mcp-lock list
mcp-lock list scope: project
────────────────────────────────────────────────────────────────
✔ filesystem @modelcontextprotocol/server-filesystem 2026.1.1
✔ github @modelcontextprotocol/server-github 2026.1.1
○ memory @modelcontextprotocol/server-memory 2025.11.18
────────────────────────────────────────────────────────────────
3 servers generated 4/16/2026GitHub Action
Fügen Sie dies zu jedem Repository hinzu, das eine .mcp.json-Konfiguration hat. Lässt den PR fehlschlagen, wenn ein Server ohne ein explizites mcp-lock update geändert wurde:
# .github/workflows/mcp-lock.yml
name: MCP Lock
on: [push, pull_request]
jobs:
verify:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # for SARIF upload
steps:
- uses: actions/checkout@v4
- uses: mcpguards/mcp-lock@v0.1.1
with:
sarif-output: mcp-lock.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: mcp-lock.sarifErgebnisse erscheinen im Tab Security → Code Scanning:
mcp-lock: server 'memory' integrity changed
The tarball integrity hash changed since last lock.
Run: mcp-lock update memoryAction-Inputs:
Input | Standard | Beschreibung |
| (automatische Erkennung) | Pfad zur MCP-Konfiguration |
|
| Fehler, wenn keine Lockfile existiert |
| (keiner) | Pfad zum Schreiben des SARIF-Berichts |
Die Lockfile
.mcp.lock ist eine JSON-Datei, die Sie in Ihr Repository einchecken. Sie zeichnet auf:
{
"lockfileVersion": 1,
"generatedBy": "mcp-lock@0.1.0",
"generatedAt": "2026-04-16T12:00:00.000Z",
"scope": "project",
"servers": {
"filesystem": {
"source": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem"],
"configPath": "/abs/path/.mcp.json"
},
"resolved": {
"registry": "npm",
"name": "@modelcontextprotocol/server-filesystem",
"version": "2026.4.10",
"tarball": "https://registry.npmjs.org/...tgz",
"integrity": "sha512-AbC...==",
"shasum": "a1b2c3...",
"publishedAt": "2026-04-10T09:12:33.000Z"
},
"attestation": {
"present": true,
"predicateTypes": ["https://slsa.dev/provenance/v1"]
},
"lockedAt": "2026-04-16T12:00:00.000Z"
}
},
"checksum": "sha256-9f86d081..."
}Das Feld checksum ist ein SHA-256-Hash des gesamten Lockfile-Inhalts (kanonisches JSON, sortierte Schlüssel). Wenn die Datei manuell bearbeitet wird, ohne mcp-lock update auszuführen, wird verify dies erkennen.
Unterstützte MCP-Clients
Automatisch auf Ihrem Computer erkannt:
Client | Konfigurationspfad |
Claude Desktop (macOS) |
|
Claude Code |
|
Cursor |
|
VS Code |
|
Windsurf |
|
Amazon Q |
|
Projektebene |
|
Wie es sich von anderen Tools unterscheidet
Tool | Prüft npm-Pakete | Integritäts-Hash | Erkennt Versionsänderungen | SBOM | Lockfile |
Snyk Agent Scan | ❌ | ❌ | ❌ | ❌ | ❌ |
Cisco mcp-scanner | ❌ | ❌ | ❌ | ❌ | ❌ |
MCPWatch | ❌ | ❌ | ❌ | ❌ | ❌ |
mcp-lock | ✅ | ✅ | ✅ | ✅ | ✅ |
Die anderen scannen Tool-Beschreibungen und Konfigurationen auf Prompt-Injection. mcp-lock behandelt MCP-Server als Artefakte der Software-Lieferkette und wendet eine Paket-Integritätsprüfung an – denselben Ansatz, den npm ci verwendet.
Anforderungen
Node.js >= 18.3.0
Funktioniert mit Claude Code, Cursor, VS Code Copilot, Windsurf, Amazon Q und jedem Tool, das die MCP-Spezifikation verwendet
Lizenz
MIT © Vamshidhar Reddy Parupally
This server cannot be deployed
Maintenance
Related MCP Connectors
Scan any MCP server for tool-poisoning, security, auth & license. Trust score before install.
Cloud-hosted MCP server for durable AI memory
Pre-flight MCP security. Blocks compromised deps + tool drift. HMAC-signed. Dredd judges.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceScans MCP servers for prompt injection, supply chain attacks, excessive permissions, and code execution risks. Includes an offline blacklist that catches known-compromised packages like LiteLLM 1.82.7/1.82.8 and Trivy with zero latency.19MIT
- AlicenseAqualityDmaintenanceThe MCP ecosystem is growing fast. Not every server on npm is safe. mcp-shield lets Claude audit any MCP server — local or from npm — before you trust it with your files, keys, and context.460 npm2MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that vets package installations and shell commands to block dangerous actions by AI coding agents.7 npm1MIT
- AlicenseNot gradedqualityDmaintenanceAn account-free MCP server that checks AI-written changes before they are committed, detecting nonexistent packages, dependency risk shapes, and hardcoded secrets.MIT