SonarQube MCP Server
Lets your AI agent check code quality and security with SonarQube Server or Cloud, including code snippets.
679 stars on GitHubby SonarSourceLicense NOASSERTIONUpdated 18 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add sonarqube -e SONARQUBE_TOKEN="<your value>" -- docker run -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_ORG -e SONARQUBE_URL docker.io/sonarsource/sonarqube-mcp
What to fill in
| Name | What it is | Required |
|---|---|---|
SONARQUBE_TOKEN | Your SonarQube USER token | Yes |
SONARQUBE_ORG | Your SonarQube Cloud organization key (if using SonarQube Cloud) | No |
SONARQUBE_URL | Your SonarQube Server URL (if using SonarQube Server) | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
What quality issues does Sonar report in my project?
Analyze this code snippet for security problems.
What it is
This is the official SonarSource server that connects AI assistants to SonarQube Server or SonarQube Cloud. The agent can use your project's quality and security analysis, and it can analyze code snippets directly in the conversation. It usually runs from a container image.
What it can do
- Connect to SonarQube Cloud with a token and organization
- Connect to SonarQube Server with a user token and URL
- Analyze code snippets inside the agent
- Use code quality and security results from SonarQube
When to use
- βΊWhen you want your agent to look at quality issues Sonar found in your project.
- βΊWhen you want a code snippet checked for security problems.
- βΊWhen you want fixes guided by your team's existing Sonar rules.
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
publish-findingsLets your agent import scanner results, including SonarQube issues, into a local workbench or Codex Security Cloud, once imports are enabled.agent-analyze-code-qualityHelps your agent review code for quality, finding code smells, technical debt and refactoring ideas without changing the files.requesting-code-reviewRuns checks on your code changes before you commit, including a security scan, quality checks and a separate reviewer.Frequently asked questions
Is it free and open source?
The readme does not state a license or price. You need a SonarQube Server or Cloud account.
Is it official?
Yes, it is made by SonarSource.
Does it work with SonarQube Cloud US?
Yes. Set SONARQUBE_URL to https://sonarqube.us.
Which clients are covered?
Antigravity, Claude Code, Codex CLI, Cursor, Gemini CLI, GitHub Copilot CLI and coding agent, Kiro and others.
How do I protect my token?
Use environment variables, do not hardcode it in commands, and never commit it to version control.
Is there a setup helper?
Yes, an online configuration generator at mcp.sonarqube.com/config-generator.html.
If it does not work
- βΊCheck that Docker (or Podman) is installed and running.
- βΊCheck that SONARQUBE_TOKEN is set, plus SONARQUBE_ORG for Cloud or SONARQUBE_URL for Server.
- βΊFor SonarQube Server, use a user token, not a project token.
5 new skills a week. 1 minute to read.