Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

sonarqube-mcpsonarqube MCP 搜索

Agent Skill

sonarqube-mcp 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

8,326

周安装

354

GitHub Stars

229

下载量

2,917
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sonarqube-mcp(sonarqube MCP 搜索)
来源仓库:https://github.com/giuseppe-trisciuoglio/developer-kit
仓库路径:skills/sonarqube-mcp
安装命令:
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill sonarqube-mcp
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill sonarqube-mcp

简介

sonarqube-mcp 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于代码质量分析、技术文档检索或开发流程中的信息整理场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 确认具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

SonarQube MCP Integration

Leverage SonarQube and SonarCloud capabilities directly through the Model Context Protocol (MCP) server to enforce code quality, discover issues, and run pre-push analysis inside the agent workflow.

Overview

This skill provides instructions and patterns for using the SonarQube MCP Server tools. It enables automated workflows for:

  • Checking quality gate status before merges or deployments
  • Discovering and triaging issues by severity and project
  • Analyzing code snippets locally before committing (shift-left)
  • Understanding SonarQube rules with full documentation

When to Use

Use this skill when:

  • The user wants to check if a project passes its quality gate before merging a PR
  • The user wants to find critical or blocker issues in one or more SonarQube projects
  • The user wants to analyze a code snippet for issues before pushing to CI
  • The user wants to understand why a specific Sonar rule flagged their code
  • The user asks for pre-commit or pre-push quality feedback

Trigger phrases: "check quality gate", "sonarqube quality gate", "find sonar issues", "search sonar issues", "analyze code with sonar", "check sonar rule", "sonarcloud issues", "pre-push sonar check", "sonar pre-commit"

Prerequisites and Setup

The plugin includes a .mcp.json that starts the SonarQube MCP Server automatically via Docker. Before using this skill, set the required environment variables:

SonarQube Server (remote or local):

export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_URL="https://sonarqube.mycompany.com"  # or http://host.docker.internal:9000 for local Docker

SonarCloud:

export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_ORG="your-org-key"   # required for SonarCloud
# SONARQUBE_URL is not needed for SonarCloud

Requirements:

  • Docker must be installed and running
  • SONARQUBE_TOKEN is always required
  • SONARQUBE_URL is required for SonarQube Server (use host.docker.internal for local instances)
  • SONARQUBE_ORG is required for SonarCloud (omit SONARQUBE_URL in that case)

Quick Start

  1. Set your SonarQube/SonarCloud credentials: # SonarQube Server export SONARQUBE_TOKEN="squ_your_token" export SONARQUBE_URL="https://sonarqube.mycompany.com" # SonarCloud export SONARQUBE_TOKEN="squ_your_token" export SONARQUBE_ORG="your-org-key"
  2. Verify MCP tool availability:

- Tool names follow the pattern: mcp__sonarqube-mcp__<tool-name>

  1. If the MCP server fails to start, check:

- Docker is running - Environment variables are set - Reference: mcp/sonarqube on Docker Hub

Reference Documents

  • references/metrics.md — Common SonarQube metrics and their meaning
  • references/severity-levels.md — Sonar severity levels and impact categories
  • references/best-practices.md — Workflows for PR checks and pre-commit analysis
  • references/llm-context.md — Tool selection guide and parameter mapping for LLM agents

Instructions

Step 1: Identify the Required Operation

Determine which operation the user needs:

User IntentTool to Use
Check if project passes quality gateget_project_quality_gate_status
Find critical issues in a projectsearch_sonar_issues_in_projects
Analyze code before committinganalyze_code_snippet
Understand a flagged ruleshow_rule
Get detailed project metricsget_component_measures
Mark an issue as false positivechange_sonar_issue_status

If the user's intent is ambiguous, ask for the project key and the goal before proceeding.

Step 2: Quality Gate Monitoring

Use get_project_quality_gate_status to verify a project meets its quality standards.

Parameters:

  • projectKey (string) — Project key in SonarQube/SonarCloud
  • pullRequest (string, optional) — Pull request ID for PR-specific gate check
  • analysisId (string, optional) — Specific analysis ID
