SonarQube MCP服务器

SonarQube MCP服务器是为SonarQube服务器提供模型上下文协议服务的工具,用于增强代码分析和项目管理功能。

  • by 9506hqwy
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 9506hqwy/sonarqube-mcp-server

使用说明

SonarQube MCP Server

This repository provides model context protocol server for SonarQube server.

Build

Build binary.

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

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.
      --port uint16       SonarQube server port number. (default 9000)
      --readonly          HTTP GET method only. (default true)
      --server string     SonarQube server hostname or IP address. (default "127.0.0.1")
      --token string      SonarQube user type token.
      --user string       SonarQube server username.

Set environment variable instead of arguments.

Argument Environment Variable
--server SONARQUBE_SERVER
--port SONARQUBE_PORT
--user SONARQUBE_USER
--password SONARQUBE_PASSWORD
--token SONARQUBE_TOKEN
--readonly SONARQUBE_READONLY

Tools

Tool Description
alm_integrations_import_gitlab_project Import a GitLab project to SonarQube, creating a new project and configuring MR decoration
Requires the 'Create Projects' permission
alm_integrations_list_azure_projects List Azure projects
Requires the 'Create Projects' permission
alm_integrations_list_bitbucketserver_projects List the Bitbucket Server projects
Requires the 'Create Projects' permission
alm_integrations_search_azure_repos Search the Azure repositories
Requires the 'Create Projects' permission
alm_integrations_search_bitbucketcloud_repos Search the Bitbucket Cloud repositories
Requires the 'Create Projects' permission
alm_integrations_search_bitbucketserver_repos Search the Bitbucket Server repositories with REPO_ADMIN access
Requires the 'Create Projects' permission
alm_integrations_search_gitlab_repos Search the GitLab projects.
Requires the 'Create Projects' permission
alm_integrations_set_pat Set 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_binding Count number of project bound to an DevOps Platform setting.
Requires the 'Administer System' permission
alm_settings_create_azure Create Azure instance Setting.
Requires the 'Administer System' permission
alm_settings_create_bitbucket Create Bitbucket instance Setting.
Requires the 'Administer System' permission
alm_settings_create_bitbucketcloud Configure a new instance of Bitbucket Cloud.
Requires the 'Administer System' permission
alm_settings_create_github Create GitHub instance Setting.
Requires the 'Administer System' permission
alm_settings_create_gitlab Create GitLab instance Setting.
Requires the 'Administer System' permission
alm_settings_delete Delete an DevOps Platform Setting.
Requires the 'Administer System' permission
alm_settings_get_binding Get DevOps Platform binding of a given project.
Requires the 'Administer' permission on the project
alm_settings_list List 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_definitions List DevOps Platform Settings, sorted by created date.
Requires the 'Administer System' permission
alm_settings_update_azure Update Azure instance Setting.
Requires the 'Administer System' permission
alm_settings_update_bitbucket Update Bitbucket instance Setting.
Requires the 'Administer System' permission
alm_settings_update_bitbucketcloud Update Bitbucket Cloud Setting.
Requires the 'Administer System' permission
alm_settings_update_github Update GitHub instance Setting.
Requires the 'Administer System' permission
alm_settings_update_gitlab Update GitLab instance Setting.
Requires the 'Administer System' permission
alm_settings_validate Validate an DevOps Platform Setting by checking connectivity and permissions
Requires the 'Administer System' permission
analysis_cache_get Get 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_login Authenticate a user.
authentication_logout Logout a user.
authentication_validate Check credentials.
ce_activity Search 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_status Returns CE activity related metrics.
Requires 'Administer System' permission or 'Administer' rights on the specified project.
ce_component Get 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_task Give 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_search Search for components
components_show Returns 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_tree Navigate 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_show Get duplications. Require Browse permission on file's project
favorites_add Add 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_remove Remove a component (project, portfolio, application etc.) as favorite for the authenticated user.
Requires authentication.
favorites_search Search for the authenticated user favorites.
Requires authentication.
hotspots_search Search 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_show Provides the details of a Security Hotspot.
issues_add_comment Add a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue.
issues_assign Assign/Unassign an issue. Requires authentication and Browse permission on project
issues_authors Search SCM accounts which match a given query.
Requires authentication.
When issue indexation is in progress returns 503 service unavailable HTTP code.

