Sonar MCP Server

v0.1.0
io.github.igorolv/sonar-mcp-server Checked 3 days ago Published 2 months ago

Read-only SonarQube Community Build access for AI agents: issues, hotspots, rules, code snippets

Values you need

VariableWhat it is
SONAR_URLrequired Base URL of the SonarQube instance, e.g. https://sonar.example.com
SONAR_TOKENrequired secret SonarQube user token (My Account -> Security -> Generate Tokens)
SONAR_DEFAULT_PROJECT_KEYoptional 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.0
Add 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

  1. Ask the user for: SONAR_URL, SONAR_TOKEN. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. 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).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: getHotspot, listHotspots, getIssue, getIssueSnippets, getProjectIssuesBreakdown, getProjectIssuesSummary, listIssues, getProject, ….
  5. If it fails, check that the required runtime is installed (Docker) and that the values above are set.

Machine-readable: install.md · manifest.json