Self-hosted service
SonarSource/sonarqube-mcp-server avatar
SonarSource/sonarqube-mcp-server

SonarQube MCP Server: wiring SonarQube code quality into AI agents

Official SonarQube MCP Server for code quality and security in AI agents

654 stars101 forksJavaNOASSERTION

At a glance

What is it?
SonarSource's official MCP server lets Claude Code, Cursor, Codex CLI and other agents query SonarQube Server or Cloud, and it ships as a container image instead of a local JVM build. The trade-off is that nearly everything runs through Docker.
Who is it for?
Adopt it if your team already runs SonarQube Server or Cloud and you want agents to pull issue and quality data without leaving the chat. Skip it if you have no SonarQube instance, or if your agent host cannot run an OCI-compatible container runtime.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Java, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The gap SonarQube MCP Server fills for coding agents

An agent editing code has no idea what your quality gate says. It can read files and run tests, but the findings that SonarQube already computed for the project sit behind a web UI and a REST API that the agent will not call on its own. SonarQube MCP Server is SonarSource's answer to that: a Model Context Protocol server that exposes SonarQube Server or SonarQube Cloud to the agent, and, per the README, also supports analyzing a code snippet directly inside the agent context. The intended audience is teams that already have a SonarQube instance and an MCP-capable client, not people looking for a standalone linter. The repository's topics make the scope explicit: agent, ai, code-quality, mcp, mcp-server, security, sonarqube, static-analysis.

One container, one token, and the agent does the rest

The architecture is deliberately thin. The server is a Java application distributed as a jar, and the published container image wraps that jar. The Dockerfile pulls sonarqube-mcp-server-${MCP_SERVER_VERSION}.jar from binaries.sonarsource.com, computes the JDK module set with jdeps, builds a trimmed runtime with jlink, and then layers on a second component: sonar-context-augmentation, downloaded for x64 or arm64 and kept in sync with a gradle.properties value. That second binary is what backs the snippet-analysis path mentioned in the README, which is why the image is not just a JVM plus a jar. Configuration flows through environment variables. SONARQUBE_TOKEN is required in every example; SONARQUBE_ORG is used for SonarQube Cloud, and SONARQUBE_URL is used for SonarQube Server or for SonarQube Cloud US at https://sonarqube.us. The MCP client launches the container, the container talks to your SonarQube instance, and results come back as tool output. Nothing is stored between runs: the examples all pass --rm.

Installing SonarQube MCP Server with Docker and Claude Code

The README points to an interactive configuration generator at mcp.sonarqube.com/config-generator.html, but the manual path is short enough to do by hand. The container image is sonarsource/sonarqube-mcp on Docker Hub. The README recommends --pull=always for automatic updates, or pinning a version tag such as sonarsource/sonarqube-mcp:1.19.0.2785 for reproducible deployments. For Claude Code, the documented command registers the server and passes the token through the environment rather than the argument list, which is the practice the README's security note asks for.

bash
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

After running it, the client should list a server named sonarqube. For SonarQube Cloud US, the README says to add --env SONARQUBE_URL=https://sonarqube.us to the same command; for SonarQube Server, swap SONARQUBE_ORG for SONARQUBE_URL and use your server address. Codex CLI users edit ~/.codex/config.toml instead, with the same arguments expressed as TOML:

toml
[mcp_servers.sonarqube]
command = "docker"
args = ["run", "--init", "--pull=always", "--rm", "-i", "-e", "SONARQUBE_TOKEN", "-e", "SONARQUBE_ORG", "sonarsource/sonarqube-mcp"]
env = { "SONARQUBE_TOKEN" = "<YOUR_USER_TOKEN>", "SONARQUBE_ORG" = "<YOUR_ORG>" }

Cursor has deeplink install buttons in the README for both Cloud and Server, and the same JSON shape works in Antigravity through its raw MCP config view. The README notes that the examples use docker but any OCI-compatible runtime works, so replacing docker with podman or nerdctl is expected to be fine.

Where the container-first design gets in the way

Every documented setup path assumes a container runtime on the machine running the agent. That is a real constraint, not a packaging preference. On a locked-down workstation where Docker is not installed or not permitted, the README's manual instructions do not give you a non-container route; it says to read below if you want to build it locally, but the cleaned README does not carry those build steps. The jar exists and the Dockerfile shows where it is fetched from, so a JVM-based deployment is clearly possible, yet it is not the documented path. There is also a version-skew hazard built into the recommended flags: --pull=always means your server can change under you between sessions, and the image bundles a sonar-context-augmentation binary whose version is pinned in the Dockerfile and tracked against gradle.properties. If you need reproducibility, pin the image tag and accept that you will miss fixes. Finally, the server is a bridge, not an analyzer of your repository in place. It reports what SonarQube already knows, plus whatever the snippet-analysis path handles in context. If nobody has scanned the project, the agent has little to query.

