Integrate with SonarQube for IDE

Integrate the SonarQube MCP Server with SonarQube for IDE for better code analysis and insights directly within your IDE.

The SonarQube MCP Server can integrate with SonarQube for IDEarrow-up-right to further enhance your development workflow, providing better code analysis and insights directly within your IDE.

When using SonarQube for IDE, the SONARQUBE_IDE_PORT environment variable should be set with 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. See the Setup the SonarQube MCP Server article in our VS Code documentation for instructions.

Here are some example configurations; note that you'll need to specify the SONARQUBE_IDE_PORT:

circle-info

Although the examples below use docker, any OCI-compatible container runtime works (for example, Podman, nerdctl, etc). Simply replace docker with commands specific to your preferred tool.

{
  "sonarqube": {
    "command": "docker",
    "args": [
      "run",
      "-i",
      "--rm",
      "-e",
      "SONARQUBE_TOKEN",
      "-e",
      "SONARQUBE_ORG",
      "-e",
      "SONARQUBE_IDE_PORT",
      "mcp/sonarqube"
    ],
    "env": {
      "SONARQUBE_TOKEN": "<YourSonarQubeUserToken>",
      "SONARQUBE_ORG": "<YourSonarQubeOrganization>",
      "SONARQUBE_IDE_PORT": "<Your-IDE-Port>"
    }
  }
}
circle-exclamation
circle-check
circle-info

When running the MCP server in a container on Linux, the container cannot access the SonarQube for IDE embedded server running on localhost. To allow the container to connect to the SonarQube for IDE server, add the --network=host option to your container run command.

MCP Server setup in your IDE

For detailed quickstart instructions to set up the SonarQube MCP Server with the most popular AI agents, check the content in the IDE setup section.

Last updated

Was this helpful?