sonarqube-mcp-server

9506hqwy/sonarqube-mcp-server

3.2

If you are the rightful owner of sonarqube-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This repository provides a model context protocol server for SonarQube server, enabling integration and management of SonarQube functionalities through a structured API.

SonarQube MCP Server

This repository provides model context protocol server for SonarQube server.

API Version

  • v9.9

Build

Build binary.

go build -o bin/sonarqube-mcp-server ./cmd/sonarqube-mcp-server/main.go

Or build container image.

docker build -t sonarqube-mcp-server .

Add Z option at bind mount operation in Dockerfile if using podman with SELinux.

Usage

Run application.

Specify token or username and password. If use user type token and SonarQube server 9.x or earlier, Specify token to --user.

$ ./bin/sonarqube-mcp-server -h
SonarQube MCP Server

Usage:
  sonarqube-mcp-server [flags]

Flags:
  -h, --help              help for sonarqube-mcp-server
      --password string   SonarQube server password.
      --readonly          HTTP GET method only. (default true)
      --token string      SonarQube server user type token.
      --url string        SonarQube server URL. (default "http://127.0.0.1:9000")
      --user string       SonarQube server username.
  -v, --version           version for sonarqube-mcp-server

Set environment variable instead of arguments.

ArgumentEnvironment Variable
--urlSONARQUBE_URL
--userSONARQUBE_USER
--passwordSONARQUBE_PASSWORD
--tokenSONARQUBE_TOKEN
--readonlySONARQUBE_READONLY

Or run container.

docker run --rm -i -e SONARQUBE_URL=<URL> -e SONARQUBE_TOKEN=<TOKEN> sonarqube-mcp-server

Usage with VS code

Add sonarqube-mcp-server binary to PATH environment variable and configure VS code. If use user type token and SonarQube server 9.x or earlier, Specify token to SONARQUBE_USER.

{
    "servers": {
        "sonarqube": {
            "type": "stdio",
            "command": "sonarqube-mcp-server",
            "env": {
                "SONARQUBE_URL": "${input:sonarqube_url}",
                "SONARQUBE_TOKEN": "${input:sonarqube_token}",
            }
        }
    },
    "inputs": [
        {
            "type": "promptString",
            "id": "sonarqube_url",
            "description": "SonarQube Server URL",
            "password": false
        },
        {
            "type": "promptString",
            "id": "sonarqube_token",
            "description": "SonarQube Server TOKEN",
            "password": true
        }
    ]
}

Tools

