Sonar MCP Server
v0.1.0Read-only SonarQube Community Build access for AI agents: issues, hotspots, rules, code snippets
Values you need
| Variable | What it is | |
|---|---|---|
SONAR_URL | required | Base URL of the SonarQube instance, e.g. https://sonar.example.com |
SONAR_TOKEN | required secret | SonarQube user token (My Account -> Security -> Generate Tokens) |
SONAR_DEFAULT_PROJECT_KEY | optional | Project key used when a tool call does not name one |
Docker discovery passed
Requires Docker
Run in a terminal
claude mcp add sonar-mcp-server -e 'SONAR_TOKEN=<SONAR_TOKEN>' -e 'SONAR_URL=<SONAR_URL>' -- docker run -i --rm -e SONAR_TOKEN -e SONAR_URL ghcr.io/igorolv/sonar-mcp-server:0.1.0Add to
claude_desktop_config.json{
"mcpServers": {
"sonar-mcp-server": {
"args": [
"run",
"-i",
"--rm",
"-e",
"SONAR_TOKEN",
"-e",
"SONAR_URL",
"ghcr.io/igorolv/sonar-mcp-server:0.1.0"
],
"command": "docker",
"env": {
"SONAR_TOKEN": "<SONAR_TOKEN>",
"SONAR_URL": "<SONAR_URL>"
}
}
}
}Add to
~/.cursor/mcp.json{
"mcpServers": {
"sonar-mcp-server": {
"args": [
"run",
"-i",
"--rm",
"-e",
"SONAR_TOKEN",
"-e",
"SONAR_URL",
"ghcr.io/igorolv/sonar-mcp-server:0.1.0"
],
"command": "docker",
"env": {
"SONAR_TOKEN": "<SONAR_TOKEN>",
"SONAR_URL": "<SONAR_URL>"
}
}
}
}Add to
.vscode/mcp.json{
"inputs": [
{
"description": "SONAR_TOKEN",
"id": "sonar-token",
"password": true,
"type": "promptString"
},
{
"description": "SONAR_URL",
"id": "sonar-url",
"password": true,
"type": "promptString"
}
],
"servers": {
"sonar-mcp-server": {
"args": [
"run",
"-i",
"--rm",
"-e",
"SONAR_TOKEN",
"-e",
"SONAR_URL",
"ghcr.io/igorolv/sonar-mcp-server:0.1.0"
],
"command": "docker",
"env": {
"SONAR_TOKEN": "${input:sonar-token}",
"SONAR_URL": "${input:sonar-url}"
},
"type": "stdio"
}
}
}Add to
~/.codex/config.toml[mcp_servers.sonar-mcp-server]
command = "docker"
args = ["run", "-i", "--rm", "-e", "SONAR_TOKEN", "-e", "SONAR_URL", "ghcr.io/igorolv/sonar-mcp-server:0.1.0"]
env = { "SONAR_TOKEN" = "<SONAR_TOKEN>", "SONAR_URL" = "<SONAR_URL>" }For AI agents
- Ask the user for: SONAR_URL, SONAR_TOKEN. Never invent or guess these values; secrets go into the client config, not into chat logs.
- Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
- Restart or reload the client so it starts the server.
- Verify: the server should expose these tools: getHotspot, listHotspots, getIssue, getIssueSnippets, getProjectIssuesBreakdown, getProjectIssuesSummary, listIssues, getProject, ….
- If it fails, check that the required runtime is installed (Docker) and that the values above are set.
Machine-readable: install.md · manifest.json