
SonarQube
Plugin在 agent 编码循环中接入 SonarQube 代码质量与安全检查:密钥扫描钩子、问题列表与修复、质量门禁、覆盖率与依赖风险查询;开通 Vortex 分析后每次编辑自动检查。Sonar 官方维护,需 SonarQube 账号(含免费 Community Build)、sonar CLI 与 Docker。
SonarQube agent integrations
Made by Sonar
SonarQube is the AI code quality and security verification platform used by millions of developers to catch bugs, vulnerabilities, and leaked secrets. This plugin enforces those standards in the agent coding loop: 7,500+ distinct issue types, secrets scanning, agentic analysis, and quality gates across 40+ languages.
SonarQube combines deterministic checks with AI-assisted workflows so quality rules apply consistently to code from both developers and agents. Where your stack supports it, analysis and secrets scanning can run inside the agent loop instead of only in CI.
What do the plugins include
The Plugin helps agents connect to SonarQube CLI and SonarQube MCP Server for issue detection, checking project metrics such as test coverage and duplications, fetch dependency risks, etc. Claude Code, Copilot CLI, Codex, and Antigravity (through SonarQube CLI) install agent hooks for secrets scanning and, when entitled, Vortex analysis.
How to use: Run /sonarqube:sonar-integrate after installation to walk through setup — CLI installation, authentication, and wiring up the MCP Server and hooks. From there, use slash commands like /sonarqube:sonar-quality-gate to check quality gates or interact naturally with prompts like "analyze my code for issues," "show open SonarQube findings," or "check my coverage." With Vortex analysis enabled, verification happens automatically after each edit with no manual invocation required.
Prerequisites
- A SonarQube account (SonarQube Cloud, Server, or Community Build). Some features (for example Vortex analysis) depend on your SonarQube Cloud organization settings.
- SonarQube CLI (
sonar) on your machine. - A container runtime (Docker, Podman, or Nerdctl) for the MCP server image.
Authenticate once with sonar auth login (browser flow; credentials stay in your OS keychain). The MCP server uses that login.
Check auth anytime:
sonar auth status
How plugins connect to SonarQube
SonarQube CLI can wire everything for you:
sonar integrate claude # Claude Code: MCP, hooks, secrets scanning, etc.
sonar integrate copilot # GitHub Copilot CLI: MCP, hooks, secrets scanning, etc.
sonar integrate codex # Codex: MCP, hooks, secrets scanning, Vortex analysis hook
sonar integrate antigravity # Antigravity: hooks, instructions, CAG, MCP patch (after plugin install)
sonar integrate cursor # Cursor: MCP, secret-scanning hooks, Vortex analysis instructions
Run these after sonar auth login. Use the /sonarqube:sonar-integrate skill if you prefer a guided flow (install/update CLI, login, then integrate).
Claude Code
Install from Anthropic's marketplace claude-plugins-official:
/plugin install sonarqube@claude-plugins-official
claude plugin install sonarqube@claude-plugins-official
One-time setup
- Node.js — for the SessionStart hook (
scripts/setup.js). - Install SonarQube CLI if needed, then
/sonarqube:sonar-integrateorsonar auth login+sonar integrate claude.
sonar auth login by scenario:
| Scenario | Command |
|---|---|
| SonarQube Cloud (EU) | sonar auth login -o <org-key> |
| SonarQube Cloud (US) | sonar auth login -o <org-key> -s https://sonarqube.us |
| SonarQube Server | sonar auth login -s <server-url> |
Optional: add sonar-project.properties in the project root with sonar.projectKey, sources, etc.
GitHub Copilot CLI
Plugin bundle: .github/plugin/.
-
Install sonarqube from the pre-packaged
awesome-copilotplugins catalog:/plugin install sonarqube@awesome-copilot -
Run
sonar integrate copilot, or invoke the/sonarqube:sonar-integrateskill.
Same workflows as Usage once MCP is connected.
Cursor
.cursor-plugin/ with MCP via mcp.json.
- Install SonarQube plugin through Cursor's marketplace:
/add-plugin sonarqube
- Run
sonar integrate cursor, or invoke the/sonarqube:sonar-integrateskill.
Antigravity
Repo-root plugin: plugin.json, mcp_config.json, rules/sonarqube.md, and shared skills/. Hooks and managed instructions are not in the plugin bundle—they are installed by sonar integrate antigravity.
Recommended flow (full integration)
# 1. Plugin bundle — skills, rules, MCP
agy plugin install https://github.com/SonarSource/sonarqube-agent-plugins
# 2. Auth + hooks / instructions / CAG / MCP patch
sonar auth login
sonar integrate antigravity
Or use /sonarqube:sonar-integrate inside Antigravity for a guided flow. Restart the agent session if MCP tools do not appear.
Install options
| Option | Command / path | What you get |
|---|---|---|
| CLI global | agy plugin install <git-url|path|archive> | Plugin copied to ~/.gemini/config/plugins/sonarqube/ |
| IDE workspace | <project>/.agents/plugins/sonarqube/ | Plugin for that workspace only |
| Monorepo dev | Open sonarqube-agent-plugins as workspace | Auto-discovery from repo root — no agy plugin install |
Installing the whole repo is acceptable — other agents' dot-folders are inert in Antigravity.
Migrating from Gemini CLI
Gemini CLI is being replaced by Antigravity. Migrate platform config first (layout, skills paths, and cleanup), then update SonarQube as below.
If you already had the SonarQube Gemini extension installed:
agy plugin import gemini # converts legacy extensions → native plugins
sonar integrate antigravity # add hooks, instructions, CAG (new vs Gemini)
agy plugin import gemini scans legacy Gemini directories and migrates inline mcpServers into mcp_config.json. Expect output like ✔ mcpServers : 1 server definition migrated to mcp_config.json for SonarQube.
If you had custom skills under .gemini/skills/, move them to .agents/skills/.
After verifying Antigravity works, remove any duplicate legacy Gemini extension install if import created a copy.
For a fresh install, use the recommended flow above.
Same workflows as Usage once MCP is connected.
Factory Droid
.factory-plugin/ with MCP via mcp.json and the reviewer in droids/. No hooks: secrets scanning and Vortex analysis hooks are not available in Droid.
- Install the plugin from the SonarSource marketplace:
droid plugin marketplace add SonarSource/sonarqube-agent-plugins
droid plugin install sonarqube@sonarqube-agent-plugins
Droid names the marketplace after the repository, not after the name in marketplace.json, so the plugin is sonarqube@sonarqube-agent-plugins.
- Run
sonar auth login, or invoke the/sonarqube:sonar-integrateskill.
Codex CLI
Plugin bundle: .codex-plugin/ — catalog sonar, plugin sonarqube (see .codex-plugin/plugin.json).
-
Add SonarSource/sonarqube-agent-plugins as a plugin marketplace in Codex CLI:
codex plugin marketplace add SonarSource/sonarqube-agent-plugins -
Install sonarqube plugin from that catalog:
codex plugin add sonarqube@sonar -
Run
sonar auth login. -
Run
sonar integrate codex. This wires MCP in~/.codex/config.toml, secrets hooks, and—when your SonarQube Cloud org has Vortex analysis—a PostToolUse hook onapply_patchthat runs analysis on the git change set after each edit, applying to all Codex sessions on this machine.
Same workflows as Usage once MCP is connected.
Kiro
Plugin includes MCP configuration (kiro-power/mcp.json) that runs the mcp/sonarqube image and relies on SonarQube CLI for authentication—the same sonar auth login session.
sonar auth login, then enable the power per Kiro’s documentation.
Gemini CLI (legacy)
gemini-extension.json and GEMINI.md. sonar auth login and Usage.
Migrate to Antigravity with agy plugin import gemini and sonar integrate antigravity as described above.
Usage
Skills are the same across agents. Ask in natural language, invoke skills explicitly, or use the SonarQube MCP tools your client shows after MCP starts.
On Claude Code, GitHub Copilot CLI, and Cursor, the plugin also ships a sonarqube-reviewer agent (agents/sonarqube-reviewer.agent.md) that composes the skills below into a single PR/diff review — quality gate, issues, dependency risks, duplication, and coverage — without editing code itself.
MCP reference: SonarQube MCP Server docs.
Skills
Set up
/sonarqube:sonar-integrate
List projects
/sonarqube:sonar-list-projects
/sonarqube:sonar-list-projects my-project
List issues
/sonarqube:sonar-list-issues
/sonarqube:sonar-list-issues my-project --severities CRITICAL
Fix an issue
/sonarqube:sonar-fix-issue java:S1481 src/main/java/MyClass.java
/sonarqube:sonar-fix-issue python:S2077 src/auth/login.py:34
Quality gate / analyze / coverage / duplication / dependency risks
/sonarqube:sonar-quality-gate
/sonarqube:sonar-quality-gate my-project --branch main
/sonarqube:sonar-analyze
/sonarqube:sonar-analyze src/auth/login.py
/sonarqube:sonar-coverage
/sonarqube:sonar-coverage my-project --max 50
/sonarqube:sonar-coverage my-project --file src/auth/login.py
/sonarqube:sonar-duplication
/sonarqube:sonar-duplication my-project --pr 42
/sonarqube:sonar-dependency-risks
/sonarqube:sonar-dependency-risks my-project --pr 42
/sonarqube:sonar-triage-dependency-risks
/sonarqube:sonar-triage-dependency-risks my-project --branch main --fix
License
Copyright (C) 2025-2026 SonarSource Sàrl. Licensed under SSAL-1.0.
Support
- Community: https://community.sonarsource.com/
相關資源

