sonarqube-mcp-server

by @SonarSource

Sonarqube MCP Server

Connect AI coding agents directly to SonarQube Cloud or SonarQube Server to inspect quality gates, issues, Security Hotspots, coverage, and architecture rules. Maintained officially by SonarSource, this Java 21+ / Docker server supports local stdio and multi-user Streamable HTTP/HTTPS.

Server facts

sonarqube-mcp-server

GitHub stars

696

Last commit

Nov 26, 2026

Runtime

java

License

—

Tech

Runtime
java
Transports
stdiostreamable-http
Remote access
No
Authentication
SonarQube User Token / Bearer Token / Hosted Cloud OAuth

Activity

GitHub stars
696
Last commit
Data as of

Tags

  • Static Analysis
  • application security
  • clean code
  • code quality
  • ide
  • linting
  • sast
  • security
  • sonarqube

Overview

Teams evaluating sonarqube mcp typically want agents to diagnose failing quality gates, triage security findings, and analyze modified files before merging pull requests. SonarSource's official Java 21+ server ships primarily as the `sonarsource/sonarqube-mcp` OCI container image—alongside standalone JAR downloads—and integrates directly with Claude Code, Cursor, VS Code, Windsurf, Codex CLI, Zed, Kiro, Gemini CLI, and GitHub Copilot. For local single-user sessions it runs over stdio by default, while remote or multi-user deployments switch to Streamable HTTP or TLS-encrypted HTTPS at `/mcp` via `SONARQUBE_TRANSPORT=http` or `https`.

Authentication requires a SonarQube Cloud token (with optional `SONARQUBE_ORG` and `SONARQUBE_URL=https://sonarqube.us` for US Cloud) or a SonarQube Server USER token paired with `SONARQUBE_URL` targeting SonarQube Server 2025.1+ or Community Build 25.1+; Sonar's hosted Cloud MCP service also supports OAuth. To curb context-window bloat, set `SONARQUBE_TOOLSETS` to load only needed groups (such as `issues`, `quality-gates`, `coverage`, `dependency-risks`, `vortex`, or `architecture`), enable `SONARQUBE_READ_ONLY=true` to disable write actions, and mount your repository at `/app/mcp-workspace` so analysis tools read files from disk rather than passing full source through agent prompts.

Install & configure

Requirements

  • Docker (or another OCI runtime such as Podman/nerdctl) for `sonarsource/sonarqube-mcp`, or Java 21+ for standalone JAR execution
  • SonarQube Cloud token (plus optional `SONARQUBE_ORG`) or SonarQube Server USER token + `SONARQUBE_URL`
  • SonarQube Server 2025.1+ or Community Build 25.1+ when connecting to self-hosted instances
Documented launch / install command
docker pull sonarsource/sonarqube-mcp