SonarQube MCP Server versus a plain linting MCP server

The obvious alternative is an MCP server that wraps a local linter or a generic static-analysis CLI. The difference is where the truth lives. A local linter runs against the working tree, sees uncommitted edits, and needs no account, no token and no server. SonarQube MCP Server runs against a SonarQube Server or Cloud instance, so its answers reflect the project's configured quality profile, the analysis history, and whatever the last scan produced. That matters when your gate is the thing blocking a merge: the agent can talk about the same findings your CI talks about. It matters much less for a solo developer on a project that has never been scanned, where a local linter is strictly less setup. The two are not mutually exclusive, and the README does not position this server as a replacement for local analysis tools.

Licence, release cadence and what upgrades cost

The repository's licence is recorded as NOASSERTION, which means the machine-readable metadata does not resolve to a standard SPDX identifier. The repository does carry a LICENSE file and a HEADER file, so the terms are stated somewhere in the tree, but you should read that file yourself rather than trusting a badge. This is not legal advice, and the practical question for most teams is simply whether the licence covers your deployment model. On cadence, releases are frequent: 1.26.0.4269 on 2026-08-31, 1.25.0.3221 on 2026-08-18, and 1.24.0.3152 on 2026-08-04, roughly every two weeks, and the last push to master was on 2026-09-10. That pace is a cost. The README's own recommendation of --pull=always means upgrades happen silently, and the Dockerfile pins MCP_SERVER_VERSION and SONAR_CONTEXT_AUGMENTATION_VERSION as build arguments, so a self-built image needs both values bumped together to stay aligned with the published one.

Who should wire this into their agent, and who should wait

The fit is narrow but clear. You need an existing SonarQube Server or SonarQube Cloud organization, a user token, and an MCP client that can spawn a container: Claude Code, Codex CLI, Cursor, Antigravity, or Gemini CLI through the separate sonarqube-agent-plugins extension, which the README says has moved out of this repository. Teams that fit that profile get agent answers grounded in the same analysis their pipeline uses. Teams that do not fit should not force it. If you have no SonarQube instance, there is nothing for the server to query. If your environment forbids containers, the documented setup does not apply. And if your only goal is catching style issues in an editor, a local linter is cheaper in every dimension. Before rolling it out, confirm the token type the README asks for (a user token for SonarQube Server, a user token for Cloud as well), and decide between --pull=always and a pinned tag, because that single flag determines whether your agent's view of code quality can shift between two runs of the same prompt.

Editorial conclusion

Adopt it if your team already runs SonarQube Server or Cloud and you want agents to pull issue and quality data without leaving the chat. Skip it if you have no SonarQube instance, or if your agent host cannot run an OCI-compatible container runtime. Verify two things first: that your token is a user token with the right scope, and that your agent client actually loads the MCP server entry from its config file.

Frequently asked questions

How can I integrate Claude Code with the SonarQube MCP server?

The README gives a claude mcp add sonarqube command that passes SONARQUBE_TOKEN and SONARQUBE_ORG as environment variables and runs the sonarsource/sonarqube-mcp container. For SonarQube Server, replace SONARQUBE_ORG with SONARQUBE_URL; for SonarQube Cloud US, add SONARQUBE_URL set to https://sonarqube.us.

What is the SonarQube MCP server?

It is a Model Context Protocol server from SonarSource that connects an AI agent to SonarQube Server or SonarQube Cloud for code quality and security data. The README also states that it supports analyzing a code snippet directly within the agent context.

How do I install the SonarQube MCP server?

The README's fastest route is the configuration generator at mcp.sonarqube.com/config-generator.html, which produces a ready-to-use config for your agent client. Manually, you configure your client to launch the sonarsource/sonarqube-mcp container image with SONARQUBE_TOKEN and either SONARQUBE_ORG or SONARQUBE_URL in the environment.

Is the SonarQube MCP server free?

The repository's licence metadata is recorded as NOASSERTION, so the machine-readable field does not resolve to a standard identifier. A LICENSE file is present in the repository tree, and that file is the place to check the actual terms.

How do I use the SonarQube MCP server?

You point your MCP client at the sonarsource/sonarqube-mcp container and supply SONARQUBE_TOKEN plus SONARQUBE_ORG for Cloud or SONARQUBE_URL for Server. The agent then calls the server's tools to read code quality and security data, and the README notes it can also analyze a code snippet within the agent context.

Official sources

  1. Issues
  2. Project website
  3. README
  4. Releases
  5. SonarSource/sonarqube-mcp-server on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/sonarsource-sonarqube-mcp-server.svg)](https://hysenlabs.com/projects/sonarsource-sonarqube-mcp-server)