AI integrations
Set up SonarQube CLI or a self-hosted SonarQube MCP Server for AI agents detected by SonarQube for VS Code.
Open SonarQube Setup > AI Integrations to connect SonarQube to AI agents in your IDE. The view has separate cards for SonarQube CLI and SonarQube MCP Server. Expand Manage agents in either card to see the agents detected in the IDE or through a locally installed agent CLI. An agent appearing in the list means it was detected; it does not mean SonarQube integration has been completed.
Choose the setup that fits your agent:
SonarQube CLI provides local analysis while an agent edits code. Install and sign in to the CLI, then run its integration for each supported agent
SonarQube MCP Server gives an agent access to project information such as issues, quality gates, and coverage. Configure a self-hosted MCP entry for a supported agent using a SonarQube for VS Code connected-mode connection. This setup does not require the SonarQube CLI or CLI authentication
Use both setups if needed. Refresh the view to check CLI, authentication, agent, and MCP configuration states.
Set up SonarQube CLI for an agent
Check the installation status in the SonarQube CLI card. If the CLI is Not detected, select Install SonarQube CLI. Follow the prompts in the terminal that opens. If an installation is Unavailable, open the troubleshooting guide and fix the installation before continuing
If you need to sign in, select Sign in with SonarQube CLI. The extension uses a recommended or sole IDE connection, or asks you to select one. It pre-fills the server URL and, for SonarQube Cloud, the organization. Enter your credentials in the CLI terminal. The extension does not pass your IDE token to the CLI. If you're already signed in, the view keeps your CLI authentication, even if it differs from your IDE connection
Expand Manage agents in the CLI card. For each agent that supports CLI integration, select Integrate for all projects and respond to any prompts in the terminal. Repeat for each agent you want to integrate
When the terminal closes, check its result and refresh the view. The view confirms CLI installation and authentication. It does not verify whether each agent integration completed, so Integrate for all projects may remain available after a successful run
GitHub Copilot in VS Code and GitHub Copilot CLI are separate targets. If a detected agent has no CLI integration action, use the guidance shown in its row. Select SonarQube CLI guide for CLI documentation.
Configure a self-hosted 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 SonarQube MCP Server documentation.
When you use SonarQube MCP Server with SonarQube for IDE, the MCP server can trigger analysis in the editor. Creating a self-hosted MCP entry uses your selected connected-mode connection; it works independently of SonarQube CLI installation and authentication. This view only configures a self-hosted MCP server, not the SonarQube Server-hosted or SonarQube Cloud-hosted MCP server.
Set up a connected-mode connection to SonarQube Server or SonarQube Cloud
In SonarQube Setup > AI Integrations, expand Manage agents in the SonarQube MCP Server card. Each supported agent row shows the configuration file that will be updated
Select Set up for the agent you want to configure, then select the IDE connection to use. Repeat for any other agents you want to configure. The extension updates only the selected agent's configuration file
Use Open configuration to inspect an existing entry. Select MCP configuration guide for manual setup instructions
When detected, GitHub Copilot in VS Code, Claude Code, Cursor, Windsurf, and Kiro can use self-hosted file setup. Codex and GitHub Copilot CLI appear as Available through CLI because this view does not configure their self-hosted MCP files.
The MCP card counts configured entries only among agents with supported self-hosted configuration files. Its status describes the file it inspected:
Not configured: Select Set up to create the SonarQube entry
Configured: A self-hosted SonarQube entry exists. Select Open configuration to inspect it
Managed by CLI: The inspected file contains an entry managed by the SonarQube CLI. Open the file to inspect it; self-hosted setup does not change that entry
Needs attention: The file is malformed or its
sonarqubeentry cannot be managed by this view. Select Open configuration to inspect the diagnostic. An existing MCP connection may still work
At startup, the extension refreshes SONARQUBE_IDE_PORT only in a recognized self-hosted entry that already has that key. It does not add a missing key or change the server URL, token, or other settings.
The view currently checks for an MCP entry named sonarqube. A URL-based, cloud-hosted entry with that name may show Needs attention, but the extension does not replace it. An entry under another name remains untouched but is not recognized as the SonarQube entry, so Set up may create a separate sonarqube entry.
The extension preserves unrelated configuration when it updates a supported file. It does not replace malformed configuration with an empty file or overwrite an entry managed by the SonarQube CLI. If it detects legacy agent instructions in your workspace, Open file opens those instructions for review.
Self-hosted MCP setup is unavailable in remote IDE windows. Use the documentation links or open an existing configuration file.
Use GitHub Copilot tools in VS Code
SonarQube for VS Code also provides tools to the GitHub Copilot extension. These tools are available with your installation and work best in Copilot Agent mode. Ask Copilot to perform a SonarQube-related action or call a tool by name.
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.
SonarQube for IDE tools
Potential Security Issues
#sonarqube_getPotentialSecurityIssuesLists security issues and taint vulnerabilities in a file. The tool takes a file path as an argument
Exclude File or Folder from Analysis
#sonarqube_excludeFilesUpdates the SonarQube for IDE analysis settings to exclude files and folders using known file exclusions
Set up Connected Mode
#sonarqube_setUpConnectedModeGuides you through connected-mode setup with SonarQube Server or SonarQube Cloud
Analyze File
#sonarqube_analyzeFileAnalyzes a file, including a file you previously excluded
For more GitHub Copilot CLI features, see the SonarQube plugin for GitHub Copilot CLI.
Last updated
Was this helpful?

