SonarQube MCP Server

Provides seamless integration with SonarQube Server or Cloud, and enables analysis of code snippets directly within the agent context

Remote serverstreamable-http

What is the SonarQube MCP server?

If you want an AI assistant working directly with SonarQube, the sonarqube mcp server is the bridge. Provides seamless integration with SonarQube Server or Cloud, and enables analysis of code snippets directly within the agent context.

What SonarQube does

The SonarQube MCP Server is a Model Context Protocol (MCP) server that enables seamless integration with SonarQube Server or Cloud for code quality and security. It also supports the analysis of code snippet directly within the agent context.

Tools it exposes

Once connected, the assistant can call these 9 tools directly:

  • SONARQUBE_TOKEN — Your SonarQube Cloud token
  • SONARQUBE_ORG — Your organization key
  • SONARQUBE_URL — (Optional) Set to https://sonarqube.us for SonarQube Cloud US
  • STORAGE_PATH — Mandatory absolute path to a writable directory where SonarQube MCP Server will store its files (e.g., for creation, updates, and persistence), it is
  • SONARQUBE_PROJECT_KEY — Optional default project key. When set, all tools that require a project key will use this value automatically — the projectKey parameter is removed from their
  • SONARQUBE_IDE_PORT — Optional port number between 64120 and 64130 used to connect SonarQube MCP Server with SonarQube for IDE
  • SONARQUBE_DEBUG_ENABLED — When set to true, enables debug logging. Debug logs are written to both the log file and STDERR. Useful for troubleshooting connectivity or configuration
  • SONARQUBE_LOG_TO_FILE_DISABLED — When set to true, disables writing logs to disk entirely. No log files will be created under STORAGE_PATH/logs/. Useful in containerized or ephemeral
  • Base — You should add the following variable when running the MCP Server:

Installing the sonarqube mcp server

The server is distributed via a container image as sonarsource/sonarqube-mcp, so most clients can run it without a manual build step. Add it to your MCP client's configuration and restart the client to pick it up — the copy-paste configs for Claude Desktop, Claude Code and Cursor are on this page.

Configuration

Before the server will start you need to supply 8 environment variables: SONARQUBE_TOKEN, SONARQUBE_ORG, SONARQUBE_URL, SONARQUBE_IDE_PORT, YOUR_TOKEN, YOUR_USER_TOKEN, YOUR_SERVER_URL, SONAR_TOKEN. Keep credentials in your client's env block or a secrets manager rather than committing them.

Where it fits

Developer-tool servers are usually the first ones people connect, because they turn "help me with this code" into an assistant that can actually read the repo and act on it. SonarQube sits in that group, and the shape of its toolset — SONARQUBE_TOKEN, SONARQUBE_ORG, SONARQUBE_URL among others — tells you what it is really for. Worth comparing against the other developer tools servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This is a hosted server — you point your client at an endpoint rather than running a local process, so there is nothing to keep updated on your machine.
  • It will not start until its required credentials are present, so set those before wondering why the tools never appear.
  • With 9 tools exposed, expect a noticeable bump in prompt size — disable it in projects that never use SonarQube.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the sonarqube mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
SONARQUBE_TOKENYour SonarQube Cloud token
SONARQUBE_ORGYour organization key
SONARQUBE_URL(Optional) Set to https://sonarqube.us for SonarQube Cloud US
STORAGE_PATHMandatory absolute path to a writable directory where SonarQube MCP Server will store its files (e.g., for creation, updates, and persistence), it is automatically provided when using the container image
SONARQUBE_PROJECT_KEYOptional default project key. When set, all tools that require a project key will use this value automatically — the projectKey parameter is removed from their schema entirely. Useful when working on a single project.
SONARQUBE_IDE_PORTOptional port number between 64120 and 64130 used to connect SonarQube MCP Server with SonarQube for IDE.
SONARQUBE_DEBUG_ENABLEDWhen set to true, enables debug logging. Debug logs are written to both the log file and STDERR. Useful for troubleshooting connectivity or configuration issues. Default: false.
SONARQUBE_LOG_TO_FILE_DISABLEDWhen set to true, disables writing logs to disk entirely. No log files will be created under STORAGE_PATH/logs/. Useful in containerized or ephemeral environments where file logging is undesirable. Default: false.
BaseYou should add the following variable when running the MCP Server:

How to install the SonarQube MCP server

{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": ["run", "--init", "--pull=always", "-i", "--rm", "-e", "SONARQUBE_TOKEN", "-e", "SONARQUBE_ORG", "sonarsource/sonarqube-mcp"],
      "env": {
        "SONARQUBE_TOKEN": "<YOUR_TOKEN>",
        "SONARQUBE_ORG": "<YOUR_ORG>"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
SONARQUBE_TOKENCredential the server authenticates with.Yes
SONARQUBE_ORGConfiguration value read at startup.Optional
SONARQUBE_URLEndpoint or connection string the server talks to.Yes
SONARQUBE_IDE_PORTConfiguration value read at startup.Optional
YOUR_TOKENCredential the server authenticates with.Yes
YOUR_USER_TOKENCredential the server authenticates with.Yes
YOUR_SERVER_URLEndpoint or connection string the server talks to.Yes
SONAR_TOKENCredential the server authenticates with.Yes

Example prompts to try

  • Use SonarQube to SONARQUBE TOKEN.
  • Use SonarQube to SONARQUBE ORG.
  • Use SonarQube to SONARQUBE URL.

Frequently asked questions

It connects SonarQube to MCP-compatible AI assistants such as Claude and Cursor, exposing 9 tools (SONARQUBE_TOKEN, SONARQUBE_ORG, SONARQUBE_URL, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with SonarQube directly.