Use the interactive Configuration Generator at `mcp.sonarqube.com/config-generator.html` or run `sonarsource/sonarqube-mcp` over stdio via Docker. For Claude Code, run `claude mcp add sonarqube` with `SONARQUBE_TOKEN` and `SONARQUBE_ORG` or `SONARQUBE_URL`. Mount your workspace at `/app/mcp-workspace` to keep large file contents out of agent context.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": [
        "run",
        "--init",
        "--pull=always",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_ORG",
        "sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<YOUR_TOKEN>",
        "SONARQUBE_ORG": "<YOUR_ORG>"
      }
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": [
        "run",
        "--init",
        "--pull=always",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_ORG",
        "sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<YOUR_TOKEN>",
        "SONARQUBE_ORG": "<YOUR_ORG>"
      }
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "sonarqube": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--init",
        "--pull=always",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_ORG",
        "sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<YOUR_TOKEN>",
        "SONARQUBE_ORG": "<YOUR_ORG>"
      }
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": [
        "run",
        "--init",
        "--pull=always",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_ORG",
        "sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<YOUR_TOKEN>",
        "SONARQUBE_ORG": "<YOUR_ORG>"
      }
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "sonarqube": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--init",
        "--pull=always",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_ORG",
        "sonarsource/sonarqube-mcp"
      ],
      "env": {
        "SONARQUBE_TOKEN": "<YOUR_TOKEN>",
        "SONARQUBE_ORG": "<YOUR_ORG>"
      }
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
analyze_code_snippetRuns SonarQube static analysis across supported languages on a full file via workspace path or raw content, with optional snippet filtering.
analyze_file_listInvokes a connected SonarQube for IDE instance to inspect a list of absolute workspace file paths.
toggle_automatic_analysisTurns SonarQube for IDE automatic file analysis on or off inside the active workspace.
run_advanced_code_analysisExecutes entitled Vortex analysis on a mounted project file within `/app/mcp-workspace`.
search_files_by_coverageLists project files ordered from lowest to highest test coverage, filterable by branch, pull request, and `maxCoverage`.
search_by_signature_patternsFinds classes, methods, or interfaces whose declaration signatures match include/exclude regex patterns.
search_by_body_patternsSearches implementation bodies with regex and glob filters to locate concrete API usage across the codebase.
get_upstream_call_flowTraces upstream callers of a function by fully qualified name to evaluate signature-change impact.
get_downstream_call_flowTraces downstream callees invoked by a target function to follow execution paths.
get_source_codeRetrieves full signature and implementation source for a code element by fully qualified name.
get_type_hierarchyReturns the inheritance tree for a class, interface, enum, record, exception, or struct.
get_referencesFetches direct inbound and outbound code references for a class or module.
get_current_architectureInspects the hierarchical dependency graph filtered by path prefix, depth, and ecosystem.
get_intended_architectureReads user-defined architectural boundary constraints specifying permitted module dependencies.
get_guidelinesRetrieves coding guidelines derived from project issues, catalog categories, or both.
check_dependencyAudits a third-party package URL (`purl`) for security vulnerabilities, supply-chain malware, and license compliance.
start_agentic_readiness_assessmentInitiates an asynchronous SonarQube Cloud agentic readiness assessment for a project branch.
get_agentic_readiness_assessmentPolls an assessment ID to retrieve pillar-level readiness levels, evidence, and recommendations.
architecture_getReads current dependencies, intended architecture models, directives, or findings when the `architecture` toolset is enabled.
architecture_setReplaces intended architecture models or creates, updates, and deletes project directives with dry-run preview.

Use cases

  • Diagnose red pull-request quality gates and resolve critical bugs, vulnerabilities, or code smells directly inside Claude Code or Cursor.
  • Rank under-tested source files with `search_files_by_coverage` so coding agents write targeted unit tests where coverage lags.
  • Audit third-party packages via `check_dependency` (`purl`) before adding new libraries in enterprise repositories.
  • Deploy a shared TLS-secured Streamable HTTP MCP gateway (`SONARQUBE_TRANSPORT=https`) with per-request `SONARQUBE_READ_ONLY` and `SONARQUBE_TOOLSETS` narrowing.

Strengths

  • Official SonarSource server supporting both SonarQube Cloud (EU/US) and SonarQube Server 2025.1+ / Community Build 25.1+.
  • Fine-grained `SONARQUBE_TOOLSETS` and `SONARQUBE_READ_ONLY` controls reduce schema token overhead and lock down writes.
  • Enterprise networking readiness including custom CA certificates, mutual TLS keystores, HTTP/SOCKS5 proxies, and `/health` + `/info` endpoints.
  • Workspace volume mount (`/app/mcp-workspace`) and SonarQube for IDE port bridging (`SONARQUBE_IDE_PORT`) keep large source files out of LLM prompts.

Limitations

  • Self-hosted instances require SonarQube Server 2025.1+ or Community Build 25.1+ and strictly require USER tokens (project/global tokens fail).
  • Licensed under the SONAR Source-Available License v1.0 (SSAL) rather than an OSI open-source license, and sends anonymous telemetry unless `TELEMETRY_DISABLED=true` is set.
  • Advanced toolsets such as Vortex (`vortex`), Agentic Readiness, and Architecture require specific Cloud/Server editions or organization entitlements.

sonarqube-mcp-server setup notes

  • Check SONARQUBE_ORG, SONARQUBE_TOKEN in the sonarqube-mcp-server configuration if startup or authentication fails.
  • sonarqube-mcp-server's example uses stdio, while its catalog transports are stdio / streamable-http; use the example's connection type.
  • sonarqube-mcp-server has no recorded license; confirm reuse terms in its repository.

Frequently asked questions

Run the official Docker image `sonarsource/sonarqube-mcp` over stdio using `claude mcp add sonarqube` (passing `SONARQUBE_TOKEN` plus `SONARQUBE_ORG` for Cloud or `SONARQUBE_URL` for Server), or install via the Cursor deeplink or raw JSON config. You can also generate a ready-made snippet for VS Code, Windsurf, Codex CLI, or Zed with SonarSource's Configuration Generator.

Related MCP servers