SonarQube MCP Server
MCPSonarSource 官方:连接 SonarQube Server 或 Cloud,让 agent 查询项目的代码质量问题、质量门禁、安全热点与依赖风险,还能直接分析文件代码。需要 SonarQube 令牌,推荐用 Docker 运行。
SonarSource/sonarqube-mcp-server665
Semgrep Guardian
Plugin把 Semgrep MCP 服务和钩子打包在一起:agent 每写一个文件,就用 Semgrep Code、Supply Chain、Secrets 扫描漏洞、恶意依赖和硬编码密钥,并提示 agent 重写,直到结果干净或由你忽略。Semgrep 官方维护,需要登录 Semgrep 账号。
semgrep/guardian17
Semgrep
CLI语义化的多语言静态分析工具:用写法接近源码的规则查找漏洞与缺陷,支持 30 多种语言与自定义规则,默认在本地扫描、不上传代码。跨文件分析与 Pro 规则需登录。
semgrep/semgrep17.1k
Semgrep MCP
MCPSemgrep 官方 MCP 服务器,已并入 semgrep 主仓库,通过 semgrep mcp 启动:让 agent 对代码做静态安全扫描、用自定义规则查找问题并查看语法树。需先安装 Semgrep CLI;接入 AppSec 平台需 SEMGREP_APP_TOKEN。
semgrep/semgrep17.1k
Trail of Bits Skills
Skill安全公司 Trail of Bits 出品的技能合集,40 多个插件覆盖代码审计、CodeQL/Semgrep 静态分析、差异评审、智能合约与密码学审计、模糊测试等,也可作为 Claude Code / Codex 插件市场安装。
trailofbits/skills7.6k
Security Scanning
Pluginwshobson/agents 市场中的安全插件:提供 SAST、依赖漏洞扫描与安全加固命令,附安全审计员与威胁建模子代理,以及 STRIDE、攻击树等威胁分析技能。
wshobson/agents40.9k