Sponsored by Deepsite.site

SonarQube

Created By
dhanush-dev019 months ago
The SonarQube MCP (Model Context Protocol) Server is a custom-built AI-powered backend designed to integrate with SonarQube and enable intelligent, context-aware interactions between static code analysis and modern AI agents like GitHub Copilot, VS Code Agents, or any LLM-powered tool.
Content

SonarQube MCP Server

This is a FastMCP server that provides a bridge to interact with SonarQube APIs. The server offers various tools to monitor and analyze code quality using SonarQube.

Features

1. Health Check

  • Endpoint: sonar_health_check
  • Checks the status of your SonarQube server
  • Returns the current health status and connection information

2. Token Validation

  • Endpoint: get_token_info
  • Validates the SonarQube authentication token
  • Returns authentication status and associated user information

3. Project Issues

  • Endpoint: get_project_issues
  • Fetches unresolved issues for a specific project
  • Returns detailed information about:
    • Bugs
    • Code smells
    • Vulnerabilities
    • Issue severity and status
    • File location and line numbers

4. Project Listing

  • Endpoint: list_projects
  • Lists all accessible SonarQube projects
  • Provides project keys, names, and visibility settings

5. Project Metrics

  • Endpoint: get_project_metrics
  • Retrieves key quality metrics for a project including:
    • Bug count
    • Vulnerability count
    • Code smell count
    • Code coverage
    • Duplicated lines density
    • Reliability rating
    • Security rating
    • Maintainability rating (SQALE)

Configuration

The server uses the following environment variables:

SONARQUBE_URL=http://localhost:9000  # Default SonarQube server URL
SONARQUBE_TOKEN=                     # Your SonarQube authentication token
PROJECT_KEY=default_project          # Default project key for operations

Requirements

Check the requirements.txt file for all dependencies. The main requirements include:

  • FastMCP
  • Requests

Usage

  1. Set up your environment variables
  2. Install the requirements
  3. Run the server using Python

The server will start and provide MCP-compliant endpoints for interacting with your SonarQube instance.

Docker Usage

Security Notice

For security reasons, sensitive environment variables like SONARQUBE_TOKEN and PROJECT_KEY should not be stored in the Dockerfile. Instead, they should be passed at runtime using environment variables or environment files.

💡 How to Integrate This Tool with VS Code and Make It Smarter

  • Open your VS Code Settings image

  • In the search bar, type mcp image

  • Click on “Edit in settings.json”

  • Under the mcp section, add the following configuration:

Adding it in MCP server config

      "sonarqubemcp": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "--init",
          "-e",
          "SONARQUBE_URL",
          "-e",
          "SONARQUBE_TOKEN",
          "-e",
          "PROJECT_KEY",
          "dhanushhypervisor/sonarqube_mcp_server"
        ],
        "env": {
          "SONARQUBE_URL": "<server_url>",
          "SONARQUBE_TOKEN" : "<server_token>",
          "PROJECT_KEY": "<project_name>",
        }
      }

Environment Variables

When running the container, configure these required environment variables:

  • SONARQUBE_URL: URL of your SonarQube server
  • SONARQUBE_TOKEN: Your SonarQube authentication token
  • PROJECT_KEY: The default project key to analyze

The server runs on Python 3.10 and uses the uv package manager for dependency management and execution.

Error Handling

The server includes comprehensive error handling for:

  • Connection issues
  • Authentication failures
  • Permission problems
  • Invalid project keys
  • General API errors

Each endpoint returns detailed error messages to help diagnose issues.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Amap Maps高德地图官方 MCP Server
WindsurfThe new purpose-built IDE to harness magic
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Serper MCP ServerA Serper MCP Server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Tavily Mcp
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor