Menu

AI

SonarQube MCP Server: Tools, Setup and Security

SonarQube's MCP server connects AI agents to SonarQube Cloud or Server for issues, quality gates, hotspots and code analysis. See toolsets and setup.

By: Irina ShvayaOctober 28, 2026

SonarQube MCP Server: Tools, Setup and Security

This profile is part of our MCP server directory, within The MCP Guide. Profiles are checked against each vendor's own documentation. Need a server built? See MCP development.

The SonarQube MCP Server lets an AI agent pull issues, quality gate status, security hotspots, coverage and metrics from SonarQube Cloud or SonarQube Server. It can also analyze code in the agent's context. SonarSource publishes it as a container image and source-available project.

Checked against: SonarQube MCP Server README on 28 October 2026. eSEOspace did not install or test this server.

Key Takeaways

  • The easiest local setup uses the Docker image sonarsource/sonarqube-mcp with a SonarQube token.
  • SONARQUBE_TOOLSETS limits which tool groups load, and SONARQUBE_READ_ONLY=true disables all write operations.
  • SonarQube Server needs version 2025.1 or later (or Community Build 25.1 or later), and a USER token.
  • Sonar also describes a hosted SonarQube Cloud MCP service that signs in with OAuth.
  • The project uses the SONAR Source-Available License (SSAL), not an open-source license.

At a glance

ItemDetail
PublisherSonarSource
Official?Yes
HostingBoth: local container or JAR, plus a hosted SonarQube Cloud service
Transportstdio (default) or Streamable HTTP/HTTPS
Sign-inSonarQube token; OAuth on the hosted Cloud service
Read or writeRead and write; read-only mode available
PriceNo separate MCP price listed
Source codeSonarSource/sonarqube-mcp-server (SSAL v1.0)
StatusNot stated

What it can do

By default, the server loads these toolsets: analysis, ide, issues, projects, quality-gates, rules, duplications, measures, security-hotspots, dependency-risks, coverage and cag. Others such as sources, languages, portfolios, system, webhooks and architecture are opt-in.

Tool names in the README include:

  • Issues: search_sonar_issues_in_projects, change_sonar_issue_status
  • Security hotspots: search_security_hotspots, show_security_hotspot, change_security_hotspot_status
  • Quality gates: get_project_quality_gate_status, list_quality_gates
  • Projects: search_my_sonarqube_projects, list_branches, list_pull_requests
  • Measures and coverage: get_component_measures, search_files_by_coverage, get_file_coverage_details
  • Analysis: analyze_file_list, run_advanced_code_analysis, and the deprecated analyze_code_snippet
  • Dependency risks: search_dependency_risks (needs SonarQube Advanced Security; Server 2025.4 Enterprise or higher)
  • System (Server only): get_system_health, get_system_logs, get_system_info

Some tools, including the "Vortex" context and analysis tools, need extra organization entitlements and run only in stdio mode.

How to connect it

Sonar offers a configuration generator that builds a client config for you. For Claude Code with SonarQube Cloud, the README gives:

claude mcp add sonarqube \
  --env SONARQUBE_TOKEN=$SONAR_TOKEN \
  --env SONARQUBE_ORG=$SONAR_ORG \
  -- docker run --init --pull=always -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_ORG sonarsource/sonarqube-mcp

For SonarQube Cloud US, add --env SONARQUBE_URL=https://sonarqube.us. For SonarQube Server, set SONARQUBE_URL to your server and use a USER token. Project tokens and global tokens will not work properly.

For team deployments, set SONARQUBE_TRANSPORT=http or https to serve Streamable HTTP at /mcp. Sonar recommends HTTPS for multi-user production deployments.

Security notes

  • Read-only mode. SONARQUBE_READ_ONLY=true disables write tools such as changing issue or hotspot status. Over HTTP, clients can tighten this per request but cannot lift a server-level restriction.
  • Fewer toolsets. Sonar notes that every enabled tool loads into the agent's context, so trimming toolsets cuts tokens and exposure.
  • Token hygiene. The README warns that your token "is a sensitive credential." Avoid putting it in command-line arguments that land in shell history, and never commit it.
  • OAuth scopes. On the hosted Cloud service, mcp:tools:read and mcp:tools:write scopes separately control read and write tools.
  • Open endpoints. In HTTP mode, /health and /info respond without authentication.

The MCP project's security best practices also cover risks such as token passthrough, confused deputy attacks and scope minimization.

Read excessive permissions and secrets and credential leakage, and see the MCP Security Center.

Alternatives

Next step

Turn on read-only mode first, so the agent can explain issues and quality gates without changing their status. Our guide on how to choose MCP servers covers what to check next, and the MCP server directory has more developer tools.

Frequently asked questions

Does the SonarQube MCP Server work with SonarQube Server?

Yes, with SonarQube Server 2025.1 or later, or Community Build 25.1 or later. The server checks the version at startup and exits if it is too old. You need a USER token.

Is the SonarQube MCP Server open source?

It is source-available under the SONAR Source-Available License v1.0. Sonar says using it as documented is a non-competitive purpose allowed under that license.

How do I stop the AI from changing issue status?

Set SONARQUBE_READ_ONLY=true. That disables all write operations, and it works together with SONARQUBE_TOOLSETS.

Is there a hosted version?

Sonar describes a hosted SonarQube Cloud MCP service that uses OAuth, so no OAuth server settings are needed in your client. Self-hosted SonarQube Server still uses tokens.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.