Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prisme.ai/llms.txt

Use this file to discover all available pages before exploring further.

The SonarQube app provides read/write access to the SonarQube and SonarQube Cloud Web API. It can be used either as a Builder app (automations call SonarQube instructions directly) or as a remote MCP server consumed by a Knowledges agent — covering projects, components, issues, security hotspots, measures, metrics, quality gates, quality profiles, rules, user tokens, analyses, branches, webhooks and SVG badges.

Code Quality

Issues, security hotspots, rules and quality profiles to triage code findings

Project Insights

Measures, metric definitions, history, quality gate status and analyses

Admin & Operations

Projects, branches, webhooks, user tokens and SVG badges

Prerequisites

  • A SonarQube server (self-hosted) or a SonarQube Cloud account
  • A User Token generated in My Account > Security > Generate Tokens (passed as Authorization: Bearer <token>)
  • The API base URL of your instance:
    • SonarCloud: https://sonarcloud.io/api
    • Self-hosted: https://<your-sonarqube-host>/api
  • For SonarCloud only: the organization key that owns your projects (most search/create operations require it)

Installation

  1. Go to Apps in your workspace
  2. Search for SonarQube and install it
  3. Open the app instance configuration and fill in the required fields

Configuration

FieldDescription
SonarQube API Base URLBase URL of the SonarQube API. Defaults to https://sonarcloud.io/api — replace with your self-hosted instance URL when applicable
API TokenSonarQube User Token, stored as a workspace secret. Passed as Authorization: Bearer <token>
MCP EndpointAuto-populated on install — URL of the MCP endpoint for this instance
MCP API KeyAuto-populated on install — signed key used in the mcp-api-key header. Do not modify
MCP Endpoint and MCP API Key are generated automatically by the onInstall flow and are only needed to expose this instance as an MCP server (see the next tab).

Available Instructions

Every instruction resolves credentials from the workspace configuration. SonarQube identifiers are project keys, component keys, issue keys, rule keys and login names — never numeric IDs except for quality-gate gateId. Most list / search operations accept p (page index, 1-based) and ps (page size, max 500) for pagination.

System & Authentication

InstructionArguments
validateAuthentication
getServerVersion
listLanguagesq

Projects

InstructionArguments
searchProjectsorganization, projects, q, qualifiers, visibility (public/private), analyzedBefore, onProvisionedOnly, p, ps
createProjectname, project, organization, visibility (public/private)
deleteProjectproject*
updateProjectKeyfrom, to
updateProjectVisibilityproject, visibility (public/private)

Components

InstructionArguments
showComponentcomponent*, branch, pullRequest
searchComponentsq, qualifiers (TRK, FIL, DIR, …), organization, p, ps
getComponentTreecomponent*, strategy (children/all/leaves), qualifiers, q, branch, s, p, ps

Issues

InstructionArguments
searchIssuescomponentKeys, projects, assignees, author, severities, types, statuses, resolutions, resolved, tags, createdAfter, createdBefore, languages, rules, branch, pullRequest, s, asc, p, ps
assignIssueissue*, assignee
transitionIssueissue, transition (confirm/unconfirm/reopen/resolve/falsepositive/wontfix/close)
addIssueCommentissue, text
setIssueTagsissue*, tags
setIssueSeverityissue, severity (INFO/MINOR/MAJOR/CRITICAL/BLOCKER)
setIssueTypeissue, type (BUG/VULNERABILITY/CODE_SMELL)

Measures & Metrics

InstructionArguments
getComponentMeasurescomponent, metricKeys, branch, pullRequest, additionalFields
getComponentTreeMeasurescomponent, metricKeys, strategy (children/all/leaves), qualifiers, s, p, ps
getMeasuresHistorycomponent, metrics, from, to, p, ps
searchMetricsf, p, ps

Quality Gates

InstructionArguments
listQualityGatesorganization
showQualityGateid, name, organization
getProjectQualityGateStatusprojectKey, projectId, branch, pullRequest
selectQualityGateprojectKey*, gateId, gateName, organization

Quality Profiles & Rules

InstructionArguments
searchQualityProfilesorganization, language, project, qualityProfile, defaults
searchRulesorganization, q, languages, repositories, severities, types, tags, statuses, qprofile, activation, p, ps
showRulekey*, organization

Hotspots

