Delv
Official (Vendor)Active· 5dby Sonar

SonarQube MCP Server

Sonar's official MCP server connects AI agents to SonarQube Server or SonarQube Cloud for code quality and security, and can analyse code snippets in the agent's context. It runs from a container image.

Install

claude mcp add sonarqube \
  --env SONARQUBE_TOKEN=$SONAR_TOKEN \
  --env SONARQUBE_ORG=$SONAR_ORG \
  -- docker run --init --pull=always -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_ORG sonarsource/sonarqube-mcp
Paste into your host's MCP config:
{
  "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>"
      }
    }
  }
}
Env vars needed: SONARQUBE_TOKENSONARQUBE_ORGSONARQUBE_URL

Review

Written from the maker's own published material. Not a hands-on test.

The SonarQube MCP Server is Sonar's Model Context Protocol server for code quality and security. The repository says it integrates with SonarQube Server or SonarQube Cloud and can also analyse code snippets directly within the agent context. The simplest documented method is the container image sonarsource/sonarqube-mcp. The repository suggests using the plain name with --pull=always for automatic updates, or pinning a version tag for reproducible deployments. Setup needs a SonarQube user token, plus an organisation key for SonarQube Cloud or a server URL for SonarQube Server. SonarQube Cloud US uses https://sonarqube.us. For Claude Code, the repository gives a claude mcp add command that runs the image through docker and passes the token and organisation as environment variables. Sections also cover Antigravity, which lists the server in its MCP Store, and Codex CLI. Sonar offers a configuration generator at https://mcp.sonarqube.com/config-generator.html that produces config for a chosen client. The repository advises keeping the token out of shell history and version control, for example by setting it as an environment variable first. Check that Docker or another OCI-compatible container runtime is installed, as the examples rely on it. It suits developers and teams that already analyse code with SonarQube and want issues, quality gates and snippet analysis available from their coding assistant.
Verdict

Teams that use SonarQube Server or Cloud with a coding assistant should look at it. Check Docker availability and how the user token is stored first.

Good at

  • Works with SonarQube Server and SonarQube Cloud.
  • Can analyse code snippets within the agent context.
  • Setup commands are documented for Claude Code, Codex CLI and Antigravity.
  • A configuration generator is provided.
  • Published as a container image with version tags.

Watch out

  • Needs a SonarQube user token and, for Cloud, an organisation key.
  • The documented setup relies on Docker or a compatible runtime.
  • Keep the token out of shell history and committed files.
  • Check which Sonar licence terms apply, as the repository lists its licence as other.

Use cases

  • Check code quality during an agent session
  • Review security issues in a project
  • Analyse a snippet before committing
  • Generate client config with the configuration generator

Getting started

1. Install Docker or another OCI-compatible container runtime. 2. Create a SonarQube user token and note your organisation key (Cloud) or server URL (Server). 3. Set the token and organisation as environment variables, then run the claude mcp add command. 4. For SonarQube Server, use SONARQUBE_URL in place of SONARQUBE_ORG. For Cloud US, set it to https://sonarqube.us. 5. Alternatively, use the configuration generator at https://mcp.sonarqube.com/config-generator.html.

Works with

Claude CodeCodexOther

Similar MCPs