ToolDescription
alm_integrations_import_gitlab_projectImport a GitLab project to SonarQube, creating a new project and configuring MR decoration
Requires the 'Create Projects' permission
alm_integrations_list_azure_projectsList Azure projects
Requires the 'Create Projects' permission
alm_integrations_list_bitbucketserver_projectsList the Bitbucket Server projects
Requires the 'Create Projects' permission
alm_integrations_search_azure_reposSearch the Azure repositories
Requires the 'Create Projects' permission
alm_integrations_search_bitbucketcloud_reposSearch the Bitbucket Cloud repositories
Requires the 'Create Projects' permission
alm_integrations_search_bitbucketserver_reposSearch the Bitbucket Server repositories with REPO_ADMIN access
Requires the 'Create Projects' permission
alm_integrations_search_gitlab_reposSearch the GitLab projects.
Requires the 'Create Projects' permission
alm_integrations_set_patSet a Personal Access Token for the given DevOps Platform setting
Only valid for Azure DevOps, Bitbucket Server, GitLab and Bitbucket Cloud Setting
Requires the 'Create Projects' permission
alm_settings_count_bindingCount number of project bound to an DevOps Platform setting.
Requires the 'Administer System' permission
alm_settings_create_azureCreate Azure instance Setting.
Requires the 'Administer System' permission
alm_settings_create_bitbucketCreate Bitbucket instance Setting.
Requires the 'Administer System' permission
alm_settings_create_bitbucketcloudConfigure a new instance of Bitbucket Cloud.
Requires the 'Administer System' permission
alm_settings_create_githubCreate GitHub instance Setting.
Requires the 'Administer System' permission
alm_settings_create_gitlabCreate GitLab instance Setting.
Requires the 'Administer System' permission
alm_settings_deleteDelete an DevOps Platform Setting.
Requires the 'Administer System' permission
alm_settings_get_bindingGet DevOps Platform binding of a given project.
Requires the 'Administer' permission on the project
alm_settings_listList DevOps Platform setting available for a given project, sorted by DevOps Platform key
Requires the 'Administer project' permission if the 'project' parameter is provided, requires the 'Create Projects' permission otherwise.
alm_settings_list_definitionsList DevOps Platform Settings, sorted by created date.
Requires the 'Administer System' permission
alm_settings_update_azureUpdate Azure instance Setting.
Requires the 'Administer System' permission
alm_settings_update_bitbucketUpdate Bitbucket instance Setting.
Requires the 'Administer System' permission
alm_settings_update_bitbucketcloudUpdate Bitbucket Cloud Setting.
Requires the 'Administer System' permission
alm_settings_update_githubUpdate GitHub instance Setting.
Requires the 'Administer System' permission
alm_settings_update_gitlabUpdate GitLab instance Setting.
Requires the 'Administer System' permission
alm_settings_validateValidate an DevOps Platform Setting by checking connectivity and permissions
Requires the 'Administer System' permission
analysis_cache_getGet the scanner's cached data for a branch. Requires scan permission on the project. Data is returned gzipped if the corresponding 'Accept-Encoding' header is set in the request.
authentication_loginAuthenticate a user.
authentication_logoutLogout a user.
authentication_validateCheck credentials.
ce_activitySearch for tasks.
Either componentId or component can be provided, but not both.
Requires the system administration permission, or project administration permission if componentId or component is set.
ce_activity_statusReturns CE activity related metrics.
Requires 'Administer System' permission or 'Administer' rights on the specified project.
ce_componentGet the pending tasks, in-progress tasks and the last executed task of a given component (usually a project).
Requires the following permission: 'Browse' on the specified component.
ce_taskGive Compute Engine task details such as type, status, duration and associated component.
Requires 'Administer System' or 'Execute Analysis' permission.
Since 6.1, field "logs" is deprecated and its value is always false.
components_searchSearch for components
components_showReturns a component (file, directory, project, portfolio…) and its ancestors. The ancestors are ordered from the parent to the root project. Requires the following permission: 'Browse' on the project of the specified component.
components_treeNavigate through components based on the chosen strategy.
Requires the following permission: 'Browse' on the specified project.
When limiting search with the q parameter, directories are not returned.
duplications_showGet duplications. Require Browse permission on file's project
favorites_addAdd a component (project, file etc.) as favorite for the authenticated user.
Only 100 components by qualifier can be added as favorite.
Requires authentication and the following permission: 'Browse' on the project of the specified component.
favorites_removeRemove a component (project, portfolio, application etc.) as favorite for the authenticated user.
Requires authentication.
favorites_searchSearch for the authenticated user favorites.
Requires authentication.
hotspots_searchSearch for Security Hotpots.
Requires the 'Browse' permission on the specified project(s).
For applications, it also requires 'Browse' permission on its child projects.
When issue indexation is in progress returns 503 service unavailable HTTP code.
hotspots_showProvides the details of a Security Hotspot.
issues_add_commentAdd a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue.
issues_assignAssign/Unassign an issue. Requires authentication and Browse permission on project
issues_authorsSearch SCM accounts which match a given query.
Requires authentication.
When issue indexation is in progress returns 503 service unavailable HTTP code.
issues_bulk_changeBulk change on issues. Up to 500 issues can be updated.
Requires authentication.
issues_changelogDisplay changelog of an issue.
Requires the 'Browse' permission on the project of the specified issue.
issues_delete_commentDelete a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue.
issues_do_transitionDo workflow transition on an issue. Requires authentication and Browse permission on project.
The transitions 'wontfix' and 'falsepositive' require the permission 'Administer Issues'.
The transitions involving security hotspots require the permission 'Administer Security Hotspot'.
issues_edit_commentEdit a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue.
issues_reindexReindex issues for a project.
Require 'Administer System' permission.
issues_searchSearch for issues.
Requires the 'Browse' permission on the specified project(s).
For applications, it also requires 'Browse' permission on its child projects.
When issue indexation is in progress returns 503 service unavailable HTTP code.
issues_set_severityChange severity.
Requires the following permissions:
  • 'Authentication'
  • 'Browse' rights on project of the specified issue
  • 'Administer Issues' rights on project of the specified issue
