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

SonarQube Server-hosted

Install and configure the SonarQube MCP Server extension on SonarQube Server.

Overview

The SonarQube MCP Server can be installed as an extension on SonarQube Server. Once installed, SonarQube Server acts as a proxy and exposes the MCP server's tools at <YourSonarQubeURL>/mcp. Your AI agent connects to that single endpoint: no separate MCP server URL to manage.

If an administrator hasn't yet set up the MCP server on your SonarQube Server instance, start with Install the MCP server. Once it's running, see Connect your AI agent to configure your agent.

Note: The SonarQube Server MCP extension is available on all commercial editions: Developer, Enterprise, and Data Center Edition.

Note: If you use SonarQube for IDE, its AI Integrations setup workflow only configures a self-hosted MCP server. Once an administrator has installed the MCP server, follow the Connect your AI agent instructions on this page to connect to this Server-hosted MCP server instead.

Prerequisites

  • SonarQube Server 2026.3 or later

Warning: Sonar Vortex's analysis and context features require file system access and don't work with the SonarQube Server-hosted MCP server. To set them up, the recommended methods are the SonarQube plugin or SonarQube CLI. See the Sonar Vortex analysis and Sonar Vortex context pages.

Install the MCP server

Once the SonarQube MCP Server extension is installed, SonarQube Server acts as a proxy and exposes the MCP server's tools at /mcp. Your AI coding agent connects to that single endpoint. There's no separate MCP server URL to manage.

Select the installation method that matches how you run SonarQube Server.

Choose the right MCP version

The MCP version you need depends on your installation method, not only your SonarQube Server version:

  • Docker (Full Docker Compose or Hybrid): use the 3-part MCP image tag built from your SonarQube Server's 2-part major.minor version, for example 2026.5.<YourLatestPatchVersion> for SonarQube Server 2026.5. This tag scheme is available starting with SonarQube Server 2026.5. If you run SonarQube Server 2026.4 or 2026.3, use the Compatibility table's version instead.

  • Kubernetes or OpenShift: the Helm chart manages the MCP version for you; no manual version or tag is required.

  • JAR: always use the exact MCP Server version from the Compatibility table.

In the MCP Docker tag (for example, 2026.5.<YourLatestPatchVersion>), <YourLatestPatchVersion> is a placeholder: find the newest compatible MCP patch release for that SonarQube Server line on the SonarSource MCP Docker registry and use its patch number. The MCP patch number doesn't need to match the SonarQube Server patch number, for example MCP 2026.5.1 with SonarQube Server 2026.5.0.

Install the MCP from Docker image

Prerequisites

  • SonarQube Server 2026.3 or later

  • Docker / Docker Compose

  • Use the 3-part MCP image tag built from your SonarQube Server's 2-part major.minor version. Find all tags on the SonarSource MCP Docker registry. For example, use the 2026.5.<YourLatestPatchVersion> tag for SonarQube Server 2026.5. If you are running SonarQube Server 2026.4 or 2026.3, use the Compatibility table's version to find the correct MCP version.

Note: The examples below use Docker Compose. You can replace any of them with equivalent plain docker run commands if you prefer.

Option 1: Full Docker Compose (Developer and Enterprise edition)

Add an mcp service alongside your sonarqube service and pass the MCP connection properties as environment variables on the SonarQube Server container. The example below uses the Developer edition — replace the tag developer with enterprise to deploy the Enterprise edition instead.

See an example on GitHub.

For SonarQube MCP environment variables, see the Configuration reference section.

MCP container environment variables:

Variable
Example
Description

STORAGE_PATH

/data

Writable directory for MCP logs, plugins, and temp files

SONARQUBE_URL

http://sonarqube:9000

Example URL of the SonarQube Server instance that the MCP server connects to

SONARQUBE_HTTP_PORT

8080

Port the MCP server listens on

SONARQUBE_TRANSPORT

http

Transport mode

Option 2: Full Docker Compose (Data Center edition)

See an example on GitHub.

MCP container environment variables:

Variable
Example
Description

STORAGE_PATH

/data

Writable directory for MCP logs, plugins, and temp files

SONARQUBE_URL

http://sonarqube:9000

Example URL of the SonarQube Server instance that the MCP server connects to

SONARQUBE_HTTP_PORT

8080

Port the MCP server listens on

SONARQUBE_TRANSPORT

http

Transport mode

Option 3: Hybrid (SonarQube Server from ZIP + MCP as Docker container)

Use this option when SonarQube Server is installed from a ZIP archive and you want to run the MCP server as a Docker container.

Step 1: Configure SonarQube Server

In conf/sonar.properties, set:

Then restart SonarQube Server for the changes to take effect.

Step 2: Start the MCP container

Replace <YourSonarQubeHostname> with the hostname or IP address reachable from within the container.

Install on Kubernetes or OpenShift

See the SonarQube Server documentation for instructions to install SonarQube Server on Kubernetes or OpenShift.

  1. Add the SonarQube Helm chart repository:

  2. Enable MCP in your Helm values file. When mcp.enabled is set to true, the chart automatically deploys the MCP server as a separate pod alongside SonarQube and wires both services together via SONAR_MCP_ENABLED and SONAR_MCP_SERVERURL:

    See the full list of mcp.* values in the SonarQube Helm chart README.

  3. Deploy or upgrade your SonarQube Helm chart:

Optional TLS encrypted communication

To enable an extra level of security, set mcp.tls.enabled to true. The MCP server starts in HTTPS mode using the keystore from mcp.tls.keystoreSecretName. Application nodes connect to it over https://.

