For the complete documentation index, see llms.txt. This page is also available as Markdown.

Build

The SonarQube MCP Server can be launched using our container image, installed using our JAR, and you can build your own server if needed. This page covers all three options.

As described in the IDE/CLI quickstart guides, the easiest way to launch the SonarQube MCP Server is with the sonarsource/sonarqube-mcp container image, but you have other options.

To run the server as a standalone JAR without Docker, download a pre-built release from the SonarSource binaries repository. Every released version is published there as sonarqube-mcp-server-<version>.jar (for example, sonarqube-mcp-server-1.20.0.2929.jar).

Run from JAR

Download the JAR for the version you want from the binaries repository, then configure your MCP client to run it with Java 21 or later. Add the following to your MCP configuration's JSON file.

The main difference between the server setup of SonarQube Cloud and SonarQube Server is:

  • SonarQube Cloud requires a User token and an organization name.

    • If your SonarQube Cloud organization is in the US region, be sure to define SONARQUBE_URL as https://sonarqube.us when configuring your connection. See the list of common variables for complete details.

  • SonarQube Server and SonarQube Community Build require a User token and server URL.

SonarQube Cloud

{
  "sonarqube": {
    "command": "java",
    "args": [
        "-jar",
        "<PathToYourSonarQubeMCPServerJAR>"
    ],
    "env": {
        "STORAGE_PATH": "<PathToYourMCPStorage>",
        "SONARQUBE_TOKEN": "<YourSonarQubeUserToken>",
        "SONARQUBE_ORG": "<YourOrganization>"
        // "SONARQUBE_URL": "https://sonarqube.us" // define this parameter to connect to an organization in the US region
    }
  }
}

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: SONARQUBE_URL should be defined as https://sonarqube.us each 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

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.

Build from source

SonarQube MCP Server requires a Java Development Kit (JDK) version 21 or later to build.

  1. Clone the SonarQube MCP Server project from the sonarqube-mcp-server repository.

  2. Run the following Gradle command to clean the project and build the application:

    The JAR file will be created in build/libs/.

  3. After adding or updating dependencies, regenerate the lock files:

  4. Use the Run from JAR configuration above, pointing <PathToYourSonarQubeMCPServerJAR> to the JAR in build/libs/.

Deployment options

Depending on your environment, you may want to deploy your MCP server in different ways. See Environment considerations to choose the right setup.

Last updated

Was this helpful?