SonarQube REST API MCP
Supports connecting to SonarCloud as a SonarQube-compatible instance, allowing access to SonarCloud projects, quality gates, measures, issues, hotspots, and analysis activity via its REST API.
Connects directly to a SonarQube server's REST API, providing tools to inspect projects, branches, quality gates and their status, measures and measure history, issues and issue details, security hotspots, project analysis activity, background compute-engine tasks, and system status/authentication.
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 REST API MCPWhat's the quality gate status for my 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 REST API MCP for VS Code
Connect VS Code's Model Context Protocol (MCP) directly to SonarQube's REST API over standard input/output (stdio).
The extension includes a built-in, dependency-free Node.js MCP server that communicates directly with your SonarQube instance (e.g. https://sonarcloud.io or http://localhost:9000). It registers the server with VS Code via vscode.lm.registerMcpServerDefinitionProvider using McpStdioServerDefinition.
Features
Direct REST API Access: Connects directly to SonarQube REST APIs (
/api/projects,/api/measures,/api/issues,/api/qualitygates,/api/components).Zero External Dependencies: Uses native Node.js built-ins.
Optional Access Token: Works with public / anonymous SonarQube instances without a token, or with a personal access token for private projects.
Secure Credential Storage: When an access token is provided, it is stored encrypted in VS Code
SecretStorage, never in plaintext workspace files.Interactive Configuration: Built-in commands to configure, test connection, view status, and clear credentials.
Related MCP server: MCP Server for VS Code
Requirements
VS Code 1.102 or newer.
Node.js 20 or newer (used to execute the bundled stdio server).
A reachable SonarQube server URL (e.g.
https://sonarcloud.io,https://sonarqube.example.com, orhttp://localhost:9000).(Optional) A SonarQube user access token for private instances.
Install and use
From source
Clone this repository and open it in VS Code:
git clone https://github.com/darshan1005/sonarqube-mcp.git
cd sonarqube-mcpPress F5 to launch an Extension Development Host.
From a VSIX package
Build the package:
npm run packageThen in VS Code, open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P), select Extensions: Install from VSIX..., and choose the generated sonarqube-rest-api-mcp-0.1.1.vsix file.
Configure your connection
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
SonarQube MCP: ConfigureEnter:
SonarQube Server URL: The domain of your SonarQube server (e.g.
https://sonarcloud.io,https://sonarqube.example.com, orhttp://localhost:9000).SonarQube Access Token (Optional): Your personal access token from SonarQube (User > My Account > Security > Generate Tokens). Leave blank if your SonarQube server allows anonymous access.
Available Commands
SonarQube MCP: Configure — set or update SonarQube URL, optional access token, and optional default project key.
SonarQube MCP: Test Connection — tests connectivity against
/api/system/statusor verifies your token with/api/authentication/validate.SonarQube MCP: Show Status — view current configuration and authentication status.
SonarQube MCP: Clear Credentials — remove saved SonarQube URL, default project key, and stored access token.
Example mcp.json Configuration Template
If you prefer to configure your workspace manually using .vscode/mcp.json (or global mcp.json), you can run the bundled server directly via stdio:
{
"mcpServers": {
"sonarqube": {
"command": "node",
"args": [
// Path to server.js in the installed extension or repository
"path/to/server.js"
],
"env": {
// Your SonarQube server base URL (e.g., https://sonarcloud.io or http://localhost:9000)
"SONARQUBE_URL": "https://sonarqube.example.com",
// Personal access token (OPTIONAL - omit or leave blank for public instances)
"SONARQUBE_TOKEN": "YOUR_SONARQUBE_ACCESS_TOKEN",
// Default project key (OPTIONAL - used when no projectKey is specified in tool calls)
"SONARQUBE_PROJECT_KEY": "YOUR_DEFAULT_PROJECT_KEY"
}
}
}
}Recommended: Using the extension's SonarQube MCP: Configure command is preferred because VS Code manages the process automatically and saves your access token in encrypted SecretStorage instead of plain text in a workspace file.
Available MCP Tools
Once connected, your AI assistant in VS Code Agent mode can call:
list_branches: List branches of a project with their quality gate status.get_quality_gate_status: Get quality gate status and conditions for a project or branch.list_projects: Search or list SonarQube projects visible to the authenticated user.list_quality_gates: List quality gates and condition definitions.get_measures: Fetch 30+ preconfigured metrics and measures (coverage, bugs, vulnerabilities, code smells, technical debt, ratings) for a project/branch.search_issues: Search code issues by component, branch, severity, type, status, assignee, tag, language, or date.search_hotspots: Search security hotspots for a project or branch with review status.get_measures_history: Get historical project measures for trend analysis.get_issue: Get full details for specific issues, including rule and location information.get_hotspot: Get full details for a security hotspot, including rule recommendations.get_project_activity: View project analysis history and scanner event timelines.list_background_tasks: Check project compute engine (CE) analysis task status.get_system_status: Check SonarQube server health and validate authentication.
Development and checks
Run tests:
npm testRun syntax checks:
npm run checkPackage extension:
npm run packageRepository
https://github.com/darshan1005/sonarqube-mcpLicense
MIT. See LICENSE.
This server cannot be deployed
Related MCP Connectors
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
AI-powered intelligence for your development workflow via Indicate.
Direct access to Cypress tests results and accessibility reports in your AI workflow.
Plan Salesforce deploys, open pull requests and trigger pipelines from your AI client.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceServer for SonarQube Give AI assistants direct access to your code quality, security & analysis data3MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to interact with VS Code for language intelligence, debugging, and code execution.17MIT
- AlicenseAqualityBmaintenanceEnables interaction with SonarCloud projects, issues, quality gates, and security hotspots through natural language.1530 PyPIMIT
- AlicenseAqualityDmaintenanceEnables Cursor AI to query SonarQube for pull request metrics, issues, file issues, and duplication reports directly, without manual data export.442 npmMIT