issues_set_tagsSet tags on an issue.
Requires authentication and Browse permission on project
issues_set_typeChange type of issue, for instance from 'code smell' to 'bug'.
Requires the following permissions:
  • 'Authentication'
  • 'Browse' rights on project of the specified issue
  • 'Administer Issues' rights on project of the specified issue
issues_tagsList tags matching a given query
languages_listList supported programming languages
measures_componentReturn component with specified measures.
Requires the following permission: 'Browse' on the project of specified component.
measures_component_treeNavigate through components based on the chosen strategy with specified measures.
Requires the following permission: 'Browse' on the specified project.
For applications, it also requires 'Browse' permission on its child projects.
When limiting search with the q parameter, directories are not returned.
measures_search_historySearch measures history of a component.
Measures are ordered chronologically.
Pagination applies to the number of measures for each metric.
Requires the following permission: 'Browse' on the specified component.
For applications, it also requires 'Browse' permission on its child projects.
metrics_searchSearch for metrics
metrics_typesList all available metric types.
monitoring_metricsReturn monitoring metrics in Prometheus format. Support content type 'text/plain' (default) and 'application/openmetrics-text'. this endpoint can be access using a Bearer token, that needs to be defined in sonar.properties with the 'sonar.web.systemPasscode' key.
new_code_periods_listList the New Code Periods for all branches in a project.
Requires the permission to browse the project
new_code_periods_setUpdates the setting for the New Code Period on different levels:
  • Project key must be provided to update the value for a project
  • Both project and branch keys must be provided to update the value for a branch
Requires one of the following permissions:
  • 'Administer System' to change the global setting
  • 'Administer' rights on the specified project to change the project setting
new_code_periods_showShows a setting for the New Code Period.
If the component requested doesn't exist or if no new code period is set for it, a value is inherited from the project or from the global setting.Requires one of the following permissions if a component is specified:
  • 'Administer' rights on the specified component
  • 'Execute analysis' rights on the specified component
new_code_periods_unsetUnset the New Code Period setting for a branch, project or global.
Requires one of the following permissions:
  • 'Administer System' to change the global setting
  • 'Administer' rights for a specified component
notifications_addAdd a notification for the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided. If a project is provided, requires the 'Browse' permission on the specified project.
  • System administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.
notifications_listList notifications of the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided
  • System administration if a login is provided
notifications_removeRemove a notification for the authenticated user.
Requires one of the following permissions:
  • Authentication if no login is provided
  • System administration if a login is provided
permissions_add_groupAdd a permission to a group.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
The group name or group id must be provided.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
permissions_add_group_to_templateAdd a group to a permission template.
The group id or group name must be provided.
Requires the following permission: 'Administer System'.
permissions_add_project_creator_to_templateAdd a project creator to a permission template.
Requires the following permission: 'Administer System'.
permissions_add_userAdd permission to a user.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
permissions_add_user_to_templateAdd a user to a permission template.
Requires the following permission: 'Administer System'.
permissions_apply_templateApply a permission template to one project.
The project id or project key must be provided.
The template id or name must be provided.
Requires the following permission: 'Administer System'.
permissions_bulk_apply_templateApply a permission template to several projects.
The template id or name must be provided.
Requires the following permission: 'Administer System'.
permissions_create_templateCreate a permission template.
Requires the following permission: 'Administer System'.
permissions_delete_templateDelete a permission template.
Requires the following permission: 'Administer System'.
permissions_remove_groupRemove a permission from a group.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
The group id or group name must be provided, not both.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
permissions_remove_group_from_templateRemove a group from a permission template.
The group id or group name must be provided.
Requires the following permission: 'Administer System'.
permissions_remove_project_creator_from_templateRemove a project creator from a permission template.
Requires the following permission: 'Administer System'.
permissions_remove_userRemove permission from a user.
This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
permissions_remove_user_from_templateRemove a user from a permission template.
Requires the following permission: 'Administer System'.
permissions_search_templatesList permission templates.
Requires the following permission: 'Administer System'.
permissions_set_default_templateSet a permission template as default.
Requires the following permission: 'Administer System'.
permissions_update_templateUpdate a permission template.
Requires the following permission: 'Administer System'.
plugins_availableGet the list of all the plugins available for installation on the SonarQube instance, sorted by plugin name.
Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.
Update status values are:
  • COMPATIBLE: plugin is compatible with current SonarQube instance.
  • INCOMPATIBLE: plugin is not compatible with current SonarQube instance.
  • REQUIRES_SYSTEM_UPGRADE: plugin requires SonarQube to be upgraded before being installed.
  • DEPS_REQUIRE_SYSTEM_UPGRADE: at least one plugin on which the plugin is dependent requires SonarQube to be upgraded.
