Connecting an agent to SonarQube is only the first step. The more important question is whether the result describes the code you are reviewing. A green quality gate from an old analysis or another branch cannot verify a new patch.

This article explains a review workflow. For configuration, use the separate SonarQube MCP setup guide. The previous claim that this setup had been used for weeks across several clients was not supported by retained run records and has been removed.

What the server provides

The official server repository connects MCP clients to SonarQube Cloud or Server using the configured credentials. The tool reference describes queries for issues, metrics and quality gates, alongside tools whose availability or effects differ.

Do not describe all tool calls as read-only, or treat a snippet-level check as a complete repository analysis. Read the tool description and scope in the connected client. The VS Code configuration guide explains the server definitions and input handling used by the companion setup example.

The former detached Docker command exposed a port without configuring the matching transport. For stdio, the client must own the running subprocess and its input/output. Use the reviewed setup example rather than combining a detached container with an assumed HTTP endpoint.

Collect an analysis identity before asking for fixes

Keep this record beside the pull request:

FieldWhy it matters
Repository and commit under reviewIdentifies the proposed change
SonarQube project keyPrevents checking the wrong project
Branch or pull-request identitySeparates main-branch status from the proposed code
Analysis timestamp and revision when availableDetects stale results
Gate result and failed conditionsExplains the actual requirement
Relevant issue keys and locationsLets a reviewer reopen the evidence
Build and test resultsCovers behavior the analysis does not establish

The quality-review worksheet leaves these fields unfilled. Obtain missing identity fields from your CI scanner output or the SonarQube UI if the exposed MCP tools do not return them. Never invent a revision to complete the record.

If the available analysis predates the patch, label it “baseline only” and run the normal CI analysis path. The agent can use baseline findings to plan work, but the merge decision should wait for evidence relevant to the actual revision.

Use a bounded repair loop

Start with one issue or one failed gate condition. Ask the agent to explain the affected code path, propose a minimal change and identify a test that would fail without it. Review the diff before running broader cleanup.

After the patch, run the relevant tests and obtain a new analysis through your established scanner pipeline. Re-read the gate and the specific issue. If the issue disappears, check that it disappeared because the code changed, not because the file was excluded or the issue was manually marked accepted.

Some issue-state changes affect the dashboard without fixing source code. Keep the actor and reason visible when a human accepts a finding or marks a false positive. Do not let an agent silently clear findings as a substitute for remediation.

Failure modes and decision rule

ResultInterpretationNext action
Project not foundKey, organization or permissions may be wrongConfirm identity before editing code
Empty issue listCould reflect filters, scope or missing analysisCheck query parameters and analysis history
Gate passes on another branchDoes not verify the patchInspect the matching branch or PR
Snippet check succeedsNarrow signal for that snippetKeep full CI analysis and tests
Gate still failsA condition remains unmetRead the failed condition, not only the summary

Approve a change when the correct analysis, tests and human review support it. A gate is useful evidence within its configured rules; it is not a guarantee that an application is secure or correct. No percentage of AI-generated commits or multiplier of bugs is needed to justify that workflow.

Revision note

Updated October 20, 2026. Removed unsupported multi-week testing, the unsourced commit and bug statistics, and invalid transport examples. Distinguished this evidence-review workflow from the existing setup article.

Primary sources

Checked October 20, 2026: sonar readme; sonar tools; vscode mcp.