> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Set up SonarQube in Metorial for Claude, ChatGPT and Cursor
URL: https://metorial.com/docs/integrations/sonarqube
Last updated: 2026-11-24

Share SonarQube with your team in Claude, ChatGPT and Cursor through Metorial: bearer token sign-in, 24 tools (22 read-only).

---

To give your team SonarQube in Claude, ChatGPT, Cursor and other AI clients, an admin shares the SonarQube integration in a Metorial portal, and each person connects with a bearer token. Agents can connect to SonarQube Server or SonarQube Cloud to inspect project quality, issues, branches, pull requests, measures, quality gate status, dependency risks, and advanced code analysis. The integration has 24 tools, 22 read-only and 2 write.

**What you will learn**

- How an admin shares SonarQube in a portal and how each person connects
- What SonarQube asks for when you connect, and where to find it
- How to keep the 22 read-only tools and reject the other 2

**Before you start**

- A [portal](https://metorial.com/docs/platform/workforce/portals) with at least one access group
- A bearer token from SonarQube for each person, or one for a shared connection
- For the CLI steps: the [Metorial CLI](https://metorial.com/docs/platform/cli), signed in to your portal

## Sign-in method

| Method | Type | What a person provides |
| --- | --- | --- |
| **Bearer Token** | API token | `token` |

### Bearer Token

To connect, a person enters:

- `token`: SonarQube Server or SonarQube Cloud token used as a bearer token.

### Setup settings

Setup also asks for:

- `deployment` (optional): Use "server" for self-hosted SonarQube Server or "cloud" for SonarQube Cloud. One of "server", "cloud".
- `serverBaseUrl` (optional): Base URL for SonarQube Server, for example https://sonarqube.example.com. Required when deployment is server.
- `cloudRegion` (optional): SonarQube Cloud region. Use eu for sonarcloud.io or us for sonarqube.us. One of "eu", "us".
- `organization` (optional): Default SonarQube Cloud organization key for organization-scoped tools.
- `defaultProjectKey` (optional): Default SonarQube project key used by project-scoped tools when projectKey is omitted.

## Admin: share SonarQube in a portal

### In the dashboard

1. **Open Shared Resources**

   Open **Workforce**, choose the portal, and select **Shared Resources** under **Access**.

2. **Share a new integration**

   Select **Share a Resource**, then **New Integration**, and choose SonarQube. For how members connect, choose **Each person connects** so everyone enters their own bearer token, or **Shared connection** to enter one bearer token for everyone.

3. **Limit the tools**

   Under **Tool Filters**, set the write and destructive groups to **Reject** if agents should only read from SonarQube.

4. **Choose who gets it**

   Add the access groups that should see SonarQube. When a person asks for access from the portal, the request appears under **Access Requests**.

### With the CLI

The CLI cannot create the per-user SonarQube integration. Once it exists, check which groups have it:

```bash
metorial-admin portals access list <portal-id> --type provider_template --search sonarqube
```

## Employee: connect SonarQube

### In the portal

1. **Open SonarQube in the catalog**

   Sign in to your portal and open SonarQube. The status reads **Available**.

2. **Authenticate**

   Under **Quick setup**, select **Authenticate**. In the setup window, enter your bearer token (token).

3. **Confirm**

   The status changes to **Configured**. If it later reads **Needs reconnect**, select **Reconnect** and sign in again.

### With the CLI

```bash
metorial catalog search sonarqube
metorial setup <catalog-item-id>
```

`catalog search` prints the catalog item ID. 

### Add it to your AI client

`metorial install` adds your SonarQube connection to a local MCP client such as Claude Code, Cursor or Codex. `metorial list` prints the integration ID and `metorial client list` the client identifiers.

```bash
metorial list sonarqube
metorial client list
metorial install <client-identifier> <integration-id>
```

For a client that takes a server URL, such as ChatGPT, `metorial install custom <integration-id>` creates an installation token and shows the endpoint details.

## Make it read-only

Open the integration's **Tool Filters** and set the write and destructive groups to **Reject**. Agents keep the 22 read-only tools, such as `show_rule` and `ping_system`, and lose the 2 write tools, such as `change_sonar_issue_status` or `change_security_hotspot_status`.

Employees see the result on the integration's page in the portal under **Tool access**. For the full walkthrough, see [Tool permissions](https://metorial.com/docs/platform/guides/tool-permissions).

## Check it worked

```bash
metorial list sonarqube
metorial tools <integration-id>
metorial call <integration-id> list_quality_gates -d '{}'
```

`metorial tools` lists the 24 tools, minus any you rejected. `list_quality_gates` takes no input. It lists all quality gates.

To see every input a tool takes, run `metorial schema <integration-id> <tool-key>`.

## Tools

### Read-only tools (22)

- `get_system_status`: Get state information about SonarQube Server.
- `list_languages`: List all programming languages supported in this instance.
- `list_quality_gates`: List all quality gates.
- `get_scm_info`: Get SCM information of source files. Needs `component`.
- `get_duplications`: Get duplications for a file. Needs `component`.
- `search_duplicated_files`: Search for files with code duplications in a project.
- `search_files_by_coverage`: Search for files in a project sorted by coverage (ascending - worst coverage first).
- `get_project_quality_gate_status`: Get the Quality Gate Status for a project.
- `search_dependency_risks`: Search for software composition analysis issues (dependency risks) of a project, paired with releases that appear in the analyzed project, application, or portfolio.
- `run_advanced_code_analysis`: Run advanced code analysis on a single file using SonarQube Cloud's server-side engine.
- `get_raw_source`: Get source code as raw text.
- `get_file_coverage_details`: Get complete line-by-line coverage information for a file, including which exact lines are uncovered and which have partially covered branches.
- `get_component_measures`: Get SonarQube measures for a project, such as ncloc, complexity, violations, coverage, etc.
- `search_security_hotspots`: Search for Security Hotspots in a project.
- `list_pull_requests`: List all pull requests for a project.
- `search_sonar_issues_in_projects`: Search for issues (bugs, vulnerabilities, code smells) in my SonarQube projects.
- `search_my_sonarqube_projects`: Find SonarQube projects in your organization or instance.
- `search_metrics`: Search for available metrics.
- `show_security_hotspot`: Get detailed information about a specific Security Hotspot, including rule details, code context, flows, and comments.
- `list_branches`: List analyzed branches for a SonarQube project.
- `show_rule`: Shows detailed information about a SonarQube rule.
- `ping_system`: Ping the SonarQube Server system to check whether it is reachable.

### Write tools (2)

- `change_sonar_issue_status`: Change the status of an issue.
- `change_security_hotspot_status`: Change the status of a Security Hotspot to review it.

## Next steps

- [Claude Code](https://metorial.com/docs/platform/clients/claude-code), [Cursor](https://metorial.com/docs/platform/clients/cursor), [Codex](https://metorial.com/docs/platform/clients/codex) and [ChatGPT](https://metorial.com/docs/platform/clients/chatgpt): connect each client to your portal and use SonarQube there
- [Tool permissions](https://metorial.com/docs/platform/guides/tool-permissions): tool filters and what employees see
- [SonarQube on metorial.com](https://metorial.com/integrations/sonarqube): the integration overview