If the keystore uses a self-signed certificate, SonarQube's JVM will reject the connection unless the CA certificate is trusted. Use the caCerts feature to import it into SonarQube's JVM truststore:

  1. Create a Secret containing the CA certificate in PEM format:

  2. Reference it in your values:

Install on Kubernetes or OpenShift for Data Center edition

See the SonarQube Server documentation for instructions to install SonarQube Server on Kubernetes or OpenShift for Data Center edition.

  1. Add the SonarQube Helm chart repository:

  2. Enable MCP in your Helm values file. When mcp.enabled is set to true, the chart automatically deploys the MCP server as a separate pod alongside SonarQube and wires both services together via SONAR_MCP_ENABLED and SONAR_MCP_SERVERURL:

    See the full list of mcp.* values in the SonarQube DCE Helm chart README.

  3. Deploy or upgrade your SonarQube DCE Helm chart:

Optional TLS encrypted communication

To enable an extra level of security, set mcp.tls.enabled to true. The MCP server starts in HTTPS mode using the keystore from mcp.tls.keystoreSecretName. Application nodes connect to it over https://.

If the keystore uses a self-signed certificate, SonarQube's JVM will reject the connection unless the CA certificate is trusted. Use the caCerts feature to import it into SonarQube's JVM truststore:

  1. Create a Secret containing the CA certificate in PEM format:

  2. Reference it in your values:

Install the MCP from ZIP file

Prerequisites

  • SonarQube Server 2026.3 or later

  • JDK 21 or later (required to run the MCP server JAR)

Compatibility

SonarQube Server version
Compatible MCP Server version

2026.5

1.27.0.4335

2026.4

1.22.0.3040

2026.3

1.18.1.2664

Always set MCP_VERSION to the full 4-part version from the compatibility matrix (for example, use 1.27.0.4335 with SonarQube Server 2026.5).

Configure MCP properties in your SonarQube Server instance

In your conf/sonar.properties file, set the following properties:

  • sonar.mcp.enabled: enables or disables the MCP proxy (default: true)

  • sonar.mcp.serverUrl: the URL where the MCP server will be running

  • sonar.mcp.healthCheckInterval (optional): health check interval (default: 30s)

Then restart SonarQube for the changes to take effect.

Find the full list of available properties in the Configuration reference section.

Start the MCP server

Step 1: Download the JAR

Download the MCP server JAR. Check the compatible version for your SonarQube Server version in the Compatibility table. All versions of the SonarQube MCP Server are available on the binaries page, or add your version into the code sample below to download directly:

Step 2: Create a storage directory

The MCP server needs a writable directory to store its files (logs, plugins, tmp, etc.):

Step 3: Set environment variables

See the Environment variables page if needed.

Step 4: Run the MCP server

Optional: Script for steps 1–4

Group steps 1–4 in a script named run-mcp-server.sh:

Then make the script executable and run it:

Step 5: Run as a service (optional)

On Linux with systemd

Install the MCP server as a service on a Unix system using systemd; you cannot run it as root. To install using systemd, create a dedicated account for running the MCP server. Here's an example:

  • The Java Virtual Machine is installed in /opt/java/

  • The MCP server JAR has been downloaded into /opt/sonarqube-mcp/

Then create the file /etc/systemd/system/sonarqube-mcp.service based on the following:

Note:

  • Because the sonarqube-mcp-server jar name ends with the version of the MCP server, you will need to adjust the ExecStart command accordingly on install and at each upgrade.

  • All MCP server directories should be owned by the sonarqube user.

  • If you have multiple Java versions, you will need to modify the java path in the ExecStart command. This also means SONAR_JAVA_PATH will not work with the MCP server running as a service.

Once your sonarqube-mcp.service file is created and properly configured, run:

On Windows

Use the Windows Service Control Manager or a tool such as NSSM to register the MCP server JAR as a Windows service. Set the environment variables from Step 3 in the service configuration.

Configuration reference

The following properties configure the MCP proxy on SonarQube Server. Set them in conf/sonar.properties or as environment variables on the SonarQube container.

System property (sonar property and ENVIRONMENT_VARIABLE)
Description

sonar.mcp.enabled SONAR_MCP_ENABLED

Enables or disables the MCP proxy. (default: true)

sonar.mcp.serverUrl SONAR_MCP_SERVERURL

The URL where the MCP server will be running.

sonar.mcp.healthCheckInterval SONAR_MCP_HEALTHCHECKINTERVAL

Health check interval. (default: 30s) (optional)

Connect your AI agent

Once the MCP server extension is running, configure your AI agent to connect to it.

Step 1: Generate a user token

In SonarQube Server, go to My Account > Security and generate a user token.

Step 2: Configure your agent

Use the official SonarQube MCP Server configuration generator to get a configuration snippet for your setup:

  1. Identify your target MCP client.

    • Select SonarQube Server as your instance.

    • Use environment variable substitution to pass your token, or enter your SonarQube Server user token directly in the User token (optional) field.

  2. Choose a hosting method:

    • Select Remote server (HTTP).

    • Fill the full server URL with https://<YourSonarQubeURL>/mcp. Don't add a trailing slash.

  3. Copy the configuration and paste it into your terminal.

    • Optional: To make the MCP server available globally and not only for the repo where the command has been run, append --scope user to your CLI command.

    • Optional: Verify that the SonarQube entry has been added to your agent configuration file with your user token and the new URL.

  4. Restart your agent after saving the configuration and run /mcp to verify it's working.

Check the status

After installation, verify the extension is running correctly. In SonarQube Server 2026.5 and later, go to Administration > System > Agentic Containers > MCP and check the Enabled and Healthy statuses. In earlier versions, go to Administration > System > System Info > MCP.

Last updated

Was this helpful?