# Sonarqube MCP

> Sonarqube MCP is an open-source MCP server for developer tools. MCP server giving coding agents read and triage access to SonarQube Cloud quality data. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, macOS, Linux, Windows
- **Repository:** https://github.com/lahma/sonarqube-mcp
- **MCP Registry name:** io.github.lahma/sonarqube-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-19

## About

The README describes a Model Context Protocol server that connects coding agents to SonarQube Cloud, the hosted code-quality service. It exposes quality gate verdicts, analysis status, issue search and aggregation, security hotspots, per-file measures, per-line coverage and rule explanations through a set of read tools.

The server is written in C# on .NET 10 and ships as a Native AOT binary per platform, so there is no runtime to install. Five write tools (issue transitions, assignments, comments and hotspot reviews) are available, and setting SONARQUBE_MCP_READ_ONLY=1 removes them from the tool list entirely. A user token from the SonarQube Cloud account is needed for private projects and for any write action; public projects can be read without one.

It suits developers and teams who use an agent to work through failing quality gates on pull requests or to triage findings in an organization's SonarQube Cloud projects. SonarQube Server (self-hosted and Data Center) is explicitly out of scope.

## Features

- **Quality gate verdicts:** Reports the gate status for a project, branch or pull request along with the failing conditions and measured values.
- **Issue search and triage:** Searches open issues with file paths, lines and rules, and supports transitions, assignment and comments when write tools are enabled.
- **Per-file coverage lines:** Returns the line numbers that tests never executed or only partly covered for a given file, without returning source text.
- **Security hotspot review:** Lists hotspots awaiting review with their vulnerability probability and records review decisions.
- **Read-only mode:** An environment flag removes all write tools from registration so a client cannot call them.
- **Native single binary:** Distributed as a self-contained Native AOT executable per platform, also installable through NuGet with dnx.

## Good for

- Working through a pull request whose SonarQube quality gate has failed
- Finding the files with the most uncovered lines in an organization's projects
- Looking up what a SonarQube rule flags and how to fix it
- Triaging open issues by severity, author or rule without paging through results
- Reviewing security hotspots and recording a decision from an agent session

## Install

### Claude Code (Terminal)

```sh
claude mcp add sonarqube-mcp --env SONARQUBE_TOKEN='<SONARQUBE_TOKEN>' -- dnx mcp-sonarqube --yes
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "sonarqube-mcp": {
      "command": "dnx",
      "args": [
        "mcp-sonarqube",
        "--yes"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "sonarqube-mcp": {
      "command": "dnx",
      "args": [
        "mcp-sonarqube",
        "--yes"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "sonarqube-mcp": {
      "type": "stdio",
      "command": "dnx",
      "args": [
        "mcp-sonarqube",
        "--yes"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "sonarqube-mcp": {
      "command": "dnx",
      "args": [
        "mcp-sonarqube",
        "--yes"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "sonarqube-mcp": {
      "command": "dnx",
      "args": [
        "mcp-sonarqube",
        "--yes"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

## Tools

- `listProjects`: Lists the projects in the configured organization with their project keys.
- `listComponents`: Lists analysed files and directories with component keys and project-relative paths.
- `listBranches`: Lists analysed branches with last analysis date, issue counts and gate status.
- `listPullRequests`: Lists analysed pull requests with gate status and new-code issue counts.
- `getQualityGateStatus`: Reads the quality gate verdict and failing conditions for a project, branch or pull request.
- `getAnalysisStatus`: Shows queued, running and recently finished analyses and any errors.
- `searchIssues`: Searches issues with file paths, lines, messages, rules and clean-code impacts.
- `summarizeIssues`: Counts issues grouped by rule, file, directory, severity and other facets.
- `getIssue`: Returns one issue in full, including comments and available transitions.
- `getIssueChangelog`: Returns an issue's history of status, resolution and assignee changes.
- `getRule`: Explains a rule, what it flags and how to fix it.
- `searchHotspots`: Searches security hotspots with vulnerability probability.
- `getHotspot`: Returns one hotspot in full, including risk and review history.
- `getComponentMeasures`: Reads named metrics for a project, directory or file.
- `listComponentMeasures`: Lists metrics for every component under a project or directory, sortable by metric.
- `getMeasuresHistory`: Returns metric time series over the analysis history.
- `listMetrics`: Lists the metric catalogue with descriptions.
- `getFileCoverage`: Returns per-line coverage for one file, excluding source text.
- `transitionIssue`: Applies a triage transition to an issue with an optional comment.
- `assignIssue`: Assigns an issue to a login or clears the assignee.
- `addIssueComment`: Posts a comment on an issue.
- `setHotspotStatus`: Records a hotspot review decision with a justification comment.
- `bulkUpdateIssues`: Applies one transition, assignment and/or comment to up to 500 issues.

## FAQ

### Does it work without an API token?

Yes. The server starts without SONARQUBE_TOKEN and can read public projects anonymously, but private projects and all write tools need a user token.

### Does it support self-hosted SonarQube Server?

No. The README says SonarQube Server, including self-hosted and Data Center editions, is out of scope; only SonarQube Cloud hosts are accepted.

### What license is it under?

The README states it is MIT licensed.

### How can write tools be disabled?

Setting SONARQUBE_MCP_READ_ONLY to 1 means the five write tools are not registered and are absent from tools/list.

### Is Sonarqube MCP free?

Yes. Sonarqube MCP is open source, so you can use and self-host it for free.

### How do I add Sonarqube MCP to Claude Code?

Run this command in your terminal: claude mcp add sonarqube-mcp --env SONARQUBE_TOKEN='<SONARQUBE_TOKEN>' -- dnx mcp-sonarqube --yes

### What are the best alternatives to Sonarqube MCP?

The closest alternatives to Sonarqube MCP are MCPProxy, Bitbucket MCP, Enterprise MCP Gateway, M00N Report and Qai Consultant MCP.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [MCPProxy](https://ai-powered.com/mcp/mcpproxy): MCPProxy is an open-source MCP server for developer tools.
- [Bitbucket MCP](https://ai-powered.com/mcp/bitbucket-mcp-4): Bitbucket MCP is an open-source MCP server for developer tools.
- [Enterprise MCP Gateway](https://ai-powered.com/mcp/enterprise-mcp-gateway-3): Enterprise MCP Gateway is an open-source MCP server for developer tools.
- [M00N Report](https://ai-powered.com/mcp/m00n-report): M00N Report is an open-source MCP server for developer tools.
- [Qai Consultant MCP](https://ai-powered.com/mcp/qai-consultant-mcp): Qai Consultant MCP is an open-source MCP server for developer tools.
- [CueApril](https://ai-powered.com/mcp/cueapril): CueApril is an MCP server for developer tools.
- [Qualien MCP](https://ai-powered.com/mcp/qualien-mcp): Qualien MCP is an open-source MCP server for developer tools.
- [Dotnet Template MCP](https://ai-powered.com/mcp/dotnet-template-mcp): Dotnet Template MCP is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/sonarqube-mcp-2
