SonarQube MCP Server
Provides read-only access to SonarQube projects, metrics, and rules, allowing users to search for issues, retrieve quality dashboards, and access detailed information about code bugs, vulnerabilities, and security hotspots.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SonarQube MCP Server list all critical bugs and vulnerabilities in the 'web-app' project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SonarQube MCP Server
A read-only Model Context Protocol (MCP) server that gives AI assistants structured access to SonarQube — issues, metrics, rules, and projects.
Features
6 read-only tools covering the full SonarQube quality workflow
Safe by design — no mutations, every tool returns a consistent
{"ok": ...}envelopeInput validation before any API call (severities, types, statuses)
Structured errors with machine-readable
error_codefieldsWorks with SonarQube Community, Developer, and Enterprise editions
Related MCP server: sonarqube-api-mcp
Requirements
Python 3.10+
A running SonarQube instance
A SonarQube user token (
squ_...)
Installation
pip install sonarqube-mcp-serverOr install from source:
git clone <repo>
cd sonarqube-mcp
pip install -e .Quick Start
SONARQUBE_URL=http://localhost:9000 \
SONARQUBE_TOKEN=squ_xxxxxxxxxxxx \
sonarqube-mcp-serverOr with python -m:
python -m sonarqube_mcpConfiguration
Environment Variables
Variable | Required | Default | Description |
| No |
| Base URL of your SonarQube instance |
| Yes | — | User token for authentication |
| No |
| HTTP request timeout in seconds |
Copy .env.example to .env and fill in your values:
cp .env.example .envGenerating a Token
In SonarQube: My Account → Security → Generate Tokens. A user token (squ_...) with Browse permission on the target projects is sufficient for all read-only operations.
MCP Client Integration
Claude Code
Add to your Claude Code MCP settings (~/.claude/claude_code_config.json):
{
"mcpServers": {
"sonarqube": {
"command": "sonarqube-mcp-server",
"env": {
"SONARQUBE_URL": "http://localhost:9000",
"SONARQUBE_TOKEN": "squ_xxxxxxxxxxxx"
}
}
}
}Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"sonarqube": {
"command": "sonarqube-mcp-server",
"env": {
"SONARQUBE_URL": "http://localhost:9000",
"SONARQUBE_TOKEN": "squ_xxxxxxxxxxxx"
}
}
}
}Tools
All tools are read-only (readOnlyHint: true, destructiveHint: false).
check_status
Verify connectivity and retrieve server version.
{}Response:
{
"ok": true,
"server_url": "http://localhost:9000",
"status": "UP",
"version": "10.4.1"
}list_projects
List or search SonarQube projects with pagination.
Parameter | Type | Default | Description |
|
| — | Filter by project name or key |
|
|
| Page number (1-indexed) |
|
|
| Results per page (1–500) |
Response:
{
"ok": true,
"total": 42,
"page": 1,
"page_size": 20,
"projects": [
{"key": "my-app", "name": "My Application", "qualifier": "TRK"}
]
}search_issues
Search issues across all projects or scoped to one project, with rich filtering.
Parameter | Type | Default | Description |
|
| — | Scope to a specific project |
|
| — | CSV: |
|
| — | CSV: |
|
| — | CSV: |
|
| — | CSV of tag names |
|
| — |
|
|
|
| Page number |
|
|
| Results per page (1–500) |
Example — find all open blockers in a project:
{
"project_key": "my-app",
"severities": "BLOCKER,CRITICAL",
"statuses": "OPEN"
}get_issue
Get full detail for a single issue by key, including text range, effort, assignee, comments, and data-flow information.
Parameter | Type | Description |
|
| Issue key (e.g. |
get_project_metrics
Retrieve the quality dashboard for a project. Returns a standard set of metrics by default, or a custom selection.
Parameter | Type | Default | Description |
|
| — | Required. Project key |
|
| See below | CSV of metric keys |
Default metrics: bugs, vulnerabilities, code_smells, security_hotspots, coverage, duplicated_lines_density, ncloc, sqale_index, reliability_rating, security_rating, sqale_rating, alert_status, quality_gate_details
Response:
{
"ok": true,
"project_key": "my-app",
"project_name": "My Application",
"metrics": {
"bugs": "3",
"coverage": "78.4",
"alert_status": "OK"
}
}get_rule
Retrieve the description and metadata for a SonarQube rule.
Parameter | Type | Description |
|
| Rule key (e.g. |
Error Handling
All tools return a consistent envelope. On failure:
{
"ok": false,
"error_code": "auth_error",
"message": "Authentication failed. Check SONARQUBE_TOKEN.",
"details": {}
}
| Cause |
| Invalid or missing token (HTTP 401) |
| Token lacks permissions (HTTP 403) |
| Project, issue, or rule does not exist (HTTP 404) |
| Cannot reach the SonarQube instance |
| Request exceeded |
| Bad parameter value (e.g. unknown severity) |
| Other non-2xx SonarQube response |
| Unexpected server-side error |
Development
Setup
pip install -e ".[dev]"Running Tests
pytestProject Layout
src/sonarqube_mcp/
├── server.py # FastMCP server, tool definitions, main()
├── sonarqube_client.py # httpx.Client wrapper for SonarQube REST API
├── settings.py # Frozen dataclass + env var loading
├── errors.py # SonarQubeError + error_response()
├── __main__.py # python -m sonarqube_mcp entrypoint
└── __init__.py
tests/
├── conftest.py
├── test_server.py
├── test_client.py
├── test_settings.py
└── test_errors.pyArchitecture Notes
create_server()is a factory that capturessettingsandclientin closure scope — makes unit testing straightforward by injecting a pre-builtSonarQubeSettings.@_safe_toolwraps every tool so it never raises — exceptions are caught and returned as structured error envelopes._clamp()keepspage_sizewithin SonarQube's supported API limits (1–500).Settings use a
frozen=Truedataclass — immutable after load, safe to share across tool closures.
License
MIT
Available Tools
6 toolscheck_statusARead-onlyIdempotent
Verify SonarQube connectivity and return server version/status.
Inputs: no named parameters. Returns: object
get_issueBRead-onlyIdempotent
Get detailed information for a single SonarQube issue by key.
Args: issue_key: The issue key (e.g., AXy1k...).
Inputs: issue_key (required). Returns: object
get_project_metricsBRead-onlyIdempotent
Get quality metrics for a SonarQube project.
Args: project_key: The project key. metric_keys: Comma-separated metric keys. Defaults to a standard quality dashboard set (bugs, coverage, smells, ratings, etc.).
Inputs: project_key (required), metric_keys. Returns: object
get_ruleBRead-onlyIdempotent
Get the description and metadata for a SonarQube rule.
Args: rule_key: Rule key (e.g., python:S1192, java:S106).
Inputs: rule_key (required). Returns: object
list_projectsARead-onlyIdempotent
List or search SonarQube projects with pagination.
Args: query: Optional search string to filter project names/keys. page: Page number (1-indexed). page_size: Results per page (1–500).
Inputs: query, page, page_size. Returns: object
search_issuesARead-onlyIdempotent
Search SonarQube issues with filters.
Args: project_key: Project key to scope issues. severities: Comma-separated: INFO,MINOR,MAJOR,CRITICAL,BLOCKER. types: Comma-separated: CODE_SMELL,BUG,VULNERABILITY,SECURITY_HOTSPOT. statuses: Comma-separated: OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED. tags: Comma-separated tag names. assigned: Filter by assignment (true=assigned, false=unassigned). page: Page number (1-indexed). page_size: Results per page (1–500).
Inputs: project_key, severities, types, statuses, +4 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: connectivity check, single issue retrieval, project metrics, rule details, project listing, and issue searching. The descriptions specify different resources (server, issue, project, rule) and actions (check, get, list, search), making misselection unlikely.
All tools follow a consistent verb_noun pattern (e.g., check_status, get_issue, list_projects, search_issues). The verbs are appropriate and predictable, with no deviations in style or convention across the set.
Six tools is well-scoped for a SonarQube server, covering core functionalities like status verification, issue and project management, metrics, and rule lookup. Each tool earns its place without feeling excessive or insufficient for the domain.
The toolset provides strong coverage for querying and monitoring in SonarQube, including status, projects, issues, metrics, and rules. A minor gap exists in write operations (e.g., creating or resolving issues), but agents can still perform most read-oriented tasks effectively.
Related MCP Connectors
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server for SonarQube that enables LLM agents to discover projects, analyze code quality metrics, check Quality Gate status, search issues with filters, and rank projects by worst-performing metrics. It provides read-only, safe access to SonarQube instances with structured outputs and error handling.51MIT
- AlicenseBqualityDmaintenanceRead-only MCP server that exposes SonarQube Web API tools for issue retrieval, quality gate status, and source context, enabling coding agents to fix code issues.8166 npm1MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that provides AI assistants with access to SonarQube code quality, security, and project analytics data.768 npmMIT
- FlicenseNot gradedqualityCmaintenanceMCP server that exposes SonarQube data as AI agent tools, enabling project discovery, quality gates, measures, issues, hotspots, rule explanations, source code, and raw API access.4-