# SonarQube Cloud-hosted

To always use the most up to date version of the SonarQube MCP Server, connect directly to the SonarQube Cloud-hosted MCP server. No local setup is required.

Use the SonarQube MCP server embedded in SonarQube Cloud to avoid running and maintaining your own MCP infrastructure while always using the current server version. The embedded server exposes a smaller, fixed subset of tools.

<div align="left"><figure><img src="/files/nc216YJB324Zqt0Bmm72" alt="Use the the SonarQube Cloud-hosted MCP server to connect your MCP client directly to the SonarQube Cloud API."><figcaption><p>Connect your MCP client directly to the SonarQube Cloud API using the SonarQube Cloud-hosted MCP server.</p></figcaption></figure></div>

## Use the configuration generator

Use the official SonarQube MCP Server configuration generator to get a configuration snippet. To do this:

1. Identify your agent.
2. Find your [common variables](/agent-centric-development-cycle/developer-tools/mcp-server/reference/environment-variables.md#common-variables).
3. Enter the information into the [SonarQube Server configuration generator](https://mcp.sonarqube.com/config-generator.html) with the SonarQube Cloud (embedded) configuration.
4. Paste the generated configuration into your configuration file.

## Manual setup

Add this configuration to your mcp.json file in your AI-enabled client config folder:

```json
"sonarqube": {
  "type": "http",
  "url": "https://api.sonarcloud.io/mcp",
  "headers": {
    "Authorization": "Bearer <YourSonarQubeUserToken>",
    "SONARQUBE_ORG": "<YourSonarQubeOrganization>"
    //"SONARQUBE_READ_ONLY": "false" //Default value is true.
    //"SONARQUBE_TOOLSETS": "<YourOptionalToolset>" //Using this optional header refines the default toolsets.
  }
}
```

> **Note:** Replace your `"url"` with `https://api.sonarqube.us/mcp` if you're connecting to a SonarQube Cloud organization in the US region.

Optional headers include:

* SONARQUBE\_READ\_ONLY: Boolean. Set to `true` to enable read-only mode (default) or `false` to allow write operations.
* SONARQUBE\_TOOLSETS: The embedded MCP server includes a default list of toolsets. A subset of this list can be defined:
  * `analysis`,`coverage`,`dependency-risks`,`duplications`,`quality-gates`,`issues`,`measures`,`projects`,`rules`,`security-hotspots`
  * The `analysis` toolset is only available to subscribers of the [Agentic Analysis](/agent-centric-development-cycle/features/agentic-analysis.md) add-on.
  * For more details about the tools in each toolset, see the SonarQube MCP Server [Tools](/agent-centric-development-cycle/developer-tools/mcp-server/reference/tools.md) page.

> **Warning:** Using the optional headers replaces the default configuration. For example, when you add `"SONARQUBE_TOOLSETS": "issues,projects"`, you won't load the `security-hotspots` and `quality-gates` toolsets.

### Tool availability with SonarQube Cloud

When you use the SonarQube MCP Server through SonarQube Cloud, you get a smaller, fixed set of tools compared to running the MCP Server yourself. This is by design and can't be changed:

* Heavy analysis tools are disabled to protect the shared SonarQube Cloud infrastructure.
* [Context Augmentation](/agent-centric-development-cycle/features/context-augmentation.md) tools are not available because they require a local filesystem mount, which the hosted environment cannot provide. To use Context Augmentation tools, set up a local MCP Server using [Stdio](/agent-centric-development-cycle/developer-tools/mcp-server/setup/self-hosted.md#local-server-stdio).
* Rarely used, non-default tools are excluded to keep the MCP context small and focused.

For the complete list of tools supported by a self-hosted SonarQube MCP Server, see the [Tools](/agent-centric-development-cycle/developer-tools/mcp-server/reference/tools.md) page.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/mcp-server/setup/sonarqube-cloud-hosted.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