issues_bulk_change Bulk change on issues. Up to 500 issues can be updated.
Requires authentication.
issues_changelog Display changelog of an issue.
Requires the 'Browse' permission on the project of the specified issue.
issues_delete_comment Delete a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue.
issues_do_transition Do 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_comment Edit a comment.
Requires authentication and the following permission: 'Browse' on the project of the specified issue.
issues_reindex Reindex issues for a project.
Require 'Administer System' permission.
issues_search Search 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_severity Change 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_tags Set tags on an issue.
Requires authentication and Browse permission on project
issues_set_type Change 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_tags List tags matching a given query
languages_list List supported programming languages
measures_component Return component with specified measures.
Requires the following permission: 'Browse' on the project of specified component.
measures_component_tree Navigate 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_history Search 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_search Search for metrics
metrics_types List all available metric types.
monitoring_metrics Return 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_list List the New Code Periods for all branches in a project.
Requires the permission to browse the project
new_code_periods_set Updates 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_show Shows 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_unset Unset 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_add Add 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_list List 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_remove Remove 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_group Add 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_template Add 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_template Add a project creator to a permission template.
Requires the following permission: 'Administer System'.
permissions_add_user Add 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_template Add a user to a permission template.
Requires the following permission: 'Administer System'.
permissions_apply_template Apply 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_template Apply a permission template to several projects.
The template id or name must be provided.
Requires the following permission: 'Administer System'.

permissions_create_template Create a permission template.
Requires the following permission: 'Administer System'.
permissions_delete_template Delete a permission template.
Requires the following permission: 'Administer System'.
permissions_remove_group Remove 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_template Remove 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_template Remove a project creator from a permission template.
Requires the following permission: 'Administer System'.
permissions_remove_user Remove 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_template Remove a user from a permission template.
Requires the following permission: 'Administer System'.
permissions_search_templates List permission templates.
Requires the following permission: 'Administer System'.
permissions_set_default_template Set a permission template as default.
Requires the following permission: 'Administer System'.
permissions_update_template Update a permission template.
Requires the following permission: 'Administer System'.
plugins_available Get 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_all Cancels any operation pending on any plugin (install, update or uninstall)
Requires user to be authenticated with Administer System permissions
plugins_install Installs 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_installed Get the list of all the plugins installed on the SonarQube instance, sorted by plugin name.
Requires authentication.
plugins_pending Get 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_uninstall Uninstalls the plugin specified by its key.
Requires user to be authenticated with Administer System permissions.
plugins_update Updates 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_updates Lists 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_event Create 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_delete Delete a project analysis.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the project of the specified analysis
project_analyses_delete_event Delete 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_search Search 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_baseline Set 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_baseline Unset 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_event Update 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_measure Generate badge for project's measure as an SVG.
Requires 'Browse' permission on the specified project.
project_badges_quality_gate Generate badge for project's quality gate as an SVG.
Requires 'Browse' permission on the specified project.
project_badges_renew_token Creates 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_token Retrieve 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_delete Delete a non-main branch of a project or application.
Requires 'Administer' rights on the specified project or application.
project_branches_list List the branches of a project or application.
Requires 'Browse' or 'Execute analysis' rights on the specified project or application.
project_branches_rename Rename the main branch of a project or application.
Requires 'Administer' permission on the specified project or application.
project_branches_set_automatic_deletion_protection Protect 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_export Triggers 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_create Create a new project link.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
project_links_delete Delete existing project link.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
project_links_search List 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_search Search tags
project_tags_set Set tags on a project.
Requires the following permission: 'Administer' rights on the specified project
projects_bulk_delete Delete 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_create Create a project.
Requires 'Create Projects' permission
projects_delete Delete a project.
Requires 'Administer System' permission or 'Administer' permission on the project.
projects_search Search for projects or views to administrate them.
Requires 'Administer System' permission
projects_update_key Update a project all its sub-components keys.
Requires one of the following permissions:
  • 'Administer System'
  • 'Administer' rights on the specified project
projects_update_visibility Updates visibility of a project or view.
Requires 'Project administer' permission on the specified project or view
qualitygates_copy Copy a Quality Gate.
Either 'sourceName' or 'id' must be provided. Requires the 'Administer Quality Gates' permission.
qualitygates_create Create a Quality Gate.
Requires the 'Administer Quality Gates' permission.
qualitygates_create_condition Add a new condition to a quality gate.
Either 'gateId' or 'gateName' must be provided. Requires the 'Administer Quality Gates' permission.
qualitygates_delete_condition Delete a condition from a quality gate.
Requires the 'Administer Quality Gates' permission.
qualitygates_deselect Remove the association of a project from a quality gate.
Requires one of the following permissions:
  • 'Administer Quality Gates'
  • 'Administer' rights on the project
qualitygates_destroy Delete a Quality Gate.
Either 'id' or 'name' must be specified. Requires the 'Administer Quality Gates' permission.
qualitygates_get_by_project Get 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_list Get a list of quality gates
qualitygates_project_status Get 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_rename Rename a Quality Gate.
Either 'id' or 'currentName' must be specified. Requires the 'Administer Quality Gates' permission.
qualitygates_search Search for projects associated (or not) to a quality gate.
Only authorized projects for the current user will be returned.
qualitygates_select Associate a project to a quality gate.
Requires one of the following permissions:
  • 'Administer Quality Gates'
  • 'Administer' right on the specified project
