For the complete documentation index, see llms.txt. This page is also available as Markdown.

GitHub Copilot guide

You can access Snyk Studio, including Snyk's MCP server, in VSCode to secure code generated with agentic workflows through Copilot. This can be achieved in several ways. For most users, we recommend accessing Snyk Studio using the Snyk Security plugin.

The Snyk Security plugin in the extensions library.

Enable Secure At inception

After installation completes, a dialog appears asking you to opt in to Secure at Inception in Snyk Studio. Opting in automatically configures the rules needed to scan new AI-generated code. More configuration options are available on the plugin's Settings page.

Clicking Yes activates Auto Configure Snyk MCP Server and sets Secure at Inception: Execution Frequency to On Code Generation. These settings configure the Snyk MCP server and create the snyk_rules.mdc file in the directory.

Update Secure at Inception settings

If you installed the VS Code extension earlier and did not enable Secure at Inception in the dialog, you can enable it later in the extension settings. You can also update Secure at Inception settings there, or disable the feature by setting Execution Frequency to Manual.

Authenticate

Selecting an Execution Frequency triggers an authentication request. You can authenticate at two points:

  • Immediately after you install the plugin

  • Before your first Snyk Code scan

The authentication flow asks you to sign up or log in on the Snyk website, and a browser window opens. New users select a sign-up method and agree to the terms on the next screen. After you authenticate, Snyk instructs you to return to your IDE.

To use Snyk Studio, specifically Snyk's SAST scanning capabilities, you'll need to enable Snyk Code. To use Snyk Studio, specifically its SAST scanning, you must enable Snyk Code. Snyk Code analyzes your code for vulnerabilities and temporarily clones the repository or uploads your code. Snyk caches cloned or uploaded code according to the Snyk data retention policy. On the Snyk Free plan, Snyk Code offers unlimited scans for open-source projects and limited tests for first-party code. To learn more, visit Snyk plans.

Existing users select the login method associated with their account. If you do not have access to Snyk Code, you are prompted to enable it before your first scan. You can also enable it in Settings.

Run Snyk Studio

After you authenticate, Snyk Studio runs whenever the LLM generates new code. If Snyk Studio does not run, restart your IDE and generate code again.

Free users have a limited number of scans. If you reach the limit, Snyk recommends contacting sales to unlock a higher threshold.

Alternate: Install Snyk Studio Directly

Prerequisites

Install GitHub Copilot

Add the GitHub Copilot extension to VS Code. For mode details, visit the official Setup GitHub Copilot on VS Code guide.

Install the Snyk MCP Server in GitHub Copilot

Install the Snyk MCP Server using the method that best suits your operating system and local environment.

Install using the Snyk extension (preferred)

Install the extension using one of the following methods:

  • Open the Snyk Security extension in the Visual Studio Marketplace and install it.

  • Open the Extensions: Install Extensions pane, search for Snyk Security, and install it.

VS Code automatically detects the Snyk MCP Server, but you must enable it explicitly.

Enable the Snyk MCP Server using one of the following methods:

  • Open the Command Palette (Cmd + Shift + P on MMacOS, Ctrl + Shift + P on Windows), select MCP: List Servers, then find Snyk MCP server in the list and enable all tools.

  • In the GitHub Copilot chat, click the Tools icon.

  • You can see a list of all MCP Servers and their tool. Locate Snyk from the list and enable all of its tools:

Install with Node.js and npx

Create or edit the MCP configuration file .vscode/mcp.json in the root directory of your Project.

If you have the Node.js npx executable installed in your environment, add the following JSON snippet to the file:

Install with pre-installed Snyk CLI

Create or edit the MCP configuration file .vscode/mcp.json in the root directory of your Project.

If you have the Snyk CLI installed and accessible on your system path, include the following JSON snippet in the file. You might need to specify the full path to the Snyk executable CLI:

If the snyk command is not available, add it by following the instructions on the Installing or updating the Snyk CLI page.

The following example shows a Snyk MCP Server that was successfully configured and started.

Successful Snyk MCP Server configuration in VSCode.

For additional MCP configuration options on VS Code and troubleshooting, visit the official VS Code MCP server documentation.

Setting up the Snyk MCP Server

As a one-time setup, you might need to authenticate and trust the Project directory. The agentic workflow usually handles this automatically.

The model and the agentic code assistant run most of these workflows, and you approve them in a browser confirmation dialog. The process looks similar to this:

Authentication prompt for the Snyk MCP Server.

If you need to authenticate and trust the current directory, then proceed and complete the process.

The agentic code assistant automatically running Snyk MCP server tools.

Examples

Scanning for security vulnerabilities

In the chat, you can tag specific files or functions and ask Copilot to scan your code for safely deploying to production:

Copilot indicates that this request is related to security vulnerability scanning and calls the Snyk MCP Server for various scans.

Prompt responses from Copilot on the security scan results.

Copilot then gathers all the security scan results, both code (SAST) and dependencies (SCA). Using the recommendations and context from the Snyk MCP server, Copilot suggests code changes that address some or all of the vulnerabilities found:

Suggested changes and recommendations from Copilot.

Secure at inception rules

To practice Secure at Inception, Snyk recommends adopting rules that align the LLM for secure code generation and workflows.

The following is a suggested instruction for GitHub Copilot custom instructions. Append the following contents to the rules file at .github/copilot-instructions.md:

Troubleshooting

Authentication loops, 401 errors, or timeouts

If you are behind a corporate proxy or experience scan timeouts (MCP error -32001), configure the proxy and timeout settings explicitly in your mcp.json file. The Snyk MCP server does not inherit OS or IDE proxy settings automatically.

  1. Open your mcp.json file.

  2. Add a timeout parameter, in milliseconds, to allow larger scans to complete. For example, set 600000 for 10 minutes.

  3. Add the HTTP_PROXY and HTTPS_PROXY variables to the env block so the server can authenticate and route traffic.

  4. Restart your IDE to apply the changes.

Example mcp.json with proxy and timeout configuration:

Last updated

Was this helpful?