Note: There is no branch parameter on this tool. Without a pullRequest or analysisId, the tool returns the quality gate status for the default branch.

Pattern — Check default branch gate:

{
  "name": "get_project_quality_gate_status",
  "arguments": {
    "projectKey": "my-application"
  }
}

Pattern — Check PR gate before merge:

{
  "name": "get_project_quality_gate_status",
  "arguments": {
    "projectKey": "backend-service",
    "pullRequest": "456"
  }
}

Interpreting the response:

  • status: "OK" — Gate passed, safe to merge/deploy
  • status: "ERROR" — Gate failed; check conditions array for failing metrics
  • Each condition shows: metricKey, actualValue, errorThreshold, comparator

For more on metric keys, see references/metrics.md.

Step 3: Issue Discovery and Triaging

Use search_sonar_issues_in_projects to find and prioritize issues.

Parameters:

  • projects (array, optional) — List of project keys; omit to search all accessible projects
  • severities (array, optional) — Filter: BLOCKER, HIGH, MEDIUM, LOW, INFO
  • pullRequestId (string, optional) — Limit search to a specific PR
  • p (integer, optional) — Page number (default: 1)
  • ps (integer, optional) — Page size (default: 100, max: 500)

Pattern — Find blockers and critical issues:

{
  "name": "search_sonar_issues_in_projects",
  "arguments": {
    "projects": ["my-backend", "my-frontend"],
    "severities": ["BLOCKER", "HIGH"],
    "p": 1,
    "ps": 50
  }
}

Pattern — Search issues in a PR:

{
  "name": "search_sonar_issues_in_projects",
  "arguments": {
    "projects": ["my-service"],
    "pullRequestId": "123",
    "severities": ["HIGH", "MEDIUM"],
    "p": 1,
    "ps": 100
  }
}

Managing issues with change_sonar_issue_status:

Use this to mark false positives or accepted technical debt:

{
  "name": "change_sonar_issue_status",
  "arguments": {
    "key": "AY1234",
    "status": "falsepositive",
    "comment": "This pattern is safe in our context because..."
  }
}

Valid statuses: falsepositive (not a real issue), accept (acknowledged technical debt), reopen (reset to open)

Always present the list of issues to the user before changing their status. Never autonomously mark issues as false positives without explicit user confirmation.

Step 4: Pre-Push Analysis (Shift Left)

Use analyze_code_snippet to run SonarQube analysis on code before committing.

Parameters:

  • projectKey (string) — Project key for context
  • fileContent (string, required) — Full content of the file to analyze
  • language (string, optional) — Language hint for better accuracy
  • codeSnippet (string, optional) — Narrow results to a specific sub-range within fileContent

Supported languages: javascript, typescript, python, java, go, php, cs, cpp, kotlin, ruby, scala, swift

Pattern — Analyze TypeScript file before commit:

{
  "name": "analyze_code_snippet",
  "arguments": {
    "projectKey": "my-typescript-app",
    "fileContent": "async function fetchUser(id: string) {\n  const query = `SELECT * FROM users WHERE id = ${id}`;\n  return db.execute(query);\n}",
    "language": "typescript"
  }
}

Pattern — Analyze Python file:

{
  "name": "analyze_code_snippet",
  "arguments": {
    "projectKey": "my-python-service",
    "fileContent": "import pickle\n\ndef load_model(path):\n    with open(path, 'rb') as f:\n        return pickle.load(f)",
    "language": "python"
  }
}

Response interpretation:

  • Each issue includes: ruleKey, severity, clean code attribute, impact category, line number, quick fix availability
  • Address CRITICAL and HIGH severity issues before committing
  • Use show_rule with the ruleKey value for any unfamiliar rule

Step 5: Rule Education

Use show_rule to understand why a rule exists and how to fix flagged code.

Parameters:

  • key (string) — Rule key in format <language>:<rule-id> (e.g., typescript:S1082, java:S2068)

Pattern — Get rule documentation:

{
  "name": "show_rule",
  "arguments": {
    "key": "typescript:S1082"
  }
}

