Cursor
Install the SonarQube plugin in the Cursor IDE, Cursor CLI, or Agent Window to bring SonarQube code quality and security analysis, secrets detection into your AI coding session.
The SonarQube plugin for Cursor connects your AI coding agent to SonarQube's code quality and security features. It works with SonarQube Cloud or SonarQube Server.
Use the plugin from the Cursor IDE, the Cursor CLI, and the Cursor Agent Window.
Features
Through the SonarQube CLI integration set up by sonar integrate cursor, the plugin adds:
Secrets detection: three hooks that keep credentials out of the files the agent reads and the prompts sent to Cursor. One hook runs before the agent uses a tool, one before it reads a file, and one when you submit a prompt.
Vortex analysis (available with a Vortex subscription: SonarQube Cloud Team (annual) or Enterprise plan, or SonarQube Server 2026.5 or newer Enterprise and Data Center editions): an always-applied rule that runs after Cursor edits files.
Vortex context (available with a Vortex subscription: SonarQube Cloud Team (annual) or Enterprise plan, or SonarQube Server 2026.5 or newer Enterprise and Data Center editions): a hook that injects project guidelines, architecture, semantic-navigation, and dependency context when a session starts.
It also adds SonarQube skills that you can invoke as slash commands in Cursor's chat. See Usage.
The plugin also gives Cursor's agent access to the full set of Tools exposed by the SonarQube MCP Server, including:
Code analysis: analyze code snippets and files in the agent context.
Issues: search, review, and update code issues.
Quality gates: check the quality gate status for a project.
Security hotspots: search and review security hotspots.
Coverage: find under-covered files and review line-by-line coverage.
Dependencies: check third-party dependencies for SCA issues.
Prerequisites
A SonarQube Cloud organization or SonarQube Server instance.
Cursor installed.
The SonarQube CLI installed. The plugin's MCP Server uses your
sonar auth loginsession.A container runtime (Docker, Podman, or nerdctl) to run the SonarQube MCP Server image.
Install
The SonarQube plugin is published in the sonar marketplace catalog on the Cursor marketplace, sourced from the SonarSource/sonarqube-agent-plugins repository.
In Cursor's chat, install the plugin:
You can also install it from Cursor's marketplace panel. For more on plugin marketplaces and installation, see Cursor's Plugins documentation.
Configuration
After installing the plugin, finish setup in two steps.
Step 1: Authenticate
Log in so the MCP Server can connect:
Use the command for your scenario:
SonarQube Cloud (EU)
sonar auth login -o <YourOrganizationKey>
SonarQube Cloud (US)
sonar auth login -o <YourOrganizationKey> -s https://sonarqube.us
SonarQube Server
sonar auth login -s <YourServerURL>
Your browser opens to complete login, and the token is stored in your system keychain. Check your authentication anytime with sonar auth status.
Step 2: Install secrets hooks, Vortex analysis, and Vortex context
Run the integration command:
In an interactive terminal, the command shows these recommended components, then asks you to install them or customize the selection: secrets-detection hooks, the SonarQube MCP server configuration, and, with a Vortex subscription, the Vortex analysis rule and the Vortex context session-start hook.
Note: Cursor's cloud and background agents only pick up project-level hooks, not global ones. Desktop Cursor sessions on this machine still run the installed hooks.
Sonar Vortex: analysis and context features
When you run sonar integrate cursor, the command configures Cursor to use the What is Sonar Vortex? features. They run through the SonarQube CLI:
Vortex analysis: an always-applied rule runs after Cursor edits files. If no project is configured, the rule tells Cursor to stay silent for the rest of the session instead of repeating a skip notice.
Vortex context: a hook injects your project's coding guidelines, dependency health, architecture, and semantic-navigation context when a Cursor session starts.
Both features install when you set up the integration.
Note: If a previous install wrote
.agents/skills/sonar-context-augmentation/SKILL.md, update to SonarQube CLI 1.8.0 or newer, then re-runsonar integrate cursorto replace that leftover skill with the session-start hook. Re-running does not remove a leftover file inside a project folder. To remove one, see Orphaned integration files in the SonarQube CLI docs.
Verify that it works
Test the secrets hook
Create a file with a fake-looking but secret-shaped value:
Ask Cursor's agent to read it: "Read secrets.js."
Cursor should block the read and explain that the file contains a secret.
Once you've confirmed the hook is active, delete the test file.
Test the MCP server
In Cursor's chat, ask: "List my SonarQube projects." Cursor should call the SonarQube MCP server and return your project list. If it doesn't, open Cursor Settings → MCP, confirm the sonarqube entry is enabled, then run sonar auth status to confirm the underlying token is healthy and restart Cursor.
Test Sonar Vortex
To confirm that Vortex analysis and context are both working, see Checking that Vortex works properly.
Non-interactive install
For provisioning scripts and onboarding automation, skip the interactive prompts and run the SonarQube CLI directly:
In non-interactive mode the CLI does not prompt. It wires up the SonarQube MCP Server, the secrets-detection hooks, and installs Vortex analysis and context features. Run sonar auth status afterward to confirm the integration is wired up. See Cursor in the SonarQube CLI docs for full details.
Usage
After setup, invoke SonarQube skills in Cursor using slash commands or natural language. Both options are shown for each skill.
List projects
Or in natural language:
"List my SonarQube projects."
"Search for projects with
authin the name."
List issues
Or in natural language:
"List the issues in
my-project.""Show me critical issues in
my-project.""Search issues in
my-projecton branchmain."
Fix an issue
Or in natural language:
"Fix the issue
java:S1481insrc/main/java/MyClass.java.""Help me fix
python:S2077on line 34 ofsrc/auth/login.py."
Quality gate
Or in natural language:
"Check the quality gate status for
my-project.""Show me the quality gate for
my-projecton pull request 42."
Analyze a file
Or in natural language:
"Analyze
src/auth/login.pyfor code quality and security issues.""Run analysis on the current file."
Coverage
Or in natural language:
"What files in
my-projecthave less than 50% coverage?""Show me line-by-line coverage for
src/auth/login.py."
Duplication
Or in natural language:
"Find duplicated files in
my-project.""Show duplications in
my-projecton pull request 42."
Dependency risks
Dependency risks require SonarQube Advanced Security.
Or in natural language:
"List dependency risks in
my-project.""Show me SCA issues on pull request 42."
Security hotspots
Access security hotspots through the same sonar-list-issues skill:
Or in natural language:
"Search security hotspots in
my-project.""Show hotspots in
my-projectthat are still to review."
For the full reference of what the agent can call, see the Tools page.
Manual MCP setup
If you prefer to configure the MCP Server directly in Cursor's mcp.json instead of installing the plugin, for example to use HTTPS transport or the SonarQube Cloud-hosted server, see the Cursor.
Uninstall
To remove the SonarQube plugin from Cursor, open Cursor's plugins panel and remove the SonarQube plugin. For details, see Cursor's Plugins documentation.
Uninstalling the plugin removes the skills and MCP wiring it registered. To also remove the underlying CLI integration files written by sonar integrate cursor (the secrets-detection hooks, Vortex analysis rule, and Vortex context session-start hook), see Cursor in the SonarQube CLI docs.
Related pages
Set up the SonarQube MCP Server in Cursor
Last updated
Was this helpful?

