Skip to main content

What You'll Build

An automated security scanning system that uses Continue’s AI agent with Snyk MCP to identify vulnerabilities in code, dependencies, infrastructure, and containers - all through simple natural language prompts

Demo Video

Prerequisites

Before starting, ensure you have:
  • Node.js 18+ installed locally
  • Snyk account (free tier works)
  • A local project to scan for vulnerabilities
For all options, first:
1

Install Continue CLI

2

Add Your Project to Snyk

  1. Sign up for a Snyk account at snyk.io
  2. Create a new project in Snyk by importing your code repository (Git provider or manual upload)
  3. Install and authenticate the Snyk CLI locally:
    This will open your browser to authenticate with your Snyk account.
Important: The Snyk MCP requires the Snyk CLI to be authenticated locally. Run snyk auth to authenticate before using the Continue agent with Snyk MCP.
To use agents in headless mode, you need a Continue API key.

Snyk Continuous AI Workflow Options

πŸš€ Fastest Path to Success

Skip the manual setup and use our pre-built Snyk Continuous AI agent that includes the Snyk MCP and optimized security scanning workflows for more consistent results.
After ensuring you meet the Prerequisites above, you have two paths to get started:
To use the pre-built agent, you need either:
  • Continue CLI Pro Plan with the models add-on, OR
  • Your own API keys configured as environment variables
The agent will automatically detect and use your configuration along with the pre-configured Snyk MCP for security scanning operations.

Security Scanning Recipes

Now you can use natural language prompts to run comprehensive security scans. The Continue agent automatically calls the appropriate Snyk MCP tools.
Where to run these workflows:
  • IDE Extensions: Use Continue in VS Code, JetBrains, or other supported IDEs
  • Terminal (TUI mode): Run cn to enter interactive mode, then type your prompts
  • CLI (headless mode): Use cn -p "your prompt" --auto for headless commands
Test in Plan Mode First: Before running security scans that might make changes, test your prompts in plan mode (see the Plan Mode Guide; press Shift+Tab to switch modes in TUI/IDE). This shows you what the agent will do without executing it. For example: "Run a Snyk Code scan and fix the top 3 issues"

Code Vulnerability Scanning (SAST)

Static Application Security Testing

Scan your source code for security vulnerabilities and code quality issues.TUI Mode Prompt:
Headless Mode Prompt:

Dependency Scanning (SCA)

Software Composition Analysis

Check open source dependencies for known vulnerabilities.TUI Mode Prompt:
Headless Mode Prompt:

Infrastructure as Code (IaC)

IaC Security

Scan Terraform, CloudFormation, and Kubernetes configs for misconfigurations.TUI Mode Prompt:
Headless Mode Prompt:

Container Scanning

Container Security

Analyze Docker images for vulnerabilities in base images and packages.TUI Mode Prompt:
Headless Mode Prompt:

Pull Request Scanning

Changed Files Only

Focus scanning on modified files to catch issues before merging.TUI Mode Prompt:
Headless Mode Prompt:

Security Learning

Snyk Learn Integration

Access security education resources based on identified vulnerabilities (CWE).TUI Mode Prompt:
Headless Mode Prompt:

Continuous Security with GitHub Actions

This example demonstrates a Continuous AI workflow where security scanning runs automatically on pull requests, generates AI-powered mitigation suggestions, and posts them as PR comments.
About the β€”auto flag: The --auto flag enables tools to run continuously without manual confirmation. This is essential for headless mode where the agent needs to execute multiple tools automatically to complete tasks like security scanning, vulnerability analysis, and fix validation.

Add GitHub Secrets

Navigate to Repository Settings β†’ Secrets and variables β†’ Actions and add:

Create Workflow File

Create .github/workflows/snyk-security.yml in your repository:
About SNYK_TOKEN: The workflow uses the SNYK_TOKEN in two ways:
  1. Direct Snyk CLI authentication - Authenticates the Snyk CLI for running scans
  2. Continue CLI access - Available as an environment variable when Continue generates AI mitigation suggestions
The cn agent automatically uses the SNYK_TOKEN when needed for Snyk MCP operations.
This workflow demonstrates several advanced features:
  • Changed Files Detection: Only scans files modified in the PR
  • AI Mitigation: Uses Continue CLI to generate actionable mitigation steps
  • PR Comments: Automatically posts mitigation suggestions as PR comments
  • Comprehensive Reporting: Generates detailed security reports with artifacts

Security Guardrails

Implement automated security policies using Continue’s rule system. See the Rules deep dive for authoring tips.

Pre-commit Scanning

Dependency Safety

Container Hardening

IaC Compliance

Enable the Secure-at-Inception rules in your configuration to automatically apply these guardrails to all code generation and modifications.

Troubleshooting

Authentication Issues

Fix Validation

Connection Problems

Verification Steps:
  • Snyk MCP is installed and configured
  • Secure-at-Inception rules are enabled
  • Authentication completed successfully
  • Project folder has been trusted

What You’ve Built

After completing this guide, you have a complete AI-powered security system that:
  • βœ… Uses natural language β€” Simple prompts instead of complex CLI commands
  • βœ… Fixes automatically β€” AI suggests and validates security fixes
  • βœ… Runs continuously β€” Automated scanning in CI/CD pipelines
  • βœ… Enforces guardrails β€” Security rules prevent vulnerable code from shipping

Continuous AI

Your security workflow now operates at Level 2 Continuous AI - AI handles routine security scanning and remediation with human oversight through review and approval of fixes.

Next Steps

  1. Run your first scan - Try the SAST prompt on your current project
  2. Review findings - Analyze the security report and implement fixes
  3. Set up CI pipeline - Add the GitHub Actions workflow to your repo
  4. Customize rules - Add project-specific security policies
  5. Monitor trends - Track vulnerability reduction over time

Additional Resources

Snyk Documentation

Complete Snyk platform documentation

Continue Documentation

Explore Continue documentation and guides

Security Best Practices

Learn about secure coding practices

MCP Concepts

Understanding MCP architecture