For the complete documentation index, see llms.txt. This page is also available as Markdown.

AI agents

SonarQube for IntelliJ offers tools to engage with AI agents running in your IDE, such as Claude Code and GitHub Copilot, to bring SonarQube analysis into your AI-assisted workflow.

For AI agents: You're in the SonarQube for IntelliJ documentation. For a list of all its pages, see the SonarQube for IntelliJ page index. For the whole site, see the page index or the full text.

SonarQube for IDE's code analysis workflow is enhanced by a set of tools designed to integrate with AI agents. These tools allow you to interact with AI agents in natural language to perform specific SonarQube-related tasks directly within your IDE. This integration streamlines your development process by bringing the power of SonarQube analysis into your AI-assisted conversations, helping you focus on and resolve code quality and security issues more efficiently.

SonarQube MCP Server

The SonarQube MCP Server is a Model Context Protocol (MCP) server that runs locally and enables a seamless connection between your AI agents and your SonarQube platform. The tools are designed to bridge the divide between productivity and quality. Please see the full details in the SonarQube MCP Server documentation.

Using SonarQube MCP Server together with the SonarQube for IDE plugin allows the MCP server to trigger analyses directly in the editor, just like regular on-the-fly analysis by SonarQube for IDE. This powerful combination helps AI agents deliver more reliable, maintainable, and secure code.

GitHub Copilot plugin

SonarQube for IntelliJ includes tools for the GitHub Copilot plugin. The interactive tools come automatically with your installation and are best accessed with the Copilot Agent mode enabled.

Note: Organizations and enterprises on a Copilot Business or Copilot Enterprise plan must have the MCP servers in Copilot policy enabled by an administrator before MCP can be used with Copilot.

  1. Open the GitHub Copilot plugin.

  2. Make sure you're in Agent mode and select Configure tools to open the setup menu.

  3. Select Add MCP Tools or + Add More Tools to open an mcp.json file where you can paste your configuration.

  4. Use either the SonarQube MCP configuration generator, or adapt the setup below to add your configuration.

The following sample is the static equivalent of the SonarQube MCP Server configuration generator output and can be adapted for SonarQube Cloud or SonarQube Server.

{
  "servers": {
    "io.github.SonarSource/sonarqube-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "", //Only User tokens are allowed.
        "SONARQUBE_ORG": "", //Optional. Fixes the SonarQube Cloud organization.
        //"SONARQUBE_URL": "https://sonarqube.us", //For an organization in the SonarQube Cloud US region.
        "SONARQUBE_URL": "" //Use for connection to SonarQube Server.
      }
    }
  }
}
  1. Save the file. The SonarQube tools appear immediately — select the tools icon in Copilot to confirm.

Instructions for the AI agent

To get the best results, give the agent clear instructions so it uses the SonarQube MCP Server effectively. For GitHub Copilot, you can add a copilot-instructions.md file in the .github folder at the root of your project. That file is read by the agent each time you interact with it.

Once the MCP Server is configured, you can ask the agent in natural language to analyze code snippets, check dependency risks, change issue status (for example Accept or False Positive), list issues in your project or current file, summarize project status (coverage, duplication, open issues), or list issues for a pull request. Providing project context (such as build files with SonarQube properties) and defining guardrails in copilot-instructions.md helps the agent target the right project and use the MCP Server effectively.

Setup with Claude Code

Details coming soon.

The SonarQube MCP Server tools

Once you’ve set up the Sonar MCP Server with your IDE, you can start using the SonarQube MCP Server Tools.

Last updated

Was this helpful?