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 container image, but you have other options.

Build from source

We recommend setting up the SonarQube MCP Server with the container image as explained in the Quickstart guides article, but if you want to build it locally, review the Prerequisites, then follow these steps:

  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:

    ./gradlew clean build -x test

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

  3. Perform the manual installation as described in Manual installation.

If you prefer, the JAR file is downloadable from the sonarqube-mcp-server binaries page.

Manual installation

After you've built the SonarQube MCP Server locally, you'll need to manually install it in your MCP client. 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

To connect to a SonarQube Cloud organization in the US region, add "SONARQUBE_URL": "https://sonarqube.us" to the env block.

Warning: User tokens are required when setting up connected mode or an MCP server between SonarQube Server and SonarQube for IDE. 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 an MCP server between SonarQube Server and SonarQube for IDE. Your binding won't function properly if you use project tokens, global tokens, or scoped organization tokens during setup.

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?