InstructionArguments
searchHotspotsprojectKey, branch, pullRequest, status (TO_REVIEW/REVIEWED), resolution (FIXED/SAFE/ACKNOWLEDGED), onlyMine, sinceLeakPeriod, p, ps
showHotspothotspot*
changeHotspotStatushotspot, status (TO_REVIEW/REVIEWED), resolution, comment

User Tokens

InstructionArguments
searchUserTokenslogin
generateUserTokenname*, login, type (USER_TOKEN/PROJECT_ANALYSIS_TOKEN/GLOBAL_ANALYSIS_TOKEN), projectKey, expirationDate
revokeUserTokenname*, login

Analyses & Branches

InstructionArguments
searchProjectAnalysesproject*, branch, category, from, to, p, ps
createAnalysisEventanalysis, name, category (VERSION/OTHER)
listProjectBranchesproject*
deleteProjectBranchproject, branch

Webhooks

InstructionArguments
listWebhooksorganization, project
createWebhookname, url, organization, project, secret
deleteWebhookwebhook*

Badges

InstructionArguments
getProjectMeasureBadgeproject, metric, branch, token
getProjectQualityGateBadgeproject*, branch, token
Arguments flagged with * are required. On SonarCloud, most search and create operations also require an organization key — pass it explicitly or default it in your automation.

DSUL Examples

List all unresolved bugs on a project

- SonarQube.searchIssues:
    componentKeys: '{{projectKey}}'
    types: BUG
    statuses: OPEN,CONFIRMED,REOPENED
    ps: 100
    output: issues

Get the quality gate status of a branch

- SonarQube.getProjectQualityGateStatus:
    projectKey: '{{projectKey}}'
    branch: main
    output: gateStatus
- conditions:
    '{{gateStatus.projectStatus.status}} == "ERROR"':
      - emit:
          event: qualityGateFailed
          payload:
            project: '{{projectKey}}'
            conditions: '{{gateStatus.projectStatus.conditions}}'

Triage a flaky issue as false positive

- SonarQube.transitionIssue:
    issue: '{{issueKey}}'
    transition: falsepositive
- SonarQube.addIssueComment:
    issue: '{{issueKey}}'
    text: 'False positive — already addressed in {{commitSha}}'

Pull last week’s coverage and bugs trend

- SonarQube.getMeasuresHistory:
    component: '{{projectKey}}'
    metrics: coverage,bugs,vulnerabilities,code_smells
    from: '{{lastWeekIso}}'
    ps: 1000
    output: history

Provision a new SonarCloud project

- SonarQube.createProject:
    name: '{{repoName}}'
    project: '{{org}}_{{repoName}}'
    organization: '{{org}}'
    visibility: private
    output: project
- SonarQube.selectQualityGate:
    projectKey: '{{project.project.key}}'
    gateName: 'Sonar way'
    organization: '{{org}}'

Error Handling

HTTP StatusErrorSolution
400Bad RequestVerify required arguments — on SonarCloud, most operations need organization
401UnauthorizedVerify the User Token and baseUrl
403ForbiddenCheck the SonarQube permissions of the token owner (admin-only operations such as searchUserTokens for other users)
404Not FoundVerify project keys, component keys, issue keys and login names
409ConflictResource already exists (project key, token name, …) — pick a different identifier
429Rate LimitedBack off and retry with exponential delay
500Server ErrorServer-side issue — check SonarQube logs (self-hosted) or SonarCloud status

Common Issues

“Not configured” — The app instance has no User Token. Generate one in SonarQube > My Account > Security > Generate Tokens and paste it in the app configuration. “Invalid API key” (MCP) — The mcp-api-key header does not match the central app secret. Reinstall the app instance to regenerate a signed key. “Credentials lookup failed” — The MCP endpoint could not reach the getConfig webhook of the installed app. Verify that the app instance is still installed in the expected workspace. “organization parameter is missing” — On SonarCloud, most search and create operations require the organization key. Pass it explicitly in the tool arguments or as a default in your DSUL automation. Badge tools return non-SVG contentgetProjectMeasureBadge and getProjectQualityGateBadge return raw SVG. The MCP transport currently surfaces them as JSON-encoded strings; consume them in App mode (DSUL) to write the SVG straight to a file or HTTP response.

External Resources

SonarQube Web API

Official SonarQube Web API reference

SonarCloud Web API

SonarCloud-flavored Web API reference

SonarSource Documentation

Product documentation, metrics catalog, rule descriptions

Tool Agents

Plug MCP servers into Knowledges agents