Require 'Administer System' permission.
plugins_cancel_allCancels any operation pending on any plugin (install, update or uninstall)
Requires user to be authenticated with Administer System permissions
plugins_installInstalls the latest version of a plugin specified by its key.
Plugin information is retrieved from Update Center.
Fails if used on commercial editions or plugin risk consent has not been accepted.
Requires user to be authenticated with Administer System permissions
plugins_installedGet the list of all the plugins installed on the SonarQube instance, sorted by plugin name.
Requires authentication.
plugins_pendingGet the list of plugins which will either be installed or removed at the next startup of the SonarQube instance, sorted by plugin name.
Require 'Administer System' permission.
plugins_uninstallUninstalls the plugin specified by its key.
Requires user to be authenticated with Administer System permissions.
plugins_updateUpdates a plugin specified by its key to the latest version compatible with the SonarQube instance.
Plugin information is retrieved from Update Center.
Requires user to be authenticated with Administer System permissions
plugins_updatesLists plugins installed on the SonarQube instance for which at least one newer version is available, sorted by plugin name.
Each newer version is listed, ordered from the oldest to the newest, with its own update/compatibility status.
Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.
Update status values are: [COMPATIBLE, INCOMPATIBLE, REQUIRES_UPGRADE, DEPS_REQUIRE_UPGRADE].
Require 'Administer System' permission.
project_analyses_create_eventCreate a project analysis event.
Only event of category 'VERSION' and 'OTHER' can be created.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
project_analyses_deleteDelete a project analysis.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the project of the specified analysis
project_analyses_delete_eventDelete a project analysis event.
Only event of category 'VERSION' and 'OTHER' can be deleted.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
project_analyses_searchSearch a project analyses and attached events.
Requires the following permission: 'Browse' on the specified project.
For applications, it also requires 'Browse' permission on its child projects.
project_analyses_set_baselineSet an analysis as the baseline of the New Code Period on a project or a branch.
This manually set baseline.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
project_analyses_unset_baselineUnset any manually-set New Code Period baseline on a project or a branch.
Unsetting a manual baseline restores the use of the default new code period setting.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
project_analyses_update_eventUpdate a project analysis event.
Only events of category 'VERSION' and 'OTHER' can be updated.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
project_badges_measureGenerate badge for project's measure as an SVG.
Requires 'Browse' permission on the specified project.
project_badges_quality_gateGenerate badge for project's quality gate as an SVG.
Requires 'Browse' permission on the specified project.
project_badges_renew_tokenCreates new token replacing any existing token for project or application badge access for private projects and applications.
This token can be used to authenticate with api/project_badges/quality_gate and api/project_badges/measure endpoints.
Requires 'Administer' permission on the specified project or application.
project_badges_tokenRetrieve a token to use for project or application badge access for private projects or applications.
This token can be used to authenticate with api/project_badges/quality_gate and api/project_badges/measure endpoints.
Requires 'Browse' permission on the specified project or application.
project_branches_deleteDelete a non-main branch of a project or application.
Requires 'Administer' rights on the specified project or application.
project_branches_listList the branches of a project or application.
Requires 'Browse' or 'Execute analysis' rights on the specified project or application.
project_branches_renameRename the main branch of a project or application.
Requires 'Administer' permission on the specified project or application.
project_branches_set_automatic_deletion_protectionProtect a specific branch from automatic deletion. Protection can't be disabled for the main branch.
Requires 'Administer' permission on the specified project or application.
project_dump_exportTriggers project dump so that the project can be imported to another SonarQube server (see api/project_dump/import, available in Enterprise Edition). Requires the 'Administer' permission.
project_links_createCreate a new project link.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
project_links_deleteDelete existing project link.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
project_links_searchList links of a project.
The 'projectId' or 'projectKey' must be provided.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
  • 'Browse' on the specified project
