Tools

This page documents a set of tools for interacting the SonarQube MCP Server can use to interact with SonarQube (Server, Cloud), such as analysis, issues, metrics, projects, quality gates, and more.

Analysis

Tool
Type

analyze_code_snippet: Analyze a file or code snippet with SonarQube analyzers to identify code quality and security issues. Specify the language of the snippet to improve analysis accuracy.

  • codeSnippet (string, required): Code snippet or full file content.

  • language (string, optional): Language of the code snippet.

When integration with SonarQube for IDE is enabled:

Tool
Type

analyze_file_list: Analyze files in the current working directory using SonarQube for IDE. This tool connects to a running SonarQube for IDE instance to perform code quality analysis on a list of files.

file_absolute_paths (array of strings, required): List of absolute file paths to analyze.

toggle_automatic_analysis: Enable or disable SonarQube for IDE automatic analysis. When enabled, SonarQube for IDE will automatically analyze files as they are modified in the working directory. When disabled, automatic analysis is turned off.

enabled (boolean, required): Enable or disable the automatic analysis.

Dependency risks

Dependency risks are only available when connecting to SonarQube Server 2025.4 Enterprise edition or higher with SonarQube Advanced Security enabled.

Tool
Type

search_dependency_risks - Search for software composition analysis issues (dependency risks) of a SonarQube project, paired with releases that appear in the analyzed project, application, or portfolio.

projectKey (string): Project key.

branchKey (string): Branch key.

pullRequestKey (string, optional): Pull request key.

Enterprises

Enterprise tools are only available when connecting to a SonarQube Cloud Enterprise edition.

Tool
Type

list_enterprises: List the enterprises available in SonarQube Cloud that you have access to. Use this tool to discover enterprise IDs that can be used with other tools.

enterpriseKey (string, optional): Enterprise key to filter results.

Issues

Tool
Type

change_sonar_issue_status: Change the status of a SonarQube issue to "accept", "falsepositive" or to "reopen" an issue.

key (string, required): Issue key - Required String

status (enum, required): New issue's status - Required Enum {"accept", "falsepositive", "reopen"}

search_sonar_issues_in_projects: Search for SonarQube issues in my organization's projects.

projects (array of strings, optional): Optional list of Sonar projects.

pullRequestId (string, optional): Pull Request's identifier.

severities (array of strings, optional): List of severities to filter by. Possible values: INFO, LOW, MEDIUM, HIGH, BLOCKER.

p (integer, optional): Page number. Default: 1.

ps (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.

Languages

Tool
Type

list_languages: List all programming languages supported in this SonarQube instance.

q: Pattern to match language keys/names against.

Measures

Tool
Type

get_component_measures: Get SonarQube measures for a component (project, directory, file).

component (string, optional): Component key to get measures.

branch (string, optional): Branch to analyze for measures.

metricKeys (array of strings, optional): Metric keys to retrieve (for example: ncloc, complexity, violations, coverage).

pullRequest (string, optional): Optional pull request identifier to analyze for measures - String

Metrics

Tool
Type

search_metrics: Search for SonarQube metrics.

p (integer, optional): Page number. Default: 1.

ps (integer, optional): Page size. Must be greater than 0 and less than or equal to 500. Default: 100.

Portfolios

Tool
Type

list_portfolios: List enterprise portfolios available in SonarQube with filtering and pagination options.

For SonarQube Server:

q (string, optional): Search query to filter portfolios by name or key.

favorite (boolean): If true, returns favorite portfolios.

pageIndex (integer, optional): Optional 1-based page number. Default: 1.

pageSize (integer, optional): Optional page size, max 500. Default: 100.

For SonarQube Cloud:

enterpriseId (string): Enterprise uuid. Can be omitted only if the favorite parameter is supplied with value true.

q (string, optional): Search query to filter portfolios by name.

favorite (boolean, required): Required to be true if the enterpriseId parameter is omitted. If true, returns portfolios favorited by the logged-in user. Cannot be true when draft is true.

draft (boolean): If true, returns drafts created by the logged-in user. Cannot be true when favorite is true.

pageIndex (integer, optional): Index of the page to fetch. Default: 1,

pageSize (integer, optional): Size of the page to fetch. Default: 50.

Projects

Tool
Type

search_my_sonarqube_projects: Find SonarQube projects. The response is paginated.

page (string, optional): Optional page number - String

Quality gates

Tool
Type

get_project_quality_gate_status: Get the quality gate status for the SonarQube project.

analysisId (string, optional): Analysis ID.

branch (string, optional): Branch key.

projectId (string, optional): Project ID.

projectKey (string, optional): Project key.

pullRequest (string, optional): Pull request ID.

list_quality_gates: List all quality gates in my SonarQube.

Rules

Tool
Type

list_rule_repositories: List rule repositories available in SonarQube.

language (string, optional): Language key.

q (string, optional): Search query.

show_rule: Shows detailed information about a SonarQube rule.

key (string, required): Rule key.

Sources

Tool
Type

get_raw_source: Get source code as raw text from SonarQube. Requires the See Source Code permission on file.

key (string, required): File key.

branch (string, optional): Branch key.

pullRequest (string, optional): Pull request id.

get_scm_info: Get SCM information of SonarQube source files. Requires the See Source Code permission on the file's project.

key (string, required): File key.

commits_by_line (string): If the value is false, group lines by SCM commit; else display commits for each line.

from (number): First line to return. Starts at 1.

to (inclusive): Last line to return.

System

System tools are only available when connecting to SonarQube Server.

Tool
Type

get_system_health: Get the health status of SonarQube Server instance. Returns GREEN (fully operational), YELLOW (usable but needs attention), or RED (not operational).

get_system_info: Get detailed information about SonarQube Server system configuration including JVM state, database, search indexes, and settings. Requires 'Administer' permissions.

get_system_logs: Get SonarQube Server system logs in plain-text format. Requires system administration permission.

name (string, optional): Name of the logs to get. Possible values: access, app, ce, deprecation, es, web. Default: app

ping_system: Ping the SonarQube Server system to check if it's alive. Returns 'pong' as plain text.

get_system_status: Get state information about SonarQube Server. Returns status (STARTING, UP, DOWN, RESTARTING, DB_MIGRATION_NEEDED, DB_MIGRATION_RUNNING), version, and id.

Webhooks

Tool
Type

create_webhook: Create a new webhook for the SonarQube organization or project. Requires Administrator permissions on the specified project, or Global Administrator permissions.

name (string, required): Webhook name.

url (string, required): Webhook URL.

projectKey (string, optional): Project key for project-specific webhook.

secret (string, optional): Webhook secret for securing the webhook payload.

list_webhooks: List all webhooks for the SonarQube organization or project. Requires Administrator permissions on the specified project, or Global Administrator permissions.

projectKey (string, optional): Project key to list project-specific webhooks.

Last updated

Was this helpful?