Skip to main content
MCP server · Third party

SonarQube MCP Server

by SonarSource

Connects AI agents to SonarQube Server or Cloud for code quality and security analysis, so they check their own changes before handing them over. Pointed at the Tractus-X organization eclipse-tractusx on SonarQube Cloud, they check against the same rules and Quality Gates as the Tractus-X CI as they go, so agents can validate the quality of their code.

  • 17tools listed
  • 15read-only
  • 2write
Transport
stdio (default) or Streamable HTTP(S)
Runs as
Docker image sonarsource/sonarqube-mcp or a JAR
Connects to
SonarQube Cloud or SonarQube Server
Authentication
A SonarQube user token
Tractus-X organization
eclipse-tractusx on SonarQube Cloud
License
SONAR Source-Available License v1.0

Tools

The tools an AI agent can call through this server.

Analysis3

  • analyze_code_snippetRead

    Analyze a file with the SonarQube analyzers and report quality and security issues.

  • analyze_file_listRead

    Analyze a list of files through a running SonarQube for IDE.

    Used by tractusx-testlab
  • toggle_automatic_analysisRead

    Turn the automatic analysis of SonarQube for IDE on or off.

    Used by tractusx-testlab

Issues and Security Hotspots5

  • search_sonar_issues_in_projectsRead

    Search the issues in the organization's projects.

    Used by tractusx-testlab
  • change_sonar_issue_statusWrite

    Accept an issue, mark it as a false positive or reopen it.

  • search_security_hotspotsRead

    Search the Security Hotspots of a project.

  • show_security_hotspotRead

    Show a Security Hotspot with its rule, code context and comments.

  • change_security_hotspot_statusWrite

    Review a Security Hotspot by changing its status.

Projects and Quality Gates5

  • search_my_sonarqube_projectsRead

    Find projects and their exact project keys.

    Used by tractusx-testlab
  • list_branchesRead

    List the analyzed branches of a project.

  • list_pull_requestsRead

    List the pull requests of a project.

  • get_project_quality_gate_statusRead

    Get the Quality Gate status of a project.

  • list_quality_gatesRead

    List all Quality Gates.

Coverage, measures and rules4

  • search_files_by_coverageRead

    Find the files with the lowest test coverage.

  • get_file_coverage_detailsRead

    Show the uncovered lines and branches of one file.

  • get_component_measuresRead

    Get the measures of a project, directory or file.

  • show_ruleRead

    Show the details of a SonarQube rule.

A selection of the tools that matter for code changes. The server has more groups (system, webhooks, portfolios, architecture and more), and toolsets or a read-only mode can limit what an agent sees.

How it works

How the Testlab agents use it

At the start of a task they turn automatic analysis off, at the end they analyze the files they changed and turn it back on. They look up project keys instead of guessing them.

Limit the tools

Toolsets and a read-only mode narrow the tools an agent sees, so it only gets what the task needs.

Connect it

Get your SonarQube Cloud token

All Tractus-X repositories are analyzed in the SonarQube Cloud organization eclipse-tractusx, so the organization is already filled in below. You only need your own token.

  1. Sign in to SonarQube Cloud (sonarcloud.io) with your GitHub account.
  2. Open your avatar in the top right, then My Account and the Security tab.
  3. Enter a name for the token, for example "mcp-server", pick an expiry date and select Generate Token.
  4. Copy the token right away, it is only shown once. Keep it out of Git: put it in an environment variable (SONAR_TOKEN) or your password manager.

The token acts as you. Reading the public Tractus-X projects works with any account; changing the status of an issue or Security Hotspot needs the matching permission on that project.

Claude Code (SonarQube Cloud)

export SONAR_TOKEN=<your-token>

claude mcp add sonarqube \
--env SONARQUBE_TOKEN=$SONAR_TOKEN \
--env SONARQUBE_ORG=eclipse-tractusx \
-- docker run --init --pull=always -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_ORG sonarsource/sonarqube-mcp

MCP client configuration (SonarQube Cloud)

{
"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": "eclipse-tractusx"
}
}
}
}

Let agents check their own code

With the organization set to eclipse-tractusx, the agent checks against the same organization, rules and Quality Gates as the Tractus-X CI. Before it hands over a change, it looks up the project key, analyzes the files it changed, fixes what SonarQube finds and reports the Quality Gate status. Add a prompt like this to your task or to the agent instructions of your repository:

Before you finish, check your changes with the SonarQube MCP server:
1. Find the project key of this repository in the eclipse-tractusx organization.
2. Analyze every file you changed and fix the issues SonarQube reports.
3. Show the Quality Gate status of the project and any issues left in the files you touched.