project_tags_searchSearch tags
project_tags_setSet tags on a project.
Requires the following permission: 'Administer' rights on the specified project
projects_bulk_deleteDelete one or several projects.
Only the 1'000 first items in project filters are taken into account.
Requires 'Administer System' permission.
At least one parameter is required among analyzedBefore, projects and q
projects_createCreate a project.
Requires 'Create Projects' permission
projects_deleteDelete a project.
Requires 'Administer System' permission or 'Administer' permission on the project.
projects_searchSearch for projects or views to administrate them.
Requires 'Administer System' permission
projects_update_keyUpdate a project all its sub-components keys.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
projects_update_visibilityUpdates visibility of a project or view.
Requires 'Project administer' permission on the specified project or view
qualitygates_copyCopy a Quality Gate.
Either 'sourceName' or 'id' must be provided. Requires the 'Administer Quality Gates' permission.
qualitygates_createCreate a Quality Gate.
Requires the 'Administer Quality Gates' permission.
qualitygates_create_conditionAdd a new condition to a quality gate.
Either 'gateId' or 'gateName' must be provided. Requires the 'Administer Quality Gates' permission.
qualitygates_delete_conditionDelete a condition from a quality gate.
Requires the 'Administer Quality Gates' permission.
qualitygates_deselectRemove the association of a project from a quality gate.
Requires one of the following permissions:
  • 'Administer Quality Gates'
  • 'Administer' rights on the project
qualitygates_destroyDelete a Quality Gate.
Either 'id' or 'name' must be specified. Requires the 'Administer Quality Gates' permission.
qualitygates_get_by_projectGet the quality gate of a project.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
  • 'Browse' on the specified project
qualitygates_listGet a list of quality gates
qualitygates_project_statusGet the quality gate status of a project or a Compute Engine task.
Either 'analysisId', 'projectId' or 'projectKey' must be provided
The different statuses returned are: OK, WARN, ERROR, NONE. The NONE status is returned when there is no quality gate associated with the analysis.
Returns an HTTP code 404 if the analysis associated with the task is not found or does not exist.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
  • 'Browse' on the specified project
  • 'Execute Analysis' on the specified project
qualitygates_renameRename a Quality Gate.
Either 'id' or 'currentName' must be specified. Requires the 'Administer Quality Gates' permission.
qualitygates_searchSearch for projects associated (or not) to a quality gate.
Only authorized projects for the current user will be returned.
qualitygates_selectAssociate a project to a quality gate.
Requires one of the following permissions:
  • 'Administer Quality Gates'
  • 'Administer' right on the specified project
qualitygates_set_as_defaultSet a quality gate as the default quality gate.
Either 'id' or 'name' must be specified. Requires the 'Administer Quality Gates' permission.
qualitygates_showDisplay the details of a quality gate
qualitygates_update_conditionUpdate a condition attached to a quality gate.
Requires the 'Administer Quality Gates' permission.
qualityprofiles_activate_ruleActivate a rule on a Quality Profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_activate_rulesBulk-activate rules on one quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_add_projectAssociate a project with a quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
  • Administer right on the specified project
qualityprofiles_backupBackup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore.
qualityprofiles_change_parentChange a quality profile's parent.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_changelogGet the history of changes on a quality profile: rule activation/deactivation, change in parameters/severity. Events are ordered by date in descending order (most recent first).
qualityprofiles_copyCopy a quality profile.
Requires to be logged in and the 'Administer Quality Profiles' permission.
qualityprofiles_createCreate a quality profile.
Requires to be logged in and the 'Administer Quality Profiles' permission.
qualityprofiles_deactivate_ruleDeactivate a rule on a quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_deactivate_rulesBulk deactivate rules on Quality profiles.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_deleteDelete a quality profile and all its descendants. The default quality profile cannot be deleted.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_exportExport a quality profile.
qualityprofiles_exportersLists available profile export formats.
qualityprofiles_importersList supported importers.
qualityprofiles_inheritanceShow a quality profile's ancestors and children.
qualityprofiles_projectsList projects with their association status regarding a quality profile
See api/qualityprofiles/search in order to get the Quality Profile Key
qualityprofiles_remove_projectRemove a project's association with a quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
  • Administer right on the specified project
