mcptrust lock

Create a lockfile from a running MCP server


Synopsis

mcptrust lock -- <command> [flags]

Connects to the specified MCP server, discovers all tools, and writes a deterministic mcp-lock.json file to the current directory.

Options

FlagDefaultDescription
-f, --forcefalseOverwrite lockfile even if drift is detected
-o, --outputmcp-lock.jsonOutput path for the lockfile
-t, --timeout10sTimeout for MCP operations
--pinfalseResolve and pin artifact coordinates for supply chain security
--verify-provenancefalseVerify SLSA/Sigstore provenance attestations
--expected-source""Expected source repository pattern (regex) for provenance verification
--v3falseGenerate lockfile v3 format. This locks Prompts and Resource Templates (with hashes) in addition to Tools, and supports msg_template signing.

Examples

Lock a local server:

mcptrust lock -- "npx -y @modelcontextprotocol/server-filesystem /tmp"

This will generate mcp-lock.json containing hashes of all exposed tools.