Cursor
Set up the SonarQube MCP Server in Cursor and start using Sonar tools with your agent.
Cursor is an AI-powered code editor built on VS Code. Use this MCP server setup when you want Sonar tools available inside the Cursor chat while you code.
Choose your setup
The SonarQube MCP Server lets an AI agent query your SonarQube projects. With it, Cursor can look up issues, quality gates, and coverage while it works. You can use a server that SonarQube hosts, run your own, or have the SonarQube CLI set it up for you. Choose how to connect:
Automatic configuration in Cursor
The MCP server, secrets detection, and Sonar Vortex analysis and context
You
SonarQube Cloud users
Nothing to install and a smaller, fixed subset of tools. No Sonar Vortex.
You connect
SonarQube Server 2026.3 and later (Developer, Enterprise, and Data Center editions)
Nothing to install on your machine. No Sonar Vortex.
An administrator installs it, and then you connect
Full control
The MCP server that you run yourself, with the Sonar Vortex analysis and context tools through the Stdio transport
You
For any option except the automated setup, the configuration generator gives you a snippet to paste into your mcp.json file.
Automated setup with the SonarQube CLI
For an automated setup, use the Cursor setup flow. It configures the MCP server automatically and also adds secrets detection, Vortex analysis, and Vortex context.
Set up Vortex analysis and Vortex context using the SonarQube plugin or SonarQube CLI. See Sonar Vortex analysis and Sonar Vortex context.
Connect to a SonarQube-hosted MCP server
Connect to a SonarQube-hosted MCP server to skip running your own MCP infrastructure and always use the current server version:
SonarQube Cloud-hosted: for SonarQube Cloud users. The MCP server is embedded in SonarQube Cloud, so there's nothing to install, and it exposes a smaller, fixed subset of tools. To connect, see the SonarQube Cloud-hosted page.
Cursor is a supported OAuth client. You can sign in with OAuth without a SonarQube user token.
SonarQube Server-hosted: for SonarQube Server users on Developer, Enterprise, and Data Center editions, version 2026.3 and newer. An administrator installs the MCP server extension on your instance, and then you connect your AI agent. To install the extension, see the SonarQube Server-hosted page.
Neither the SonarQube Cloud-hosted nor the SonarQube Server-hosted option supports Sonar Vortex, which requires local filesystem access. To use Sonar Vortex, use the automated setup or a self-hosted MCP server.
To get the connection snippet for either option, use the configuration generator and select the matching hosting method.
Set up a self-hosted MCP server
A self-hosted MCP server runs on your machine or in your own environment, and you manage it yourself. Set it up in one of three ways:
Configure it manually, using the configuration generator or by hand.
Before you start
The following common variables apply. SONARQUBE_TOKEN applies to stdio transport only. For a SonarQube token on HTTP, HTTPS, or the SonarQube Cloud-hosted MCP server, use the Authorization: Bearer <YourSonarQubeUserToken> header instead.
SONARQUBE_TOKEN: Your SonarQube user token (stdio transport).SONARQUBE_ORG: Optional SonarQube Cloud organization key. When set, it fixes the organization. See SONARQUBE_ORG.SONARQUBE_URL: Your SonarQube Server or SonarQube Community Build URL. Also required for SonarQube Cloud in the US region (https://sonarqube.us). Not needed for SonarQube Cloud in the EU region.
Important: Your SonarQube token is a sensitive credential. Use environment variables to pass tokens rather than hardcoding them in configuration files. Never commit tokens to version control.
Warning: User tokens are required when setting up connected mode or your SonarQube MCP server with SonarQube (Server, Cloud). Your binding will not function properly if you use project tokens, global tokens, or scoped organization tokens during setup.
When using these features, your SONARQUBE_TOKEN lets your local MCP server configured for Stdio mode authenticate to the SonarQube Cloud API. See Sonar Vortex analysis and Sonar Vortex context for more information.
Install with automatic configuration
When you're using an AI-enabled IDE such as Cursor, Devin Desktop, 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.
If you've connected to a SonarQube Cloud organization in the US region, the configuration details will be shared.
Install with a quick link
Use the following links to quickly set up the SonarQube MCP Server in Cursor. This generates a configuration file and automatically fills it with your environment variables. Make sure your environment variables are configured first.
Watch the Cursor and SonarQube MCP Server integration demo on YouTube.
Configure manually
The SonarQube MCP Server supports three transport modes. Use Stdio for local development and most use cases, HTTPS for production and team deployments, and HTTP only on trusted internal networks.
Use the official SonarQube MCP Server configuration generator to get a configuration code snippet for your setup:
Identify the target MCP Client.
Find your #common-variables.
Choose a hosting method.
Enter the information into the configuration generator.
Paste the generated configuration into your configuration file.
To configure by hand instead, select a transport tab.
Use Stdio for local development or when you're the only user. It's also the transport mode used in your Sonar Vortex analysis and Sonar Vortex context workflows.
For a manual configuration, add this MCP configuration to your mcp.json file, at the location specified in the Cursor documentation.
For more information on the environment variables and how to retrieve the token and organization information, see the environment variables page.
Note: This code sample configures the MCP server using Stdio transport, where
SONARQUBE_TOKENis passed as an environment variable.For HTTPS, HTTP, or the SonarQube-hosted MCP server, the
SONARQUBE_TOKENheader is deprecated. Pass the token using the"Authorization": "Bearer <YourSonarQubeUserToken>"header instead.
Note: SONARQUBE_URL should be defined as
https://sonarqube.useach time you connect to a SonarQube Cloud organization in the US region. Without it, the server connects to the EU region. See the Connecting to SonarQube Cloud in the US region section for details.
Note: Docker's MCP Hub publishes the
mcp/sonarqubeimage on its own cadence, so it may occasionally lag behind the latest release. The examples below usesonarsource/sonarqube-mcpinstead, which receives new releases first and supports versioned tags for stable pinning.
Cursor with SonarQube Cloud
Cursor with SonarQube Server
Once you've set up the SonarQube MCP Server, the configuration appears under Tools & Integrations in Cursor.
Tip: To verify the connection, ask your AI agent to call the SonarQube MCP
ping_systemtool. For example: "Ping the SonarQube MCP server."
Note: Restart Cursor for the new MCP server configuration to take effect.
Use HTTPS when connecting Cursor to a shared MCP server deployed for a team. This requires an HTTPS transport server to be running and accessible.
Add the following to your mcp.json file, at the location specified in the Cursor documentation:
Tip: To verify the connection, ask your AI agent to call the SonarQube MCP
ping_systemtool. For example: "Ping the SonarQube MCP server."
Note: Restart Cursor for the new MCP server configuration to take effect.
Use HTTP only on a trusted internal network or for local testing. This requires an HTTP transport server to be running.
Add the following to your mcp.json file:
Tip: To verify the connection, ask your AI agent to call the SonarQube MCP
ping_systemtool. For example: "Ping the SonarQube MCP server."
Note: Restart Cursor for the new MCP server configuration to take effect.
Use Sonar tools from Cursor
Once connected, use the Cursor chat to call SonarQube MCP tools, for example, by typing: "search my sonarqube projects". See the SonarQube MCP Tools page for the full list of available tools.
Last updated
Was this helpful?