qualityprofiles_renameRename a quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_restoreRestore a quality profile using an XML file. The restored profile name is taken from the backup file, so if a profile with the same name and language already exists, it will be overwritten.
Requires to be logged in and the 'Administer Quality Profiles' permission.
qualityprofiles_searchSearch quality profiles
qualityprofiles_set_defaultSelect the default profile for a given language.
Requires to be logged in and the 'Administer Quality Profiles' permission.
rules_createCreate a custom rule.
Requires the 'Administer Quality Profiles' permission
rules_deleteDelete custom rule.
Requires the 'Administer Quality Profiles' permission
rules_repositoriesList available rule repositories
rules_searchSearch for a collection of relevant rules matching a specified query.
rules_showGet detailed information about a rule
rules_tagsList rule tags
rules_updateUpdate an existing rule.
Requires the 'Administer Quality Profiles' permission
server_versionVersion of SonarQube in plain text
settings_list_definitionsList settings definitions.
Requires 'Browse' permission when a component is specified
To access licensed settings, authentication is required
To access secured settings, one of the following permissions is required:
  • 'Execute Analysis'
  • 'Administer System'
  • 'Administer' rights on the specified component
settings_resetRemove a setting value.
The settings defined in conf/sonar.properties are read-only and can't be changed.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified component
settings_setUpdate a setting value.
Either 'value' or 'values' must be provided.
The settings defined in conf/sonar.properties are read-only and can't be changed.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified component
settings_valuesList settings values.
If no value has been set for a setting, then the default value is returned.
The settings from conf/sonar.properties are excluded from results.
Requires 'Browse' or 'Execute Analysis' permission when a component is specified.
Secured settings values are not returned by the endpoint.
sources_rawGet source code as raw text. Require 'See Source Code' permission on file
sources_scmGet SCM information of source files. Require See Source Code permission on file's project
Each element of the result array is composed of:
  1. Line number
  2. Author of the commit
  3. Datetime of the commit (before 5.2 it was only the Date)
  4. Revision of the commit (added in 5.2)
sources_showGet source code. Requires See Source Code permission on file's project
Each element of the result array is composed of:
  1. Line number
  2. Content of the line
system_change_log_levelTemporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission.
system_db_migration_statusDisplay the database migration status of SonarQube.
State values are:
  • NO_MIGRATION: DB is up to date with current version of SonarQube.
  • NOT_SUPPORTED: Migration is not supported on embedded databases.
  • MIGRATION_RUNNING: DB migration is under go.
  • MIGRATION_SUCCEEDED: DB migration has run and has been successful.
  • MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).
  • MIGRATION_REQUIRED: DB migration is required.
system_healthProvide health status of SonarQube.

Although global health is calculated based on both application and search nodes, detailed information is returned only for application nodes.

  • GREEN: SonarQube is fully operational
  • YELLOW: SonarQube is usable, but it needs attention in order to be fully operational
  • RED: SonarQube is not operational

system_infoGet detailed information about system configuration.
Requires 'Administer' permissions.
system_logsGet system logs in plain-text format. Requires system administration permission.
system_migrate_dbMigrate the database to match the current version of SonarQube.
Sending a POST request to this URL starts the DB migration. It is strongly advised to make a database backup before invoking this WS.
State values are:
  • NO_MIGRATION: DB is up to date with current version of SonarQube.
  • NOT_SUPPORTED: Migration is not supported on embedded databases.
  • MIGRATION_RUNNING: DB migration is under go.
  • MIGRATION_SUCCEEDED: DB migration has run and has been successful.
  • MIGRATION_FAILED: DB migration has run and failed. SonarQube must be restarted in order to retry a DB migration (optionally after DB has been restored from backup).
  • MIGRATION_REQUIRED: DB migration is required.
system_pingAnswers "pong" as plain-text
system_restartRestarts server. Requires 'Administer System' permission. Performs a full restart of the Web, Search and Compute Engine Servers processes. Does not reload sonar.properties.
system_statusGet state information about SonarQube.

