← Projects
MIT · Open source

mcp-sonarqube

MCP server for SonarQube: explain a red quality gate, search issues, read measures

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 request
  • Source 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

Install

npm install -g @kud/mcp-sonarqube

Or 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@latest

Your MCP client then exposes six tools:

ToolWhat it doesInputs
sonarqube_quality_gateExplains why a quality gate is red, failing conditions firstproject, branch?, pullRequest?
sonarqube_issuesSearches unresolved issuesproject, newCode?, severities?, types?, statuses?, branch?, pullRequest?, limit?
sonarqube_measuresReads measures such as coverage, bugs or new_coverageproject, metricKeys, branch?, pullRequest?
sonarqube_issue_sourceShows the source lines around an issuecomponent, line, contextLines?
sonarqube_branchesLists branches with quality gate status and last analysis dateproject
sonarqube_projectsLists or searches the projects the token can seequery?, limit?

A few details worth knowing:

  • severities accepts INFO, MINOR, MAJOR, CRITICAL, BLOCKER; types accepts CODE_SMELL, BUG, VULNERABILITY.
  • statuses defaults to unresolved issues. limit defaults to 10 for issues and 50 for projects, with a maximum of 500.
  • sonarqube_issue_source takes the component and line exactly as sonarqube_issues returns them, for example my-project:src/index.ts. contextLines defaults 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?".