Integrate with SonarQube for IDE
Integrate the SonarQube MCP Server with SonarQube for IDE to get code analysis and insights directly in your IDE.
Integrate the SonarQube MCP Server with SonarQube for IDE to get code analysis and insights directly in your IDE.
When SonarQube for IDE integration is active, the analyze_file_list and toggle_automatic_analysis tools are available under both the analysis and ide toolsets. Use the ide toolset to load only SonarQube for IDE bridge tools without other analysis tools. See Available toolsets for details.
Note: Although the examples below use
docker, any OCI-compatible container runtime works (for example, Podman, nerdctl, etc). Simply replacedockerwith commands specific to your preferred tool.
When using SonarQube for IDE, set the SONARQUBE_IDE_PORT environment variable to the correct port number. See the list of base variables for more information.
SonarQube for VS Code includes a Quick Install button when running an agent-enabled IDE, which automatically sets the correct port configuration.
The following examples show configurations for SonarQube Cloud and SonarQube Server. Specify SONARQUBE_IDE_PORT in each.
Warning: User tokens are required when setting up connected mode or your SonarQube MCP server with SonarQube (Server, Cloud). Your binding won't function properly if you use project tokens, global tokens, or scoped organization tokens during setup.
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.
SonarQube Cloud
{
"sonarqube": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--init",
"--pull=always",
"-e",
"SONARQUBE_TOKEN",
"-e",
"SONARQUBE_ORG",
"-e",
"SONARQUBE_IDE_PORT",
//"-e",
//"SONARQUBE_URL",
"sonarsource/sonarqube-mcp"
],
"env": {
"SONARQUBE_TOKEN": "<YourSonarQubeUserToken>",
"SONARQUBE_ORG": "<YourSonarQubeOrganization>",
"SONARQUBE_IDE_PORT": "<Your-IDE-Port>"
//"SONARQUBE_URL": "https://sonarqube.us"
}
}
}Note: SONARQUBE_URL should be defined as
https://sonarqube.useach time you use a SonarQube Cloud configuration (SONARQUBE_TOKEN+SONARQUBE_ORG) and want to connect to a US-region instance. See the Connecting to SonarQube Cloud in the US region section for details.
SonarQube Server
Use this code sample when using Docker to configure your MCP server for integrating with SonarQube Server or SonarQube Community Build.
Note: On Linux, containers can't access the SonarQube for IDE embedded server on localhost. Add the
--network=hostoption to your container run command to fix this.
MCP Server setup in your IDE
For detailed quickstart instructions to set up the SonarQube MCP Server with the most popular AI agents, see the IDE/CLI quickstart guides.
Last updated
Was this helpful?

