Cover image
Try Now
2025-04-04

Model Context Protocol (MCP) server for SonarQube

3 years

Works with Finder

3

Github Watches

2

Github Forks

19

Github Stars

SonarQube MCP Server

CI Quality Gate Status Bugs Code Smells Coverage Duplicated Lines (%) npm version npm downloads License

A Model Context Protocol (MCP) server that integrates with SonarQube to provide AI assistants with access to code quality metrics, issues, and analysis results.

Overview

The SonarQube MCP Server enables AI assistants to interact with SonarQube's code quality analysis capabilities through the Model Context Protocol. This integration allows AI assistants to:

  • Retrieve code metrics and analysis results
  • Access and filter issues
  • Check quality status
  • Analyze project quality over time

Features

  • List all SonarQube projects with pagination support
  • Get detailed issue information from SonarQube projects with extensive filtering options
  • Support for both SonarQube and SonarCloud
  • Comprehensive parameter validation using Zod schemas
  • Full TypeScript support

Usage with Claude Desktop

  1. Edit claude_desktop_config.json:

    • Open Claude Desktop
    • Go to Settings -> Developer -> Edit Config
    • Add the one of the configurations below to the mcpServers section
  2. Restart Claude Desktop to apply the changes

Docker

{
  "mcpServers": {
    "sonarqube": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SONARQUBE_URL",
        "-e",
        "SONARQUBE_TOKEN",
        "-e",
        "SONARQUBE_ORGANIZATION",
        "sapientpants/sonarqube-mcp-server"
      ],
      "env": {
        "SONARQUBE_URL": "https://sonarqube.example.com",
        "SONARQUBE_TOKEN": "your-sonarqube-token",
        "SONARQUBE_ORGANIZATION": "your-organization-key (optional)"
      }
    }
  }
}

NPX

{
  "mcpServers": {
    "sonarqube": {
      "command": "npx",
      "args": [
        "-y",
        "sonarqube-mcp-server@1.0.0"
      ],
      "env": {
        "SONARQUBE_URL": "https://sonarqube.example.com",
        "SONARQUBE_TOKEN": "your-sonarqube-token",
        "SONARQUBE_ORGANIZATION": "your-organization-key (optional)"
      }
    }
  }
}

Available Tools

The SonarQube MCP Server provides the following tools:

SonarQube Tools

  1. projects: List all SonarQube projects

    • Parameters:
      • organization (optional) - Organization key for SonarQube Cloud
      • page (optional) - Page number for results pagination
      • page_size (optional) - Number of items per page
  2. issues: Get issues from a SonarQube project

    • Parameters:
      • project_key (required) - The unique identifier for the SonarQube project
      • severity (optional) - Filter issues by severity (INFO, MINOR, MAJOR, CRITICAL, BLOCKER)
      • organization (optional) - Organization key for SonarQube Cloud
      • page (optional) - Page number for results pagination
      • page_size (optional) - Number of items per page
      • statuses (optional) - Filter issues by status (array of: OPEN, CONFIRMED, REOPENED, RESOLVED, CLOSED, TO_REVIEW, IN_REVIEW, REVIEWED)
      • resolutions (optional) - Filter issues by resolution (array of: FALSE-POSITIVE, WONTFIX, FIXED, REMOVED)
      • resolved (optional) - Whether to return only resolved issues (true) or unresolved issues (false)
      • types (optional) - Filter issues by type (array of: CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT)
      • rules (optional) - Array of rule keys to filter issues
      • tags (optional) - Array of tags to filter issues
      • created_after (optional) - Return issues created after the given date (format: YYYY-MM-DD)
      • created_before (optional) - Return issues created before the given date (format: YYYY-MM-DD)
      • created_at (optional) - Return issues created on the given date
      • created_in_last (optional) - Return issues created during a time span before the current time (e.g., "1d" for issues created in the last day)
      • assignees (optional) - Array of assignee login names to filter issues
      • authors (optional) - Array of author login names to filter issues
      • cwe (optional) - Array of CWE identifiers to filter vulnerability issues
      • languages (optional) - Array of languages to filter issues
      • owasp_top10 (optional) - Array of OWASP Top 10 categories to filter issues
      • sans_top25 (optional) - Array of SANS Top 25 categories to filter issues
      • sonarsource_security (optional) - Array of SonarSource security categories to filter issues
      • on_component_only (optional) - Return only issues at the specified component level (true) or issues from the component's subtree (false)
      • facets (optional) - Array of facets to return along with the issues
      • since_leak_period (optional) - Return only issues created since the leak period
      • in_new_code_period (optional) - Return only issues created in the new code period

Environment Variables

  • SONARQUBE_URL - URL of your SonarQube instance (default: https://next.sonarqube.com/sonarqube)
  • SONARQUBE_TOKEN - Authentication token for SonarQube API access
  • SONARQUBE_ORGANIZATION - (Optional) Organization key for SonarQube Cloud

Development

  1. Clone the repository:
git clone https://github.com/sapientpants/sonarqube-mcp-server.git
cd sonarqube-mcp-server
  1. Install dependencies:
pnpm install
  1. Build the project:
pnpm run build
  1. Configure Claude Desktop
{
  "mcpServers": {
    "sonarqube": {
      "command": "node",
      "args": [
        "/path/to/sonarqube-mcp-server/dist/index.js"
      ],
      "env": {
        "SONARQUBE_TOKEN": "your-sonarqube-token"
      }
    }
  }
}

Prerequisites

  • Node.js 20 or higher
  • pnpm 10.7.0 or higher
  • Docker (for container builds)

Scripts

  • pnpm run build - Build the TypeScript code
  • pnpm run start - Start the server
  • pnpm run dev - Start the server in development mode
  • pnpm run test - Run tests
  • pnpm run lint - Run ESLint
  • pnpm run format - Format code with Prettier

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • momi
  • Provides initial medical assessments and advice.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

  • zhaoyunxing92
  • 本项目是一个钉钉MCP(Message Connector Protocol)服务,提供了与钉钉企业应用交互的API接口。项目基于Go语言开发,支持员工信息查询和消息发送等功能。

  • justmywyw
  • Short and sweet example MCP server / client implementation for Tools, Resources and Prompts.

  • KasarLabs
  • Build powerful and secure AI Agents powered by Starknet.

    Reviews

    1 (1)
    Avatar
    user_OrE7cO22
    2025-04-15

    Unstorage MCP Server by slow-groovin is a game-changer for seamless data management. The intuitive interface and reliable performance make it a must-have for any serious MCP application user. Highly recommend it for its efficiency and ease of use! Check it out here: https://mcp.so/server/unstorage-mcp/slow-groovin