This module implements the Snyk CLI Extension to scan your MCP tools.
This extension is compiled into the Snyk CLI and, at runtime, downloads the
agent-scan binary from GitHub Releases and
verifies its SHA-256 checksum before running it. To develop against local changes in
both this extension and the agent-scan binary, wire the pieces together as follows.
-
The repositories checked out as siblings, because the CLI's
replacedirective resolves this extension via a relative path (../../cli-extension-agent-scan):<workspace>/ ├── cli/ # github.com/snyk/cli ├── cli-extension-agent-scan/ # this repo └── agent-scan/ # github.com/snyk/agent-scan
From the agent-scan repo, build the standalone binary (output: dist/agent-scan):
cd ../agent-scan
make binaryClone snyk/cli as a sibling directory, then in
cliv2/go.mod uncomment the local replace directive so the CLI builds against your
working copy instead of a published version:
replace github.com/snyk/cli-extension-agent-scan => ../../cli-extension-agent-scanThen sync and build the CLI:
cd ../cli/
make clean
make buildThe last line should be something like:
-- Installing ( <Some-path>/cli/binary-releases/snyk-macos-arm64 )
This is the built Snyk CLI binary.
Set SNYK_AGENT_SCAN_BINARY_PATH to the binary from step 1. When set, the extension
uses that binary directly and skips the download, cache, and checksum verification.
This is for local development only and must never be relied on in production.
export SNYK_AGENT_SCAN_BINARY_PATH="$(pwd)/../../agent-scan/dist/agent-scan"Invoke the locally built CLI binary produced by step 2 (the exact path is
platform-specific, e.g. cliv2/bin/snyk_darwin_arm64).
<Some-path>/cli/binary-releases/snyk-macos-arm64 agent-scan --experimentalIf the Snyk CLI is already authenticated, you do not need to provide a push key. The extension will find your tenant (or ask you to choose one) and request a push key automatically.
You can also provide the push key yourself using --client-id. The name is kept
for compatibility; in this context, the client ID is the Agent Scan push key:
<Some-path>/cli/binary-releases/snyk-macos-arm64 agent-scan \
--experimental \
--client-id=<push-key>Starting with Agent Scan 0.5.17, the analysis backend can process scans
asynchronously. That is useful when you only need to submit the scan, but it means
the command might finish before the analysis results are available. Add
--show-analysis-results when you want to wait for analysis and see the results in
the terminal:
<Some-path>/cli/binary-releases/snyk-macos-arm64 agent-scan \
--experimental \
--show-analysis-resultsWhen using --json without supplying --client-id, also provide --tenant-id.
JSON mode cannot show the interactive tenant picker that is used when several
tenants are available:
<Some-path>/cli/binary-releases/snyk-macos-arm64 agent-scan \
--experimental \
--tenant-id=<tenant-id> \
--show-analysis-results \
--jsonTo return to the normal download-and-verify behavior, unset SNYK_AGENT_SCAN_BINARY_PATH.
This repository is closed to public contributions.