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, organizations, branches, webhooks, user tokens and SVG badges.
Who is this for?
This connector is used by three different roles. Jump to the section that matches yours — each one is self-contained.Agent builder
You build agents in Agent Factory and want them to use SonarQube. → Agent builder tab.
Platform admin
You run the platform and set up SonarQube once for everyone. → Platform admin setup accordion below.
Workspace builder
You write Builder automations (DSUL) that call SonarQube operations directly. → Workspace builder tab.
Prerequisites
- A SonarQube server (self-hosted) or a SonarQube Cloud account.
- A User Token generated in My Account > Security > Generate Tokens (passed server-side as
Authorization: Bearer <token>). - The API base URL of your instance:
- SonarCloud:
https://sonarcloud.io/api - Self-hosted:
https://<your-sonarqube-host>/api
- SonarCloud:
- For SonarCloud only: the organization key that owns your projects (most search and create operations require it — use
searchOrganizationsto discover the keys visible to your token).
Platform admin (Governance) — one-time platform setup
Platform admin (Governance) — one-time platform setup
Goal: SonarQube is a per-workspace connector — each workspace pastes its own SonarQube User Token (see the Workspace builder tab), so there is no platform-wide credential to provision. The only optional platform task is to publish SonarQube as a reusable capability in AI Governance so agent builders can enable it from the catalog instead of pasting a raw MCP endpoint.
There is no shared SonarQube credential and no central OAuth client for this connector. The SonarQube User Token always lives in the consuming workspace and is resolved server-side. A Governance capability you publish here points at a specific workspace’s MCP endpoint; that workspace still owns the credential.
Declare the capability in AI Governance (optional)
1
Open AI Governance > Capabilities
Create (or edit) the SonarQube capability.
2
Point it at the MCP endpoint
Set the capability’s MCP server URL to the connector’s MCP Endpoint (the workspace running the connector), and set its Scope to:The
agent_id in the scope is what lets the connector identify the calling agent.3
Make it available to agent builders
Once created, the capability appears in the capability picker for agent builders in your organization, who enable it on their agents. Access to the catalog follows your organization’s existing roles; there is no per-capability role grant for this connector.
- Agent builder (Agent Factory)
- Workspace builder (DSUL)
Agent builder
Goal: let an agent you build in Agent Factory read and act on SonarQube code-quality data through MCP tools.Before an agent can call the connector, a Workspace builder must have installed and configured the SonarQube app in a workspace (see the Workspace builder tab). Optionally, a Platform admin may have published a SonarQube capability in AI Governance (see the Platform admin setup accordion above).
1
Install and configure the connector in a workspace
Follow the Workspace builder tab: install SonarQube in your workspace and provide the API base URL and User Token.
2
Add the MCP capability to your agent
In your agent, add a capability pointing at the workspace’s MCP Endpoint URL, and set its Scope to:The server URL and identity propagation are then wired; the SonarQube token is fetched server-side from the app configuration.
3
Brief the agent in its system prompt
Wiring the capability is not enough — the agent also needs to know the MCP exists and when to reach for it. Add a short paragraph to the agent’s system prompt. Copy-pasteable starter:Refine the trigger keywords (project keys, branch names, rule families) so the agent reliably picks up the right intent in your context.
Legacy AI Knowledge agents (no native MCP picker): add the connector under Advanced > Tools > MCP and paste the MCP Endpoint URL. Newer Agent Factory agents use the native capability picker described above.
Available Tools
System & Authentication
Organizations
Projects
Components
Issues
Measures & Metrics
Quality Gates
Quality Profiles & Rules
Hotspots
User Tokens
Analyses & Branches
Webhooks
Badges
Output Formats
Every tool accepts anoutputFormat argument that controls the MCP response shape:verbose(default) — human-readable text for LLM consumptionstructured— machine-readable JSON instructuredContentboth— both text and structured content
Tool Details
searchIssues
Search and filter issues on a project. Default response includes all issues the token can see; combine filters to scope down.searchOrganizations
Discover the SonarCloud organization keys your token can see — call this first when you do not know theorganization value other tools require.transitionIssue
Move an issue through SonarQube’s workflow.getComponentMeasures
Read one or several metric values for a component (project, file, directory).getProjectQualityGateStatus
Useful as a one-shot pass/fail check for CI gates.createProject
Provision a new project. On SonarCloud,organization is required.Error Handling
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 (see the Workspace builder tab). “Invalid credentials” — SonarQube rejected the token (revoked, expired or wrong instance). Re-generate the User Token and re-paste it, and confirm the API base URL matches your instance (SonarCloud vs self-hosted). “organization parameter is missing” — On SonarCloud, most search and create operations require theorganization key. Pass it explicitly in the tool arguments or as a default in your DSUL automation; call searchOrganizations to discover the keys your token can see.
searchProjects returns nothing on a public org — searchProjects is admin-scoped (it only lists projects in organizations you administer). To browse projects in any organization, including public ones you are not a member of, use searchPublicProjects.
Badge tools return non-SVG content — getProjectMeasureBadge 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
Learn how Agent Factory agents consume MCP tools in Prisme.ai.