Sonarqube Mcp

io.github.mshegolevPublished by GitHub account mshegolevv0.1.0Updated Oct 25, 2026

SonarQube MCP — projects, metrics, quality gate, issues, worst-metric ranking.

VerifiedSTDIODesktop onlyDeveloper ToolsData & Analytics

Overview

AI-generated overview

A local MCP server that lets an assistant read SonarQube or SonarCloud projects, metrics, quality gates and issues, and rank projects by their worst metric.

What you can do
List and search SonarQube projects with pagination and text filters, including project keys needed for other calls. Read a single project's measures such as bugs, coverage, code smells, ratings, ncloc and tests. Check a project's Quality Gate status with per-condition failures. Search issues filtered by severity, type and resolution status. Rank projects across the instance by the worst value of a chosen metric, for example the ten worst-coverage services.
When to use it
Useful during code-quality triage or review sessions when you want an assistant to pull SonarQube figures, check whether a project passes its Quality Gate, list blocker or critical issues, or compare projects by a metric without opening the web UI.
Requirements
Runs locally over stdio as a Python package (Python 3.10+), typically launched with uvx or pipx. Needs SONARQUBE_URL and a SONARQUBE_TOKEN bearer token generated in the SonarQube account security settings. SONARQUBE_SSL_VERIFY is optional and defaults to true. Network access to the SonarQube or SonarCloud instance is required; environment-based proxy discovery is disabled.
Before you install
Requires a SonarQube access token in SONARQUBE_TOKEN, which grants read access to your instance's project data; keep it out of shared config files. All five tools are declared read-only and the server states it never sends POST, PUT or DELETE requests, so it should not change SonarQube data. Setting SONARQUBE_SSL_VERIFY to false disables certificate checks and exposes traffic to interception. Project names, metrics and issue details are sent to the model provider through the assistant.

Installation

In SourceWeft

  1. Open Sonarqube Mcp in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

sonarqube-mcp

[PyPI] [Python] [License: MIT]

MCP server for SonarQube. Lets an LLM agent (Claude Code, Cursor, OpenCode, etc.) discover projects, pull headline metrics, check Quality Gate status, search issues with severity/type filters, and rank projects by the worst value of any metric.

Python, FastMCP, stdio transport.

Works with any SonarQube 9.x / 10.x instance (self-hosted) and with SonarCloud.

Why another SonarQube MCP?

A few community SonarQube MCPs exist, but they tend to stop at single-project reads. This one adds cross-project ranking (sonarqube_worst_metrics) — the operation a lead actually runs during a triage session: "show me the top 10 worst-coverage services in the org". All tools are read-only and safely parameterised (Pydantic input validation, severity / type whitelists).

Design highlights

  • Tool annotations — all five tools carry readOnlyHint: True, destructiveHint: False, idempotentHint: True. Nothing can mutate SonarQube from this server.
  • Structured output — every tool returns a typed payload (TypedDict) + a markdown summary, so clients with and without structured-content support both get a usable response.
  • Structured errors — 401 / 403 / 404 / 400 / 429 / 5xx mapped to actionable hints (e.g. "regenerate token", "check project key with sonarqube_list_projects").
  • Pydantic input validation for every argument; severity / type filters are checked against the valid SonarQube enum before the request is sent.
  • Cross-project worst-metric ranking — batches /api/measures/search calls under the hood, sorts ascending or descending based on whether higher is worse for the chosen metric.

Features (5 tools)

Discovery

  • sonarqube_list_projects — paginated project search with optional text filter

Single-project insight

  • sonarqube_project_metrics — measures for one project (default set covers bugs / coverage / smells / ratings / ncloc / tests / alert_status)
  • sonarqube_quality_gate_status — Quality Gate status + per-condition failures

Issue triage

  • sonarqube_get_issues — issue search filtered by severity / type / resolution status