qualitygates_set_as_default Set a quality gate as the default quality gate.
Either 'id' or 'name' must be specified. Requires the 'Administer Quality Gates' permission.
qualitygates_show Display the details of a quality gate
qualitygates_update_condition Update a condition attached to a quality gate.
Requires the 'Administer Quality Gates' permission.
qualityprofiles_activate_rule Activate a rule on a Quality Profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_activate_rules Bulk-activate rules on one quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_add_project Associate 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_backup Backup a quality profile in XML form. The exported profile can be restored through api/qualityprofiles/restore.
qualityprofiles_change_parent Change a quality profile's parent.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_changelog Get 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_copy Copy a quality profile.
Requires to be logged in and the 'Administer Quality Profiles' permission.
qualityprofiles_create Create a quality profile.
Requires to be logged in and the 'Administer Quality Profiles' permission.
qualityprofiles_deactivate_rule Deactivate a rule on a quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_deactivate_rules Bulk deactivate rules on Quality profiles.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_delete Delete 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_export Export a quality profile.
qualityprofiles_exporters Lists available profile export formats.
qualityprofiles_importers List supported importers.
qualityprofiles_inheritance Show a quality profile's ancestors and children.
qualityprofiles_projects List projects with their association status regarding a quality profile
See api/qualityprofiles/search in order to get the Quality Profile Key
qualityprofiles_remove_project Remove 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_rename Rename a quality profile.
Requires one of the following permissions:
  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
qualityprofiles_restore Restore 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_search Search quality profiles
qualityprofiles_set_default Select the default profile for a given language.
Requires to be logged in and the 'Administer Quality Profiles' permission.
rules_create Create a custom rule.
Requires the 'Administer Quality Profiles' permission
rules_delete Delete custom rule.
Requires the 'Administer Quality Profiles' permission
rules_repositories List available rule repositories
rules_search Search for a collection of relevant rules matching a specified query.
rules_show Get detailed information about a rule
rules_tags List rule tags
rules_update Update an existing rule.
Requires the 'Administer Quality Profiles' permission
server_version Version of SonarQube in plain text
settings_list_definitions List 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_reset Remove 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_set Update 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_values List 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_raw Get source code as raw text. Require 'See Source Code' permission on file
sources_scm Get 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_show Get 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_level Temporarily changes level of logs. New level is not persistent and is lost when restarting server. Requires system administration permission.
system_db_migration_status Display 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_health Provide 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_info Get detailed information about system configuration.
Requires 'Administer' permissions.
system_logs Get system logs in plain-text format. Requires system administration permission.
system_migrate_db Migrate 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_ping Answers "pong" as plain-text
system_restart Restarts server. Requires 'Administer System' permission. Performs a full restart of the Web, Search and Compute Engine Servers processes. Does not reload sonar.properties.
system_status Get 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_upgrades Lists 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_user Add a user to a group.
'id' or 'name' must be provided.
Requires the following permission: 'Administer System'.

user_groups_create Create a group.
Requires the following permission: 'Administer System'.
user_groups_delete Delete a group. The default groups cannot be deleted.
'id' or 'name' must be provided.
Requires the following permission: 'Administer System'.

user_groups_remove_user Remove a user from a group.
'id' or 'name' must be provided.
Requires the following permission: 'Administer System'.
user_groups_search Search for user groups.
Requires the following permission: 'Administer System'.
user_groups_update Update a group.
Requires the following permission: 'Administer System'.
user_groups_users Search for users with membership information with respect to a group.
Requires the following permission: 'Administer System'.
user_tokens_generate Generate 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_revoke Revoke 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_search List 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_anonymize Anonymize a deactivated user. Requires Administer System permission
users_change_password Update 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_create Create a user.
If a deactivated user account exists with the given login, it will be reactivated.
Requires Administer System permission

users_deactivate Deactivate a user. Requires Administer System permission
users_dismiss_sonarlint_ad Dismiss SonarLint advertisement. Deprecated since 9.6, replaced api/users/dismiss_notice
users_groups Lists the groups a user belongs to.
Requires Administer System permission.
users_search Get 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_update Update a user.
Requires Administer System permission
users_update_identity_provider Update 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_login Update a user login. A login can be updated many times.
Requires Administer System permission
webhooks_create Create a Webhook.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webhooks_delete Delete a Webhook.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webhooks_deliveries Get 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_delivery Get a webhook delivery by its id.
Require 'Administer System' permission.
Note that additional information are returned by api/webhooks/delivery.

webhooks_list Search for global webhooks or project webhooks. Webhooks are ordered by name.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webhooks_update Update a Webhook.
Requires 'Administer' permission on the specified project, or global 'Administer' permission.
webservices_list List web services
webservices_response_example Display web service response example

Testing

TODO