Is the SonarQube MCP server safe? What it can reach
What the SonarQube MCP server can read, write and delete, how it signs in, and how to limit it in Claude Code and Codex.
SonarSource maintains the official SonarQube MCP server for SonarQube Cloud and Server. It runs locally in Docker with a user token, or over hosted OAuth for Cloud. It mostly reads code quality data and source, but it can change issue and hotspot status and create webhooks. SONARQUBE_READ_ONLY=true removes the write tools.
Who maintains it
| Implementation | Kind | Status |
|---|---|---|
| SonarSource/sonarqube-mcp-server (official) | Official | active |
It runs as a local process on your machine or as a hosted remote server.
How it signs in
Local use takes a SonarQube Cloud token or a SonarQube Server user token in SONARQUBE_TOKEN, and the server acts with that user’s rights. Hosted SonarQube Cloud also supports OAuth.
| Scope or permission | Access |
|---|---|
mcp:tools:read | read |
mcp:tools:write | write |
What its tools can do
| Kind | Tools |
|---|---|
| Read | analyze_code_snippet, analyze_file_list, run_advanced_code_analysis, search_files_by_coverage, get_file_coverage_details, search_dependency_risks, list_enterprises, search_sonar_issues_in_projects, search_security_hotspots, show_security_hotspot, list_languages, get_component_measures, search_metrics, list_portfolios, list_organizations, search_my_sonarqube_projects, list_branches, list_pull_requests, get_project_quality_gate_status, list_quality_gates, show_rule, search_duplicated_files, get_duplications, get_raw_source, get_scm_info, get_system_health, get_system_info, get_system_logs, ping_system, get_system_status, list_webhooks, search_by_signature_patterns, search_by_body_patterns, get_upstream_call_flow, get_downstream_call_flow, get_source_code, get_type_hierarchy, get_references, get_current_architecture, get_intended_architecture, get_guidelines, check_dependency |
| Write | change_sonar_issue_status, change_security_hotspot_status, toggle_automatic_analysis, create_webhook |
| Can’t be undone | none documented |
Which tools appear depends on the enabled toolsets, the transport and your organization’s entitlements. analyze_code_snippet is deprecated. The README lists no tool that deletes projects or data.
Built-in limits
| Option | What it does |
|---|---|
SONARQUBE_READ_ONLY | Set to true to disable all write operations such as changing issue status. In HTTP mode a client header can narrow this further but cannot lift a server-level setting. |
SONARQUBE_TOOLSETS | Comma-separated list of toolsets to enable, such as issues,quality-gates. The projects toolset is always on. |
SONARQUBE_PROJECT_KEY | Pins one default project and removes the projectKey parameter from tool schemas. |
SONARQUBE_ORG | Fixes the Cloud organization; organization arguments are then rejected. |
The risks
- get_raw_source, get_source_code and get_scm_info return your source and author data to the model, so an injected instruction in an issue message could push that code into the chat.
- change_sonar_issue_status can mark issues accepted or false positive and change_security_hotspot_status can review hotspots, which can hide real findings and flip a quality gate to green.
- create_webhook can point project events at a URL the agent chooses.
- The token carries one user’s rights across every project that user can see, and system tools can read server logs and configuration on SonarQube Server.
Limit it in Claude Code
Add it from the documented launch settings, at local or user scope so a token never lands in a shared .mcp.json:
claude mcp add --env SONARQUBE_TOKEN=... --env SONARQUBE_ORG=... sonarqube -- docker run --init --pull=always -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_ORG sonarsource/sonarqube-mcpClaude Code names MCP tools mcp__sonarqube__<tool>. Deny rules win over ask rules, and ask rules over allow rules. Put these in ~/.claude/settings.json or the project’s .claude/settings.json:
{
"permissions": {
"deny": [
"mcp__sonarqube__create_webhook"
],
"ask": [
"mcp__sonarqube__change_sonar_issue_status",
"mcp__sonarqube__change_security_hotspot_status",
"mcp__sonarqube__toggle_automatic_analysis"
]
}
}Limit it in Codex
Codex reads MCP servers from ~/.codex/config.toml. disabled_tools removes tools, and enabled_tools keeps only the ones you list:
[mcp_servers.sonarqube]
command = "docker"
args = ["run", "--init", "--pull=always", "-i", "--rm", "-e", "SONARQUBE_TOKEN", "-e", "SONARQUBE_ORG", "sonarsource/sonarqube-mcp"]
env_vars = ["SONARQUBE_TOKEN", "SONARQUBE_ORG"]
disabled_tools = ["create_webhook"]Checklist
- Set SONARQUBE_READ_ONLY=true unless the agent must triage issues.
- Use a token for a user with access to only the projects you need.
- Set SONARQUBE_PROJECT_KEY to pin one project.
- Limit SONARQUBE_TOOLSETS to what the task needs.
- Deny create_webhook and ask before status changes.
Checked against the vendor documentation on November 25, 2026. SonarQube MCP Server README · Repository metadata (stars, last push)
What Excellent covers
Excellent doesn’t inspect MCP servers themselves. Its free scan reads supported logs on the Mac (Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code) and reports findings for review, so you can see what an agent did after a session. Run the free scan · See a sample report · How to vet any MCP server
Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Pro is US-only for now. Agent coverage · Pricing