How to Get Started with Snyk CLI and the Snyk MCP Server

Get started with Snyk CLI and Snyk MCP server to secure your code. This tutorial covers installation, setup, and AI-driven vulnerability scans for your projects.

Ashley Goolam

Ashley Goolam

4 July 2025

How to Get Started with Snyk CLI and the Snyk MCP Server

Ready to level up your security game with Snyk? In this tutorial, we’re diving into the Snyk CLI and the Snyk MCP server, a dynamic duo for keeping your code safe and secure. I’ll walk you through what Snyk is, how to install the CLI, and how to set up the Snyk MCP server to integrate with AI workflows—all in a fun, conversational tone. Let’s get started!

💡
Want a great API Testing tool that generates beautiful API Documentation?

Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?

Apidog delivers all your demands, and replaces Postman at a much more affordable price!
button

What Is Snyk?

Snyk is like your code’s personal bodyguard. It’s a developer-first security platform that helps you find and fix vulnerabilities in your code, dependencies, containers, and infrastructure as code. Whether you’re working on a side project or a massive enterprise app, Snyk scans your codebase for issues and provides actionable remediation advice. It supports a ton of languages and frameworks, integrates with your CI/CD pipeline, and plays nice with tools like GitHub and Docker.

The Snyk MCP server takes things up a notch, letting AI clients and agentic workflows interact programmatically with Snyk’s security scanning features. It’s like giving your AI assistant the power to spot vulnerabilities in your code—pretty cool, right?

official snyk website

Why Use the Snyk MCP Server?

The Snyk MCP server (Model Context Protocol) is an experimental feature that lets AI systems, like Claude or Cursor, tap into Snyk’s security scanning capabilities. It exposes Snyk’s features—like dependency vulnerability checks and code analysis—to AI-driven workflows, enabling automated security scans and insights. This means you can ask your AI to “check my project for vulnerabilities” and get detailed results without lifting a finger.

Let’s get the Snyk CLI up and running on your machine. It’s super easy, and there are multiple ways to do it depending on your platform. Here’s how:

Installing the Snyk CLI and MCP Server

Prerequisites

Step 1: Install the Snyk CLI

Choose your preferred method to install the Snyk CLI:

a. Using npm (Node.js required)

npm install snyk -g

This installs Snyk globally on your system.

b. Using Homebrew (macOS/Linux)

brew tap snyk/tap
brew install snyk

c. Using Scoop (Windows)

scoop bucket add snyk https://github.com/snyk/scoop-snyk
scoop install snyk

d. Using a Standalone Binary

Download the executable for your platform from Snyk’s releases.

For example, on macOS:

curl --compressed https://downloads.snyk.io/cli/stable/snyk-macos -o snyk
chmod +x ./snyk
mv ./snyk /usr/local/bin/

On windows:

curl https://static.snyk.io/cli/latest/snyk-win.exe -o snyk.exe

For Linux or Alpine, check the Snyk documentation for direct download links.

download links

Step 2: Authenticate the Snyk CLI

After installation, create a Snyk account if you don’t have one. Then authenticate the CLI:

snyk auth

This opens a browser window to log in or sign up. For CI/CD or headless environments, set the SNYK_TOKEN environment variable with your Snyk API token (found in your Snyk account settings).

authenticate snyk cli

Step 3: Verify Your Installation

Check if the CLI is working:

snyk --version
snyk test --help

Try a quick test on a public package:

snyk test ionic

This should return a vulnerability report for the Ionic package.

authenticate and verify installation

Step 4: Set Up the Snyk MCP Server

The Snyk MCP server lets AI clients interact with Snyk’s security features. Here’s how to configure it in an AI client like Cursor:

Configuring the MCP Server in Cursor

  1. Go to Settings > Tools and Integrations > Add New MCP Server.
  2. Paste this configuration into your client’s config file (e.g., mcp_config.json or claude-config.json):

For stdio transport:

{
  "mcpServers": {
    "Snyk Security Scanner": {
      "command": "/absolute/path/to/snyk",
      "args": ["mcp", "-t", "stdio", "--experimental"],
      "env": {}
    }
  }
}

Replace /absolute/path/to/snyk with the actual path to your Snyk CLI executable (find it with which snyk on Unix or where snyk on Windows).

Start the Snyk MCP server and note the port it runs on (e.g., localhost:PORT). Add this to your client config:

{
  "mcpServers": {
    "Snyk Security Scanner": {
      "url": "http://localhost:PORT/sse"
    }
  }
}

You can also set organization IDs or other environment variables as needed for your Snyk account.

view snyk mcp server in cursor

Step 5: Example Usage

With the Snyk MCP server configured, your AI client can trigger Snyk scans. Try a prompt like:

"Please check for vulnerabilities in the dependencies of this project."

The server will analyze your project and return a report with vulnerability details and remediation advice. Note: The Snyk MCP server is experimental, so results may be less detailed than the CLI. For complex projects with multiple dependencies, the CLI is recommended for more comprehensive reports. The MCP server shines in standalone projects or simpler workflows.

run the snyk mcp server

Troubleshooting Tips

Wrapping Up

And there you go! You’ve got the Snyk CLI and Snyk MCP server ready to keep your code secure. The CLI is your go-to for deep vulnerability scans, while the MCP server brings AI-powered security checks into your workflows. Whether you’re scanning a small project or automating security in a CI/CD pipeline, Snyk’s got your back.

💡
Want a great API Testing tool that generates beautiful API Documentation?

Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?

Apidog delivers all your demands, and replaces Postman at a much more affordable price!
button

Explore more

AI-Powered Documentation Solutions for Modern Development

AI-Powered Documentation Solutions for Modern Development

Delve into the world of AI-powered documentation: discover top tools, key benefits, and how each tool empowers modern teams to create, manage, and publish documentation faster than ever.

4 July 2025

How to Use the dbt MCP Server

How to Use the dbt MCP Server

Discover the dbt MCP server, a tool to integrate dbt projects with AI systems. This tutorial covers installation, setup, and how it enables data discovery, querying, and automation for AI workflows.

3 July 2025

Cypher Alpha: What's the Free Mysterious OpenRouter API?

Cypher Alpha: What's the Free Mysterious OpenRouter API?

Learn to harness OpenRouter’s free Cypher Alpha AI model with Apidog for efficient API testing. This guide covers setup, examples, and benefits for developers.

2 July 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs