SonarQube for VS Code in Windsurf

SonarQube for VS Code helps bring analysis of AI-generated code to your IDE. This page has installation and migration instructions in addition to features designed specifically for Windsurf.

Installation

The SonarQube for VS Code extension can easily be installed in Windsurf during the Set up process, via the Open VSX registryarrow-up-right, or by using Windsurf’s migration tool: Open your Windsurf command palette and type: >Import VS Code. See the Welcome to Windsurfarrow-up-right page for details.

Because Windsurf references a mirror of Open VSX as a marketplace, installing a new instance of the SonarQube for VS Code extension is easy:

  1. Open the Extensions view by pressing Ctrl + Shift + X (or Cmd + Shift + X on Mac).

  2. Search for sonarqube.

  3. Finish the installation by choosing SonarQube for IDE and selecting the Install button

Once installed, we recommended using connected mode and setting up the SonarQube MCP server with SonarQube Server or SonarQube Cloud to strengthen your AI integration with SonarQube. Note that although Windsurf has migrated your extension, your SonarQube token is in secure storage and will not be migrated; you will be prompted to reauthenticate your connection.

See the Setup in Windsurf instructions in our SonarQube MCP Server documentation for full details.

circle-info

Windsurf subscribers on their Team & Enterprise plans should add the SonarQube MCP Server to the list of allowed servers. Please see the Windsurf documentation about Admin Controlsarrow-up-right.

Cascade Hooks

Windsurf allows you to run deterministic scripts that are executed after specific events. SonarQube for VS Code provides a hook script that tells Windsurf to run an analysis after any generation of new code in your project. Issues will be reported in your SonarQube panel. See option 4 in the Finding issues article.

To install this Cascade Hook, go to SonarQube Setup > AI Agents Configuration and select Install Hook for Code Analysis. You will receive a confirmation notification that the script was installed successfully.

SonarQube MCP Server

The SonarQube MCP Server is a Model Context Protocol (MCP) server that runs locally and enables a seamless connection between your AI agents and your SonarQube platform. The tools are designed to bridge the divide between productivity and quality. Please see the full details in the SonarQube MCP Server documentation.

Setup the SonarQube MCP Server

When you're using an AI-enabled IDE such as Cursor, Windsurf, or VS Code with Copilot enabled, and have already completed your Connected mode setup in SonarQube for IDE with SonarQube Server or SonarQube Cloud, a quick select button is available.

  • Select the icon, Configure MCP Server from the CONNECTED MODE view window to use your connected mode credentials to start using the SonarQube MCP Server. The same workflow is available in the AI AGENTS CONFIGURATION view.

Select the MCP Server icon and use your connected mode credentials to populate the MCP environment variables.

More information about the available tools can be found in the SonarQube MCP Server documentation, on the Tools page.

Configure your AI agent

The AI AGENTS CONFIGURATION view is only available when running an AI-enabled agent and offers two tools to help your AI agent engage with SonarQube (Server, Cloud).

  • Select Configure SonarQube MCP Server to use your connected mode credentials to install the SonarQube MCP Server. You will be prompted to complete your Connected mode setup if none exists.

  • Available in Cursor only: Select Introduce SonarQube Rules File to create explicit instructions for your AI-powered IDE to produce secure, reliable, and maintainable code.

    • The file provides SonarQube MCP Server instructions to your AI agent. As an example, it instructs the agent to disable SonarQube automatic analysis before starting code generation, and to enable it after the generation is complete. It also asks the agent to analyze changed files in batches, once the changes are done.

Last updated

Was this helpful?