Cross-project ranking

  • sonarqube_worst_metrics — top-N projects sorted by the worst value of a metric (e.g. worst coverage, most bugs)

Installation

Requires Python 3.10+.

bash
# via uvx (recommended — no install, just run)uvx --from sonarqube-mcp sonarqube-mcp
# or via pipxpipx install sonarqube-mcp

Configuration

bash
claude mcp add sonarqube -s project \  --env SONARQUBE_URL=https://sonar.example.com \  --env SONARQUBE_TOKEN=squ_your_token \  --env SONARQUBE_SSL_VERIFY=true \  -- uvx --from sonarqube-mcp sonarqube-mcp

Or in .mcp.json:

json
{  "mcpServers": {    "sonarqube": {      "type": "stdio",      "command": "uvx",      "args": ["--from", "sonarqube-mcp", "sonarqube-mcp"],      "env": {        "SONARQUBE_URL": "https://sonar.example.com",        "SONARQUBE_TOKEN": "${SONARQUBE_TOKEN}",        "SONARQUBE_SSL_VERIFY": "true"      }    }  }}

Check:

bash
claude mcp list# sonarqube: uvx --from sonarqube-mcp sonarqube-mcp - ✓ Connected

Environment variables

VariableRequiredDescription
SONARQUBE_URLyesSonarQube URL (no trailing slash)
SONARQUBE_TOKENyesBearer token. Generate in: My Account → Security → Tokens
SONARQUBE_SSL_VERIFYnotrue/false. Default: true.

Note on HTTP proxies. The client intentionally disables env-based proxy discovery (trust_env=False) because self-hosted SonarQube is typically reachable only on an internal network. If you connect to SonarCloud or any SonarQube that lives behind a corporate proxy, you'll currently need to drop the proxy variables at the process level — a SONARQUBE_TRUST_ENV_PROXY knob is planned for a follow-up release.

Example usage

  • "List all SonarQube projects matching 'einvy'"
  • "What's the Quality Gate status for einvy:aut_einvy?"
  • "Show me the top 10 projects with the most bugs"
  • "Find all BLOCKER / CRITICAL vulnerabilities in einvy:aut_einvy"
  • "What's the coverage on einvy:qa_assistant?"
  • "Top 5 worst-coverage projects matching query 'einvy'"

Metric directions (used by sonarqube_worst_metrics)

Higher is worse (sorted descending — more is worse): bugs, code_smells, vulnerabilities, duplicated_lines_density, reliability_rating, security_rating, security_review_rating, sqale_rating, open_issues

Lower is worse (sorted ascending — less is worse): coverage, line_coverage, branch_coverage, test_success_density, tests

Ratings in SonarQube are numeric strings "1" (A, best) through "5" (E, worst).

Safety

  • All tools are readOnlyHint: True — nothing can mutate SonarQube.
  • No POST / PUT / DELETE is ever called.
  • Severity / type / qualifier inputs are validated against SonarQube enums before the API call, so the tool fails fast on typos rather than hitting the API.

Performance characteristics

  • Every tool makes one HTTP call to SonarQube except sonarqube_worst_metrics, which makes one search call + ⌈candidate_pool/100⌉ bulk-measures calls. Default settings land at ≤ 2 calls.
  • Single-tool response time on a healthy SonarQube instance: typically < 500 ms.
  • Pagination is passed through to SonarQube (p + ps params) — no full-result buffering in the MCP server.
  • sonarqube_worst_metrics caps candidate_pool at 500 — on instances with thousands of projects, pre-filter with query= before ranking (see the tool docstring).
  • SonarQube has no published hard rate limit. If 429 is received the server surfaces an actionable error ("Wait 30-60 s before retrying; reduce page_size").

Development

bash
git clone https://github.com/mshegolev/sonarqube-mcp.gitcd sonarqube-mcppip install -e '.[dev]'pytest

License

MIT © Mikhail Shchegolev

Source: README.md at commit 9c5b64f

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.0LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts