# SonarQube MCP Server

> Your agent checks quality gates, explains issues, Security Hotspots and coverage gaps, and analyzes code with SonarQube Cloud or Server.

Sonar's SonarQube MCP Server connects your agent to the code quality and security data in SonarQube Cloud or SonarQube Server, so it can check your work and fix what SonarQube finds without you leaving the chat.

What you can do with it
- Check a project's quality gate, on a branch or a pull request, and find out why it's failing before you merge
- Search issues across your projects, have them explained, and accept them, mark them false positives or reopen them
- Review Security Hotspots and the dependency risks in a project
- Find the files with the lowest test coverage and the exact lines left uncovered
- Analyze a file or a code snippet with SonarQube's analyzers before you commit
- Look up rules, measures, duplications, branches and pull requests

How it connects
It runs on your machine as the sonarsource/sonarqube-mcp container image (Docker or another OCI runtime), or as a JAR with Java 21 or later. Give it a SonarQube user token as SONARQUBE_TOKEN. On its own, the token connects to SonarQube Cloud, and SONARQUBE_ORG fixes the organization. For SonarQube Server (2025.1 or later) or SonarQube Cloud US, set SONARQUBE_URL as well and pass it into the container with -e SONARQUBE_URL, as the install steps do for SONARQUBE_TOKEN. Sonar also runs the server inside SonarQube Cloud at https://api.sonarcloud.io/mcp, with a smaller, fixed set of tools.

Read-only when you want it
Set SONARQUBE_READ_ONLY=true to turn off every tool that changes something, such as changing an issue's status. SONARQUBE_TOOLSETS limits which groups of tools load, which keeps the context small.

Good to know
It sends anonymous usage data to Sonar unless you set TELEMETRY_DISABLED=true. Its Sonar Vortex tools need a Vortex subscription.

- Type: Plugin
- Made by: sonarsource
- Category: Developer tools
- Formats: Local MCP
- Version: 1.30.0
- Website: https://docs.sonarsource.com/sonarqube-mcp-server
- Source: https://github.com/sonarsource/sonarqube-mcp-server
- Page: https://pluginboard.ai/plugins/sonarqube-mcp

## Works with

- Claude
- GitHub Copilot
- Cursor
- Claude Code
- Codex
- Antigravity
- Gemini CLI
- OpenClaw
- OpenCode
- Hermes Agent

## Install

You'll need:

- `SONARQUBE_TOKEN` (required): Your SonarQube USER token
- `SONARQUBE_ORG` (optional): Your SonarQube Cloud organization key (if using SonarQube Cloud)
- `SONARQUBE_URL` (optional): Your SonarQube Server URL (if using SonarQube Server)

Replace each `<NAME>` placeholder with your own value.

### Claude

Add to claude_desktop_config.json:

```json
{
  "mcpServers": {
    "sonarqube-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "docker.io/sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### GitHub Copilot

Add to VS Code: vscode:mcp/install?%7B%22name%22%3A%22sonarqube-mcp-server%22%2C%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22SONARQUBE_TOKEN%22%2C%22docker.io%2Fsonarsource%2Fsonarqube-mcp%22%5D%2C%22env%22%3A%7B%22SONARQUBE_TOKEN%22%3A%22%3CSONARQUBE_TOKEN%3E%22%7D%7D

Run in your terminal:

```shell
code --add-mcp '{"name":"sonarqube-mcp-server","command":"docker","args":["run","-i","--rm","-e","SONARQUBE_TOKEN","docker.io/sonarsource/sonarqube-mcp"],"env":{"SONARQUBE_TOKEN":"<SONARQUBE_TOKEN>"}}'
```

Copilot CLI:

```shell
copilot mcp add sonarqube-mcp-server --env SONARQUBE_TOKEN=<SONARQUBE_TOKEN> -- docker run -i --rm -e SONARQUBE_TOKEN docker.io/sonarsource/sonarqube-mcp
```

### Cursor

Add to Cursor: cursor://anysphere.cursor-deeplink/mcp/install?name=sonarqube-mcp-server&config=eyJjb21tYW5kIjoiZG9ja2VyIiwiYXJncyI6WyJydW4iLCItaSIsIi0tcm0iLCItZSIsIlNPTkFSUVVCRV9UT0tFTiIsImRvY2tlci5pby9zb25hcnNvdXJjZS9zb25hcnF1YmUtbWNwIl0sImVudiI6eyJTT05BUlFVQkVfVE9LRU4iOiI8U09OQVJRVUJFX1RPS0VOPiJ9fQ%3D%3D

Add to .cursor/mcp.json:

```json
{
  "mcpServers": {
    "sonarqube-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "docker.io/sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### Claude Code

Run in your terminal:

```shell
claude mcp add -e SONARQUBE_TOKEN=<SONARQUBE_TOKEN> sonarqube-mcp-server -- docker run -i --rm -e SONARQUBE_TOKEN docker.io/sonarsource/sonarqube-mcp
```

### Codex

Run in your terminal:

```shell
codex mcp add --env SONARQUBE_TOKEN=<SONARQUBE_TOKEN> sonarqube-mcp-server -- docker run -i --rm -e SONARQUBE_TOKEN docker.io/sonarsource/sonarqube-mcp
```

### Antigravity

Add to ~/.gemini/config/mcp_config.json:

```json
{
  "mcpServers": {
    "sonarqube-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "docker.io/sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

### Gemini CLI

Run in your terminal:

```shell
gemini mcp add -e SONARQUBE_TOKEN=<SONARQUBE_TOKEN> sonarqube-mcp-server docker run -i --rm -e SONARQUBE_TOKEN docker.io/sonarsource/sonarqube-mcp
```

### OpenClaw

In a terminal: Run openclaw mcp add sonarqube-mcp-server --command docker, with --arg before each argument (run -i --rm -e SONARQUBE_TOKEN docker.io/sonarsource/sonarqube-mcp) and --env NAME=value for each variable it needs.

### OpenCode

Run in your terminal:

```shell
opencode mcp add sonarqube-mcp-server --env SONARQUBE_TOKEN=<SONARQUBE_TOKEN> -- docker run -i --rm -e SONARQUBE_TOKEN docker.io/sonarsource/sonarqube-mcp
```

### Hermes Agent

Add to ~/.hermes/config.yaml:

```json
{
  "mcp_servers": {
    "sonarqube-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "docker.io/sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<SONARQUBE_TOKEN>"
      }
    }
  }
}
```

---
From Pluginboard (https://pluginboard.ai).