status: the running status

  • STARTING: SonarQube Web Server is up and serving some Web Services (eg. api/system/status) but initialization is still ongoing
  • UP: SonarQube instance is up and running
  • DOWN: SonarQube instance is up but not running because migration has failed (refer to WS /api/system/migrate_db for details) or some other reason (check logs).
  • RESTARTING: SonarQube instance is still up but a restart has been requested (refer to WS /api/system/restart for details).
  • DB_MIGRATION_NEEDED: database migration is required. DB migration can be started using WS /api/system/migrate_db.
  • DB_MIGRATION_RUNNING: DB migration is running (refer to WS /api/system/migrate_db for details)

system_upgradesLists available upgrades for the SonarQube instance (if any) and for each one, lists incompatible plugins and plugins requiring upgrade.
Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed is provided in the response.
user_groups_add_userAdd a user to a group.
'id' or 'name' must be provided.
Requires the following permission: 'Administer System'.
user_groups_createCreate a group.
Requires the following permission: 'Administer System'.
user_groups_deleteDelete a group. The default groups cannot be deleted.
'id' or 'name' must be provided.
Requires the following permission: 'Administer System'.
user_groups_remove_userRemove a user from a group.
'id' or 'name' must be provided.
Requires the following permission: 'Administer System'.
user_groups_searchSearch for user groups.
Requires the following permission: 'Administer System'.
user_groups_updateUpdate a group.
Requires the following permission: 'Administer System'.
user_groups_usersSearch for users with membership information with respect to a group.
Requires the following permission: 'Administer System'.
user_tokens_generateGenerate a user access token.
Please keep your tokens secret. They enable to authenticate and analyze projects.
It requires administration permissions to specify a 'login' and generate a token for another user. Otherwise, a token is generated for the current user.
user_tokens_revokeRevoke a user access token.
It requires administration permissions to specify a 'login' and revoke a token for another user. Otherwise, the token for the current user is revoked.
user_tokens_searchList the access tokens of a user.
The login must exist and active.
Field 'lastConnectionDate' is only updated every hour, so it may not be accurate, for instance when a user is using a token many times in less than one hour.
It requires administration permissions to specify a 'login' and list the tokens of another user. Otherwise, tokens for the current user are listed.
Authentication is required for this API endpoint
users_anonymizeAnonymize a deactivated user. Requires Administer System permission
users_change_passwordUpdate a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password.
users_createCreate a user.
If a deactivated user account exists with the given login, it will be reactivated.
Requires Administer System permission
users_deactivateDeactivate a user. Requires Administer System permission
users_dismiss_sonarlint_adDismiss SonarLint advertisement. Deprecated since 9.6, replaced api/users/dismiss_notice
users_groupsLists the groups a user belongs to.
Requires Administer System permission.
users_searchGet a list of users. By default, only active users are returned.
The following fields are only returned when user has Administer System permission or for logged-in in user :
  • 'email'
  • 'externalIdentity'
  • 'externalProvider'
  • 'groups'
  • 'lastConnectionDate'
  • 'tokensCount'
Field 'lastConnectionDate' is only updated every hour, so it may not be accurate, for instance when a user authenticates many times in less than one hour.
users_updateUpdate a user.
Requires Administer System permission
users_update_identity_providerUpdate identity provider information.
It's only possible to migrate to an installed identity provider. Be careful that as soon as this information has been updated for a user, the user will only be able to authenticate on the new identity provider. It is not possible to migrate external user to local one.
Requires Administer System permission.
users_update_loginUpdate a user login. A login can be updated many times.
Requires Administer System permission
webhooks_createCreate a Webhook.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webhooks_deleteDelete a Webhook.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webhooks_deliveriesGet the recent deliveries for a specified project or Compute Engine task.
Require 'Administer' permission on the related project.
Note that additional information are returned by api/webhooks/delivery.
webhooks_deliveryGet a webhook delivery by its id.
Require 'Administer System' permission.
Note that additional information are returned by api/webhooks/delivery.
webhooks_listSearch for global webhooks or project webhooks. Webhooks are ordered by name.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webhooks_updateUpdate a Webhook.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webservices_listList web services
webservices_response_exampleDisplay web service response example

Testing

TODO