Server facts
sonarqube-mcp-server
GitHub stars
696
Last commit
Nov 26, 2026
Runtime
java
License
—
Project
- Author
- SonarSource
- Category
- Developer Tools
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
docker pull sonarsource/sonarqube-mcpUse 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.
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.
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.
{
"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>"
}
}
}
}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.
{
"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>"
}
}
}
}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.
{
"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>"
}
}
}
}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.
{
"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>"
}
}
}
}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.
{
"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>"
}
}
}
}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.
| Tool | What it does |
|---|---|
| analyze_code_snippet | Runs SonarQube static analysis across supported languages on a full file via workspace path or raw content, with optional snippet filtering. |
| analyze_file_list | Invokes a connected SonarQube for IDE instance to inspect a list of absolute workspace file paths. |
| toggle_automatic_analysis | Turns SonarQube for IDE automatic file analysis on or off inside the active workspace. |
| run_advanced_code_analysis | Executes entitled Vortex analysis on a mounted project file within `/app/mcp-workspace`. |
| search_files_by_coverage | Lists project files ordered from lowest to highest test coverage, filterable by branch, pull request, and `maxCoverage`. |
| search_by_signature_patterns | Finds classes, methods, or interfaces whose declaration signatures match include/exclude regex patterns. |
| search_by_body_patterns | Searches implementation bodies with regex and glob filters to locate concrete API usage across the codebase. |
| get_upstream_call_flow | Traces upstream callers of a function by fully qualified name to evaluate signature-change impact. |
| get_downstream_call_flow | Traces downstream callees invoked by a target function to follow execution paths. |
| get_source_code | Retrieves full signature and implementation source for a code element by fully qualified name. |
| get_type_hierarchy | Returns the inheritance tree for a class, interface, enum, record, exception, or struct. |
| get_references | Fetches direct inbound and outbound code references for a class or module. |
| get_current_architecture | Inspects the hierarchical dependency graph filtered by path prefix, depth, and ecosystem. |
| get_intended_architecture | Reads user-defined architectural boundary constraints specifying permitted module dependencies. |
| get_guidelines | Retrieves coding guidelines derived from project issues, catalog categories, or both. |
| check_dependency | Audits a third-party package URL (`purl`) for security vulnerabilities, supply-chain malware, and license compliance. |
| start_agentic_readiness_assessment | Initiates an asynchronous SonarQube Cloud agentic readiness assessment for a project branch. |
| get_agentic_readiness_assessment | Polls an assessment ID to retrieve pillar-level readiness levels, evidence, and recommendations. |
| architecture_get | Reads current dependencies, intended architecture models, directives, or findings when the `architecture` toolset is enabled. |
| architecture_set | Replaces 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.