Environment variables

This page presents all of the necessary SonarQube MCP Server environment values needed for your configuration.

Depending on which Sonar product you want the MCP Server to connect to and the server type you want to deploy, you will need to provide different environment variables. The variables are broken into found main categories, dependent on your environment's needs.

Common variables

Common variables are required for all configuration typologies and must be defined before starting the server. To enable full functionality irregardless of your Transport mode, use these variables to initialize and authenticate your SonarQube MCP Server:

Environment variable
Description

SONARQUBE_TOKEN

Your SonarQube Cloud token (see Managing Personal Access Tokens) or your SonarQube Server token (see Managing your tokens)

SONARQUBE_ORG

For SonarQube Cloud only.

Your SonarQube Cloud organization key

SONARQUBE_URL

For SonarQube Server or SonarQube Community Build only.

Your SonarQube Server base URL.

Base variables

Base variables are used when building and running the MCP server locally. The server needs to know how to identify the client and where the local storage location can be found. These variables are required, or not, depending on your configuration, or if for example, you are running Docker:

Environment variable
Description

STORAGE_PATH

An absolute path to a writable directory where SonarQube MCP Server will store its files (e.g., for creation, updates, and persistence). This path is automatically provided when using Docker.

SONARQUBE_IDE_PORT

Optional port number between 64120 and 64130 used to connect SonarQube MCP Server with SonarQube for IDE. See Environment variables for details.

HTTP variables

HTTP variables are used when multiple clients are connecting to a shared MCP server. Each client provides its own user token.

Environment variable
Description
Default

SONARQUBE_TRANSPORT

Set to http to enable HTTP transport

not defined (stdio)

SONARQUBE_HTTP_HOST

Host to bind. Use 127.0.0.1 for localhost. Use 0.0.0.0 for Docker.

8080

SONARQUBE_HTTP_PORT

Port number for HTTP server: 1024-65535.

127.0.0.1

If needed, information about HTTP and HTTPS Proxy settings is available on the Configure your SonarQube MCP server page.

HTTPS variables

HTTPS variables are the same as HTTP variables but with TLS encryption. HTTPS variables require an SSL certificate however, redefining the keystore parameter default values is optional.

Environment variable
Description
Default

SONARQUBE_TRANSPORT

Set to http to enable HTTP transport

not defined (stdio)

SONARQUBE_HTTP_HOST

Host to bind. Use 127.0.0.1 for localhost. Use 0.0.0.0 for Docker.

127.0.0.1

SONARQUBE_HTTP_PORT

Typically port 8443 for HTTPS.

8080

If needed, information about HTTP and HTTPS Proxy settings is available on the Configure your SonarQube MCP server page.

SSL certificate

Environment variable
Description
Default

SONARQUBE_HTTPS_KEYSTORE_PASSWORD

Keystore password. Redefining the default value is optional.

sonarlint

SONARQUBE_HTTPS_KEYSTORE_PATH

Path to keystore file (.p12 or .jks). Redefining the default value is optional.

/etc/ssl/mcp/keystore.p12

SONARQUBE_HTTPS_KEYSTORE_TYPE

Keystore type (PKCS12 or JKS). Redefining the default value is optional.

PKCS12

See also the Custom certificates article for information about supported formats and using Docker and custom configurations of your certificate.

Last updated

Was this helpful?