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

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

getHotspot getHotspot

Get one Security Hotspot. Returns review details, rule guidance, locations, flows, and changelog.

ParameterTypeDescription
hotspotKey *stringHotspot key

listHotspots listHotspots

List project Security Hotspots that need human review. Defaults to `TO_REVIEW`; supports path and ref filters. Returns rule/category, vulnerability probability, message, and file location. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`.

ParameterTypeDescription
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
componentPathPrefixstringSonar `componentPath` prefix relative to the project root; an exact file path is also allowed. Uses directory boundaries, so `src` does not match `srcExtra`. For Java/Kotlin packages use slashes. Sona…
limitintegerPage size; server default if omitted.
offsetintegerOffset; default 0.
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.
statusstring`TO_REVIEW` or `REVIEWED`; default `TO_REVIEW`

getIssue getIssue

Get one issue by key. Returns full issue details and changelog, including status and assignment history. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`.

ParameterTypeDescription
issueKey *stringIssue key
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main lookup, pass explicitly; use `listProjectBranches` to discover names.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.

getIssueSnippets getIssueSnippets

Get Sonar-analysed source snippets for all issue locations, including cross-file flows. Returns component path, language, code lines, and SCM metadata. Use when local source is unavailable or may differ from the analysed ref. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`.

ParameterTypeDescription
issueKey *stringIssue key
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main lookup, pass explicitly; use `listProjectBranches` to discover names.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.

getProjectIssuesBreakdown getProjectIssuesBreakdown

Count project issues by logical module and rule; intended for multi-module projects. A module is the first `componentPath` segment. Returns totals, module/rule facets, and per-module severity/type summaries. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`. If `branchAdvisory` is present, choose the branch matching the user's ref and retry explicitly.

ParameterTypeDescription
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
componentPathPrefixstringSame Sonar `componentPath` prefix semantics as `listIssues`; use `listComponents` instead of guessing.
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.
resolvedbooleanResolved filter; defaults to false only when statuses is also omitted.
rulesstringComma-separated rule keys, e.g. `java:S1234`.
severitiesstringComma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER.
statusesstringComma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. With no statuses/resolved, returns open issues.
typesstringComma-separated: CODE_SMELL,BUG,VULNERABILITY.

getProjectIssuesSummary getProjectIssuesSummary

Count project issues and group them by severity, type, status, rule, tag, and SCM author. Returns the total and facet counts; use before listing details. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`. If `branchAdvisory` is present, choose the branch matching the user's ref and retry explicitly.

ParameterTypeDescription
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
componentPathPrefixstringSame Sonar `componentPath` prefix semantics as `listIssues`; use `listComponents` instead of guessing.
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.
resolvedbooleanResolved filter; defaults to false only when statuses is also omitted.
rulesstringComma-separated rule keys, e.g. `java:S1234`.
severitiesstringComma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER.
statusesstringComma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. With no statuses/resolved, returns open issues.
typesstringComma-separated: CODE_SMELL,BUG,VULNERABILITY.

listIssues listIssues

List project issues with optional severity, type, status, rule, path, and ref filters. Returns rule, severity, type, status, message, file location/text range, and cross-file flows. Defaults to open issues. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`. If `branchAdvisory` is present, choose the branch matching the user's ref and retry explicitly.

ParameterTypeDescription
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
componentPathPrefixstringSonar `componentPath` prefix relative to the project root; an exact file path is also allowed. Uses directory boundaries, so `src` does not match `srcExtra`. For Java/Kotlin packages use slashes. Sona…
limitintegerPage size; server default if omitted.
offsetintegerOffset; default 0.
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.
resolvedbooleanResolved filter; defaults to false only when statuses is also omitted.
rulesstringComma-separated rule keys, e.g. `java:S1234`.
severitiesstringComma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER.
statusesstringComma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. With no statuses/resolved, returns open issues.
typesstringComma-separated: CODE_SMELL,BUG,VULNERABILITY.

getProject getProject

Get one project analysis. Returns project metadata, quality gate failures, and metrics for size, findings, coverage, duplication, and technical debt. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`.

ParameterTypeDescription
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.

listComponents listComponents

Browse or search a project's analysed component tree. Use returned `path` values as `componentPathPrefix`; Sonar paths may differ from repository paths. Returns component key, path, name, qualifier, and language. Use `qualifiers=DIR` to discover directories. Scope explicitly: omitting both `branch` and `pullRequest` uses the configured default (usually main). For non-main or PR work, pass the matching ref explicitly; discover it with `listProjectBranches` / `listProjectPullRequests`.

ParameterTypeDescription
branchstringBranch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`.
limitintegerPage size; server default if omitted.
offsetintegerOffset; default 0.
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.
pullRequeststringPR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`.
qualifiersstringComma-separated component types, e.g. `DIR,FIL`; use `DIR` for path discovery.
querystringComponent name/path substring

listProjectBranches listProjectBranches

List analysed project branches. Returns name, main/type flags, analysis date, quality gate, and issue counts; use the name as `branch` in other tools.

ParameterTypeDescription
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.

listProjectPullRequests listProjectPullRequests

List project PR analyses. Returns key, title, source/base branches, URL, analysis date, quality gate, and issue counts; use the key as `pullRequest` in other tools. Returns empty when DevOps integration is unavailable.

ParameterTypeDescription
projectKeystringProject key; omit only if the server has a default. Discover with `listProjects`.

listProjects listProjects

List projects, optionally filtered by name. Returns key, name, and qualifier; use the key as `projectKey` in other tools.

ParameterTypeDescription
limitintegerPage size; server default if omitted.
offsetintegerOffset; default 0.
querystringProject name substring

getRule getRule

Get a Sonar rule. Returns title, severity, type, language, tags, and structured explanation and fix sections.

ParameterTypeDescription
ruleKey *stringRule key, e.g. `java:S1234`