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

Environment considerations

This page outlines the various setups and transport modes available when running the SonarQube MCP Server, which allows its integration with a variety of clients.

The SonarQube MCP Server supports several setup options. Choose the one that best suits your workflow, then head to the IDE/CLI quickstart guides to get started.

Hosting method

When you self-host the SonarQube MCP Server, it runs from the official container image at sonarsource/sonarqube-mcp on Docker Hub. It's also available on the GitHub MCP Registry.

SonarQube Cloud-hosted and SonarQube Server-hosted setups are also available.

When to use the SonarQube Cloud-hosted MCP Server

Use this setup when you want the fastest path to connect from a client.

  • No local or shared server deployment is required.

  • SonarQube Cloud manages the server version for you.

  • Clients connect directly to the hosted MCP endpoint.

  • Sign in with OAuth from one of the supported OAuth clients, or send a SonarQube user token. See SonarQube Cloud-hosted.

  • You get a smaller, fixed subset of tools.

Sonar Vortex analysis and context features require a local MCP server.

For more information, see SonarQube Cloud-hosted.

When to use the SonarQube Server-hosted MCP Server

Use this setup when you run SonarQube Server 2026.3 or newer. It requires Developer, Enterprise, or Data Center edition.

  • You want AI agents to connect through your SonarQube Server URL.

  • You want a centrally managed MCP endpoint for your team.

  • SonarQube Server exposes the MCP tools at <YourSonarQubeURL>/mcp.

  • You do not want to manage a separate MCP endpoint for clients.

  • You need to pin an MCP Server version compatible with your SonarQube Server release.

Sonar Vortex analysis and context features require a local MCP server.

For installation and configuration details, see the SonarQube Server-hosted page.

When to use a local server

Use this setup for local development and single-user workflows.

  • The server runs over the stdio transport mode.

  • The client starts the server as a local process.

  • Configuration and authentication use environment variables.

  • You get the full MCP tool set.

  • This is the recommended default for most IDE and CLI integrations.

For more information, see Self-hosted setups.

When to use a remote server

Use this setup for shared team access and centrally managed deployments.

  • The server runs over Streamable HTTP using HTTPS or HTTP transport modes.

  • Clients connect to /mcp and send Authorization: Bearer <token>.

  • Use HTTPS for production deployments.

  • Use HTTP only in trusted, non-production environments.

  • Shared deployments also expose /health and /info.

For more information, see Self-hosted setups.

Connecting to SonarQube Cloud in the US region

Connecting your SonarQube MCP Server with your SonarQube Cloud US instance requires the use of a common variable, defined as SONARQUBE_URL=https://sonarqube.us in your configuration file. Review the MCP server's Common variables for details about the parameter.

Where possible, each of the code samples given in the IDE/CLI quickstart guides will include an example to configure SONARQUBE_URL when connecting to a SonarQube Cloud organization in the US region.

Sonar Vortex: analysis and context features

To use Sonar Vortex analysis and context features, run a local MCP server using Stdio transport because it must access the files in your working directory. In addition, you must have an active Sonar Vortex subscription on your SonarQube Cloud Team (annual) or Enterprise plan, or an active subscription in SonarQube Server 2026.5 and newer in an Enterprise or Data Center edition.

SonarQube Cloud organization in stdio mode

In stdio mode, a token without SONARQUBE_URL connects to SonarQube Cloud. You can omit SONARQUBE_ORG. If your user token belongs to exactly one organization, the server selects it at startup and keeps it as the default. Zero or multiple organizations leave the organization unresolved. Call list_organizations, then pass a key as the organization argument, or set SONARQUBE_ORG to fix one organization for the process. A tool argument applies only to that call.

Streamable HTTP mode does not select an organization at startup. For a token request, use an optional SONARQUBE_ORG header, or pass organization on the tool call. Setting SONARQUBE_ORG on the SonarQube MCP Server is deprecated. OAuth requests on the hosted Cloud server reject that header and use the tool organization argument. See SONARQUBE_ORG and Troubleshooting.

Run from JAR or build from source

To run the server without Docker, download a pre-built JAR from the SonarSource binaries repository. You can also build from source using JDK 21+ and Gradle. See Build for the complete details.

Custom certificates

If your instance of SonarQube Server uses a self-signed certificate or a certificate from a private Certificate Authority (CA), add custom certificates to the container.

The container supports the following certificate formats:

  • .crt files (PEM or DER encoded)

  • .pem files (PEM encoded)

Warning: User tokens are required when setting up connected mode or your SonarQube MCP server with SonarQube (Server, Cloud). Your binding will not function properly if you use project tokens, global tokens, or scoped organization tokens during setup.

Using a volume mount

Mount a directory containing your certificates when running the container:

Custom certificates (JSON config)

When using custom certificates, modify your MCP configuration to mount them. The following example shows a connection to SonarQube Server or SonarQube Community Build:

Note: When you run from JAR instead of the container, the volume mount above installs certificates into the container's OS trust store, which the server also reads. If you cannot use the OS trust store (notably on Windows, where it is not consulted), point the JVM at a Java truststore holding the CA certificate: -Djavax.net.ssl.trustStore=/path/to/truststore.p12 -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=<passphrase>. It is added on top of the default trusted certificates.

Client certificate (mutual TLS)

If your SonarQube Server requires clients to present a certificate during the TLS handshake (mutual TLS), provide a PKCS12 keystore by mounting it into the container and passing its location via JAVA_OPTS.

Using a PKCS12 keystore

Mount your .p12 or .pfx file into the container and set the JAVA_OPTS environment variable with the keystore properties:

Note: The certificate file must be readable by the container process. Check and fix permissions if needed:

Omit -Djavax.net.ssl.keyStorePassword if the keystore has no passphrase. The passphrase used here is visible through docker inspect or the process list.

Using a PKCS12 keystore (JSON config)

Using a PKCS12 keystore with a standalone JAR

When you run from JAR, pass the keystore properties as JVM arguments before -jar:

Omit -Djavax.net.ssl.keyStorePassword if the keystore has no passphrase.

Client certificate with a standalone JAR (JSON config)

Note: PEM certificate and key files (separate .crt/.key files) must be converted to PKCS12 format first. Use openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12 to convert them.

Proxy

The SonarQube MCP Server supports HTTP proxies through standard Java proxy system properties.

Configure proxy settings

Configure proxy settings using Java system properties. These can be set as environment variables or passed as JVM arguments.

Common proxy properties

Property
Description
Example

http.proxyHost

HTTP proxy hostname

proxy.example.com

http.proxyPort

HTTP proxy port

8080

https.proxyHost

HTTPS proxy hostname

proxy.example.com

https.proxyPort

HTTPS proxy port

8443

http.nonProxyHosts

Hosts that bypass the proxy (pipe-separated)

localhost|127.0.0.1|*.internal.com

Proxy authentication

If your proxy requires authentication, the SonarQube MCP Server uses Java's standard authentication mechanism. Set up proxy credentials using Java system properties:

Property
Description
Example

http.proxyPassword

HTTP proxy password

yourpassword

http.proxyUser

HTTP proxy username

yourusername

https.proxyPassword

HTTPS proxy password

yourpassword

https.proxyUser

HTTPS proxy username

yourusername

Need help?

The environment options above cover most use cases. If you're having trouble with your configuration, visit the Help page to get in touch with us, or review the Troubleshooting page for common issues.

Last updated

Was this helpful?