Sonar MCP Server
v0.1.0Read-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.
| Parameter | Type | Description |
|---|---|---|
hotspotKey * | string | Hotspot 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`.
| Parameter | Type | Description |
|---|---|---|
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`. |
componentPathPrefix | string | Sonar `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… |
limit | integer | Page size; server default if omitted. |
offset | integer | Offset; default 0. |
projectKey | string | Project key; omit only if the server has a default. Discover with `listProjects`. |
pullRequest | string | PR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`. |
status | string | `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`.
| Parameter | Type | Description |
|---|---|---|
issueKey * | string | Issue key |
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main lookup, pass explicitly; use `listProjectBranches` to discover names. |
pullRequest | string | PR 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`.
| Parameter | Type | Description |
|---|---|---|
issueKey * | string | Issue key |
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main lookup, pass explicitly; use `listProjectBranches` to discover names. |
pullRequest | string | PR 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.
| Parameter | Type | Description |
|---|---|---|
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`. |
componentPathPrefix | string | Same Sonar `componentPath` prefix semantics as `listIssues`; use `listComponents` instead of guessing. |
projectKey | string | Project key; omit only if the server has a default. Discover with `listProjects`. |
pullRequest | string | PR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`. |
resolved | boolean | Resolved filter; defaults to false only when statuses is also omitted. |
rules | string | Comma-separated rule keys, e.g. `java:S1234`. |
severities | string | Comma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER. |
statuses | string | Comma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. With no statuses/resolved, returns open issues. |
types | string | Comma-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.
| Parameter | Type | Description |
|---|---|---|
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`. |
componentPathPrefix | string | Same Sonar `componentPath` prefix semantics as `listIssues`; use `listComponents` instead of guessing. |
projectKey | string | Project key; omit only if the server has a default. Discover with `listProjects`. |
pullRequest | string | PR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`. |
resolved | boolean | Resolved filter; defaults to false only when statuses is also omitted. |
rules | string | Comma-separated rule keys, e.g. `java:S1234`. |
severities | string | Comma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER. |
statuses | string | Comma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. With no statuses/resolved, returns open issues. |
types | string | Comma-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.
| Parameter | Type | Description |
|---|---|---|
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`. |
componentPathPrefix | string | Sonar `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… |
limit | integer | Page size; server default if omitted. |
offset | integer | Offset; default 0. |
projectKey | string | Project key; omit only if the server has a default. Discover with `listProjects`. |
pullRequest | string | PR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`. |
resolved | boolean | Resolved filter; defaults to false only when statuses is also omitted. |
rules | string | Comma-separated rule keys, e.g. `java:S1234`. |
severities | string | Comma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER. |
statuses | string | Comma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. With no statuses/resolved, returns open issues. |
types | string | Comma-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`.
| Parameter | Type | Description |
|---|---|---|
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`. |
projectKey | string | Project key; omit only if the server has a default. Discover with `listProjects`. |
pullRequest | string | PR 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`.
| Parameter | Type | Description |
|---|---|---|
branch | string | Branch name; mutually exclusive with `pullRequest`. Omission uses the configured default (usually main). For non-main work, pass explicitly; use `listProjectBranches`. |
limit | integer | Page size; server default if omitted. |
offset | integer | Offset; default 0. |
projectKey | string | Project key; omit only if the server has a default. Discover with `listProjects`. |
pullRequest | string | PR key; mutually exclusive with `branch`; no default. For PR work, pass explicitly; use `listProjectPullRequests`. |
qualifiers | string | Comma-separated component types, e.g. `DIR,FIL`; use `DIR` for path discovery. |
query | string | Component 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.
| Parameter | Type | Description |
|---|---|---|
projectKey | string | Project 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.
| Parameter | Type | Description |
|---|---|---|
projectKey | string | Project 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.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Page size; server default if omitted. |
offset | integer | Offset; default 0. |
query | string | Project name substring |
getRule getRule
Get a Sonar rule. Returns title, severity, type, language, tags, and structured explanation and fix sections.
| Parameter | Type | Description |
|---|---|---|
ruleKey * | string | Rule key, e.g. `java:S1234` |