SonarQube MCP
Provides read-only tools for inspecting a SonarQube instance: explains why a project's quality gate is red (listing failing conditions), searches unresolved issues filtered by severity, type, status, branch, pull request or new code, reads measures such as coverage and bugs, fetches source lines around an issue, and lists branches and accessible projects.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SonarQube MCP why is the quality gate red on my-project?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐
SonarQube MCP
MCP server for SonarQube โ explain a red quality gate, search issues, read measures and source snippets.
Website ยท Documentation
Features
Red gate, explained โ status, new-code period and every condition, with the failing ones listed first and ratings shown as AโE
Issue search โ filter a project's unresolved issues by severity, type, status, branch, pull request or new code, each with file, line, rule, message, author and date
Measures on demand โ read any metric (
coverage,bugs,new_coverage,sqale_rating) for a project, branch or pull requestSource in context โ fetch the lines around an issue without leaving your MCP client
Strictly read-only โ all six tools are annotated read-only and idempotent; nothing in SonarQube is ever changed
Token stays private โ it is never returned, and is redacted from any error message
Zero-install usage โ run directly via
npx -y @kud/mcp-sonarqube@latest
Related MCP server: sonarqube-api-mcp
Install
npm install -g @kud/mcp-sonarqubeOr use without installing via npx (see Configuration below). Requires Node.js 22 or later.
Usage
Set the host and a token, then start the server over stdio:
SONAR_HOST_URL=https://sonarqube.example.com \
SONAR_TOKEN=your-token \
npx -y @kud/mcp-sonarqube@latestYour MCP client then exposes six tools:
Tool | What it does | Inputs |
| Explains why a quality gate is red, failing conditions first |
|
| Searches unresolved issues |
|
| Reads measures such as |
|
| Shows the source lines around an issue |
|
| Lists branches with quality gate status and last analysis date |
|
| Lists or searches the projects the token can see |
|
A few details worth knowing:
severitiesacceptsINFO,MINOR,MAJOR,CRITICAL,BLOCKER;typesacceptsCODE_SMELL,BUG,VULNERABILITY.statusesdefaults to unresolved issues.limitdefaults to 10 for issues and 50 for projects, with a maximum of 500.sonarqube_issue_sourcetakes thecomponentandlineexactly assonarqube_issuesreturns them, for examplemy-project:src/index.ts.contextLinesdefaults to 5, maximum 50.
Typical questions to put to your client: "why is the gate red on my-project?", "list the blocker bugs in new code on pull request 42", "what is the new coverage on the main branch?".
Configuration
SonarQube MCP works with any MCP-compatible client โ Claude Desktop, Cursor, Cline, Zed, Continue, and others. Register it in your client's MCP server configuration:
{
"mcpServers": {
"sonarqube": {
"command": "npx",
"args": ["-y", "@kud/mcp-sonarqube@latest"],
"env": {
"SONAR_HOST_URL": "https://sonarqube.example.com",
"SONAR_TOKEN": "<your-token>"
}
}
}
}The config file and its exact location depend on your client. Claude Desktop, for example, uses claude_desktop_config.json (Settings โ Developer โ Edit Config).
For a self-hosted instance on your own machine, point the host at it directly, for example http://127.0.0.1:9000.
Claude Code plugin
If you use Claude Code, the server is also available as the sonarqube plugin from the kud/claude-plugins marketplace:
/plugin marketplace add kud/claude-plugins
/plugin install sonarqube@kudEnvironment variables
Configuration is resolved by the @kud/sonarqube core. The first variable set wins; there is no default host, and the server exits at start-up without one.
Setting | Environment variables, in order | Required |
Host |
| Yes |
Token |
| Yes, for private projects |
Both can also come from the config file shared with the sonarqube-dash CLI, at $XDG_CONFIG_HOME/sonarqube-dash-cli/config.json (default ~/.config/sonarqube-dash-cli/config.json), using the keys host and token. Environment variables take precedence over the file.
Development
git clone https://github.com/kud/mcp-sonarqube.git
cd mcp-sonarqube
npm install
npm run devTo test interactively with the MCP Inspector:
npm run inspect:devAll HTTP, authentication and config resolution live in the @kud/sonarqube core; this package only validates tool input, calls the client and shapes the output.
๐ Full documentation โ mcp-sonarqube/docs
Available Tools
6 toolssonarqube_branchesARead-onlyIdempotent
List a project's branches with their quality gate status and last analysis date
Inputs: project (required).
sonarqube_issuesBRead-onlyIdempotent
Search a project's unresolved issues with file, line, rule, severity, type, message, author and creation date
Inputs: project (required), limit, types, branch, +4 more.
sonarqube_issue_sourceARead-onlyIdempotent
Show the source lines around a line of a component, as returned by sonarqube_issues (component and line)
Inputs: line (required), component (required), contextLines.
sonarqube_measuresBRead-onlyIdempotent
Read measures for a project, e.g. coverage, bugs, new_coverage, reliability_rating (ratings shown as A-E)
Inputs: project (required), metricKeys (required), branch, pullRequest.
sonarqube_projectsARead-onlyIdempotent
List or search projects the token can see
Inputs: limit, query.
sonarqube_quality_gateARead-onlyIdempotent
Explain why a quality gate is red: status, new-code period, and conditions with the failing ones first (ratings as A-E)
Inputs: project (required), branch, pullRequest.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 6 tools
Most tools target clearly distinct resources: projects, branches, issues, issue source, measures, and quality gate. There is some potential overlap between sonarqube_quality_gate and sonarqube_measures because both surface ratings/metrics, and sonarqube_branches also includes quality gate status, but the descriptions make their scopes sufficiently distinct.
All tools use a consistent sonarqube_ prefix and snake_case resource-oriented naming. The convention is predictable throughout, with no mixed camelCase or inconsistent verb styles.
Six tools is well within the appropriate range and each tool maps to a core read-only SonarQube workflow. The surface is focused without obvious redundant tools.
The set covers project discovery, branches, unresolved issues, source context, measures, and quality gate explanation, forming a coherent triage workflow. Minor gaps exist for adjacent SonarQube data such as security hotspots and rule metadata, but core agent needs are covered.
Maintenance
Related MCP Connectors
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
Read-only MCP access to a documented IT fleet: state, changes, posture. 15 tools.
Security scanning for code, containers and IaC: request scans, read findings, report fixes.
30+ deterministic dev and delivery tools: linting, metrics, diagrams, model advice, AI-text checks.
Related MCP Servers
- FlicenseAqualityDmaintenanceA read-only MCP server that provides AI assistants with structured access to SonarQube projects, issues, metrics, and rules. It enables safe analysis of code quality and security findings through a set of validated, safety-first tools.6-
- AlicenseBqualityDmaintenanceRead-only MCP server that exposes SonarQube Web API tools for issue retrieval, quality gate status, and source context, enabling coding agents to fix code issues.8166 npm1MIT
- FlicenseNot gradedqualityDmaintenanceEnables access to SonarQube code quality analysis through MCP, including issue searching, metrics retrieval, and quality gate status.-

SonarQube MCP Serverofficial
FlicenseNot gradedqualityAmaintenanceEnables seamless integration with SonarQube Server or Cloud for code quality and security analysis. Supports querying project metrics, issues, and analyzing code snippets directly within the agent context.688-