sonarqube
SonarQube MCP Server
claude mcp add --transport stdio sonarsource-sonarqube-mcp-server docker run --init --pull=always --rm -i -e SONARQUBE_TOKEN -e SONARQUBE_ORG -e SONARQUBE_URL mcp/sonarqube \ --env SONARQUBE_ORG="<YOUR_ORGANIZATION_KEY_OR_ID>" \ --env SONARQUBE_URL="<YOUR_SONARQUBE_SERVER_OR_US_URL>" \ --env SONARQUBE_TOKEN="<YOUR_SONARQUBE_TOKEN>"
How to use
This MCP server integrates SonarQube with MCP clients, enabling code quality and security analysis within the MCP workflow. The server runs a containerized instance of the SonarQube MCP server image (mcp/sonarqube) and exposes the standard MCP endpoints to receive and interact with model context data. You can connect to SonarQube Cloud or SonarQube Server by configuring tokens, organization keys, and the server URL as environment variables. The included tooling guidance shows how to provision the server via common command-line interfaces and CLIs, and how to adjust environment variables for your deployment scenario. Once running, use the MCP client to send code data or analysis requests and receive SonarQube results in your agent or pipeline context.
How to install
Prerequisites:
- Docker or any OCI-compatible container runtime
- Access to pull the mcp/sonarqube image from Docker Hub
- Tokens/credentials for SonarQube Cloud or SonarQube Server (SONARQUBE_TOKEN, SONARQUBE_ORG or SONARQUBE_URL depending on setup)
-
Install Docker (example on Linux):
- sudo apt-get update
- sudo apt-get install -y docker.io
- sudo systemctl enable --now docker
-
Pull and run the MCP SonarQube server (via MCP config):
- Ensure your mcp_config.json is prepared as shown in the mcp_config section.
- Start your MCP agent or orchestrator that reads the MCP configuration.
-
Configure environment variables:
- SONARQUBE_TOKEN: Your SonarQube token (Cloud or Server)
- SONARQUBE_ORG: Your SonarQube organization key (Cloud only)
- SONARQUBE_URL: Your SonarQube Server URL (Cloud or Server, as appropriate)
-
Verify startup:
- Check logs of the MCP runner for successful connection to SonarQube
- Validate that the MCP server is reachable at the expected endpoints
Additional notes
Tips and common considerations:
- Do not hardcode tokens in command history; prefer environment variables or secret management.
- If using SonarQube Cloud US, include SONARQUBE_URL with the value https://sonarqube.us and pass the URL via the -e flag as shown in the configuration examples.
- When using tokens and URLs in MCP configs, consider substituting values at runtime through your orchestration tool or secret manager.
- The Docker image mcp/sonarqube is designed to be run with minimal local dependencies; ensure your container runtime supports the required networking access to SonarQube endpoints.
- For CI/CD integrations, the MCP server can be wired into your pipeline to receive analysis data and return results back into your workflow.
Related MCP Servers
skillz
An MCP server for loading skills (shim for non-claude clients).
agentql
Model Context Protocol server that integrates AgentQL's data extraction capabilities.
api2mcp4j
This is a revolutionary AI MCP plugin with excellent pluggable and encapsulated features. With just a few lines of configuration, it can easily integrate into your Spring boot web program and give it MCP capabilities,inheriting the powerful engineering capabilities of the Spring series framework
mcp -js
MCP server that exposes YepCode processes as callable tools for AI platforms. Securely connect AI assistants to your YepCode workflows, APIs, and automations.
zerodha
Zerodha MCP Server & Client - AI Agent (w/Agno & w/Google ADK)
WigAI
Bitwig Controller Extension that provides an MCP Server for AI Agent control