Response includes: rule name, type, severity, full description, tags (e.g., cwe, owasp-a2), language, remediation effort estimate, code examples (non-compliant vs compliant).

Step 6: Get Component Measures

Use get_component_measures to retrieve detailed metrics for a project, directory, or file.

Parameters:

  • projectKey (string) — Project key in SonarQube/SonarCloud
  • pullRequest (string, optional) — PR ID for PR-scoped metrics
  • metricKeys (array) — List of metric keys to retrieve

Common metric keys: coverage, bugs, vulnerabilities, code_smells, complexity, cognitive_complexity, ncloc, duplicated_lines_density, new_coverage, new_bugs

Pattern — Project health dashboard:

{
  "name": "get_component_measures",
  "arguments": {
    "projectKey": "my-project-key",
    "metricKeys": ["coverage", "bugs", "vulnerabilities", "code_smells", "ncloc"]
  }
}

For full metric reference, see references/metrics.md.

Step 7: Present Results to User

After each tool call:

  • Summarize findings in human-readable form
  • Flag issues that require attention (BLOCKER, HIGH severity)
  • Propose next actions based on findings
  • Wait for user confirmation before taking remediation steps (e.g., changing issue status, modifying code)

Examples

Example 1: Pre-Merge Quality Gate Check

User request: "Check if the quality gate passes for project backend-api on PR #234"

{
  "name": "get_project_quality_gate_status",
  "arguments": {
    "projectKey": "backend-api",
    "pullRequest": "234"
  }
}

If gate fails: Extract failing conditions, present them to the user, then use search_sonar_issues_in_projects filtered by the same PR to show the actual issues.

Example 2: Shift-Left Analysis Before Push

User request: "Analyze this Go function before I push it"

{
  "name": "analyze_code_snippet",
  "arguments": {
    "projectKey": "my-go-service",
    "fileContent": "func handler(w http.ResponseWriter, r *http.Request) {\n  id := r.URL.Query().Get(\"id\")\n  query := fmt.Sprintf(\"SELECT * FROM orders WHERE id = %s\", id)\n  rows, _ := db.Query(query)\n  // ...\n}",
    "language": "go"
  }
}

Present findings → for each issue, optionally call show_rule with the ruleKey value to explain the fix.

Example 3: Triage BLOCKER Issues in a Project

User request: "Show me all blocker issues in payment-service"

{
  "name": "search_sonar_issues_in_projects",
  "arguments": {
    "projects": ["payment-service"],
    "severities": ["BLOCKER"],
    "p": 1,
    "ps": 50
  }
}

Group results by category (Security, Reliability, Maintainability) and present to user. Offer to call show_rule for unfamiliar rules.

Best Practices

  1. Environment Setup — Set credentials once per session; the MCP server automatically picks them up
  2. Always check quality gate before merge — Run get_project_quality_gate_status as part of any PR review workflow
  3. Shift left on security issues — Use analyze_code_snippet during development, not only in CI
  4. Prioritize by severity — Address BLOCKER and HIGH issues first; document decisions for MEDIUM and LOW
  5. Use show_rule for unfamiliar keys — Never dismiss a rule without understanding its intent
  6. Paginate large result sets — Use p and ps parameters; handle multi-page responses for complete coverage
  7. Never change issue status autonomously — Always present issues to the user and get explicit confirmation before calling change_sonar_issue_status
  8. Provide language hints — Specify language in analyze_code_snippet for more accurate analysis

Constraints and Warnings

  • MCP server must be configured and running; verify tool availability before use
  • analyze_code_snippet analyzes snippets in isolation — full project context may affect results in CI
  • Issue status changes (false positive, won't fix) require appropriate SonarQube permissions
  • SonarCloud and SonarQube Server APIs are mostly compatible but some features differ; check references/llm-context.md
  • Pagination is required for projects with many issues; check paging.total and paging.pageSize in the response to determine whether to iterate further pages
  • Quality gate status reflects the last completed analysis — trigger a new analysis if the code has changed

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.84%
按下载量换算1,133

Claude

29.89%
按下载量换算872

Cursor

17.2%
按下载量换算502

Gemini CLI

9.8%
按下载量换算286

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills