• METRICS
  • STRUCTURE
  • REDUNDANCY
  • HUMAN

How to analyze technical debt metrics with your AI

Connect SonarQube to your AI client to turn raw quality data into actionable insights. Once connected, your agent can pull specific metrics across your entire project tree.

Ask AI about this page

Short answer

How do I check my technical debt using AI?

Your AI client uses the SonarQube MCP to pull specific quality measures like duplication and coverage. It then analyzes these numbers to highlight exactly where your debt is accumulating. You'll get a clear view of your project's health without manual exports.

The outcomes.

Where your data lands.

The AI processes SonarQube data into these specific outcomes.

METRICS

Quality snapshots

The AI pulls specific KPIs like test coverage and debt ratios. You get a direct summary of your current code health.

STRUCTURE

Project mapping

The agent maps out your component tree. This helps you see which specific modules are dragging down your scores.

REDUNDANCY

Duplication alerts

The AI identifies blocks of copied code. You'll see exactly where duplication is inflating your technical debt.

HUMAN

Refactoring plans

The AI suggests which files to clean up first. You decide which debt is worth paying down based on its analysis.

The workflow

What your AI does when the data arrives.

The AI acts as a bridge between your SonarQube instance and your chat interface.

  1. Map the project

    The agent scans your project structure to understand the hierarchy of files and components.

    get_component_tree
  2. Fetch quality data

    It pulls the specific metrics you asked for, such as coverage or debt, for any given component.

    get_measures
  3. Locate duplicate code

    The AI identifies specific instances of code duplication across your repositories.

    get_duplications
  4. Synthesize findings

    The agent combines the tree structure, the metrics, and the duplication data into a single report.

    get_measuresget_component_tree

Try it

Copy these to start.

Use these prompts to kick off your analysis.

Starting points

Swap out the project names or metric types to match your specific SonarQube setup.

SonarQube Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_65ij3kQdNIdLxz6QrHqXvdxjl6hvRUXIu2uwF792/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — SonarQube capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "sonarqube-sonarcloud-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_65ij3kQdNIdLxz6QrHqXvdxjl6hvRUXIu2uwF792/mcp"
    }
  }
}
Copy into chat04
  • Show me the technical debt and test coverage for the 'auth-service' project.

  • Which components in my 'frontend-app' have the highest duplication levels?

  • List the top 5 files in my repository that need the most refactoring based on debt metrics.

  • Compare the code coverage between the 'api-gateway' and the 'user-service' components.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect SonarQube once, then ask.

Just provide your SonarQube credentials. The connection is handled securely, and you can immediately start asking questions about your code quality.

Connect SonarQube to your AI

FAQ

Common questions

  • 01

    Can the AI fix the code for me?

    No. The AI can identify debt and suggest improvements, but you must manually apply any code changes in your IDE.

  • 02

    Can the AI delete issues in SonarQube?

    No. The AI only reads data from SonarQube. It cannot modify your SonarQube project settings or delete issues.

  • 03

    Does this work with SonarCloud too?

    Yes, this MCP works with both SonarQube and SonarCloud instances.

  • 04

    Can I ask about specific lines of code?

    The AI can analyze metrics for specific files and components, but it doesn't browse the raw source code files directly unless you provide them in your chat context.

  • 05

    How does the AI know which project to look at?

    You specify the project or component name in your prompt, and the AI uses that to target its queries.

  • More questions about SonarQube? The Connector page answers them. See everything the SonarQube Connector can do

Connect SonarQube to Claude, Cursor, ChatGPT & more