community-sonarcloud-mcp-server
Provides tools for interacting with SonarCloud's API, enabling AI assistants to query code quality metrics, issues, pull requests, and project information from SonarCloud.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@community-sonarcloud-mcp-server list all projects in my organization"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SonarCloud MCP Server
A TypeScript-based Model Context Protocol (MCP) server that provides AI assistants with seamless access to SonarCloud data. Query code quality metrics, issues, pull requests, and project information directly from your AI tools.
Why This Server?
No Docker Required: Unlike SonarSource's official Docker-based MCP server, this is a lightweight TypeScript solution
AI-Optimized: Returns JSON data structured for optimal AI consumption and analysis
Comprehensive API Coverage: 12 tools covering all major SonarCloud endpoints
Flexible Authentication: Multiple auth methods including environment variables, CLI args, and config files
Claude Code Integration: Perfect for use with Anthropic's Claude Code and other MCP-compatible AI tools
Related MCP server: SonarQube MCP Server
Installation
npm install -g community-sonarcloud-mcp-serverOr run directly with npx:
npx community-sonarcloud-mcp-serverCheck version:
npx community-sonarcloud-mcp-server --versionConfiguration
Method 1: Environment Variables
export SONARCLOUD_TOKEN="your_token_here"
export SONARCLOUD_ORGANIZATION="your_org_here"
export SONARCLOUD_URL="https://sonarcloud.io" # Optional, defaults to sonarcloud.ioMethod 2: Command Line Arguments
npx community-sonarcloud-mcp-server --token "your_token" --org "your_org" --url "https://sonarcloud.io"Method 3: Config File
Create a config file and use:
npx community-sonarcloud-mcp-server --config ./sonarcloud-config.jsonConfig file format:
{
"token": "your_sonarcloud_token",
"organization": "your_organization_key",
"url": "https://sonarcloud.io"
}Priority order: CLI args > Environment vars > Config file
Available Tools
This server provides 12 comprehensive tools for SonarCloud integration:
Core Project & Issue Management
list_projects- List all projects in your organizationsearch_issues- Search and filter issues by project, severity, type, status, and Clean Code impact qualitiesget_pull_requests- List pull requests for a specific projectchange_issue_status- Mark issues as confirmed, false positive, won't fix, or reopen
Code Quality & Metrics
get_measures- Get detailed metrics (coverage, bugs, vulnerabilities, code smells, technical debt)search_metrics- Discover available metrics and their descriptionsget_quality_gate_status- Check if projects pass quality gateslist_quality_gates- List all available quality gate configurations
Rules & Analysis
show_rule- Get detailed information about specific coding ruleslist_rule_repositories- Browse rule repositories by languagelist_languages- See all supported programming languages
Source Code
get_raw_source- Retrieve raw source code for any file in your projects
Each tool returns structured JSON data optimized for AI analysis and decision-making.
Quick Setup
VS Code
Claude Code
claude mcp add -s user -e SONARCLOUD_TOKEN=your-token-here -e SONARCLOUD_ORGANIZATION=your-org-key sonarcloud -- npx community-sonarcloud-mcp-serverVerify the connection with:
claude mcp listManual Configuration
Add this server to your MCP configuration file (.mcp.json for Claude Code):
Option 1: Environment Variables (Recommended)
{
"mcpServers": {
"community-sonarcloud-mcp": {
"command": "npx",
"args": ["community-sonarcloud-mcp-server"],
"env": {
"SONARCLOUD_TOKEN": "your_token_here",
"SONARCLOUD_ORGANIZATION": "your_org_here"
}
}
}
}Option 2: Direct Installation
npm install -g community-sonarcloud-mcp-serverThen reference the global installation:
{
"mcpServers": {
"community-sonarcloud-mcp": {
"command": "community-sonarcloud-mcp",
"env": {
"SONARCLOUD_TOKEN": "your_token_here",
"SONARCLOUD_ORGANIZATION": "your_org_here"
}
}
}
}Getting Your SonarCloud Token
Click Generate Tokens
Give your token a name (e.g., "Claude Code MCP")
Set token permissions:
Browse: Required for viewing projects and issues
Execute Analysis: Optional (only needed for CI/CD integration)
Generate the token and copy it immediately (you won't see it again)
Add the token to your configuration
Finding Your Organization Key
Your organization key is found in the URL when viewing your SonarCloud organization:
URL format:
https://sonarcloud.io/organizations/{your-org-key}Example: For URL
https://sonarcloud.io/organizations/my-company, the key ismy-company
⚠️ Security Note: Never commit your SonarCloud token to version control. Store it securely as an environment variable.
Troubleshooting
"SONARCLOUD_TOKEN is required" error
Ensure your token is properly set in environment variables or config
Check that the token hasn't been revoked or expired in SonarCloud
Verify the token has the correct permissions (Browse is minimum required)
"Failed to connect" in Claude Code
Verify the organization name matches exactly (case-sensitive)
Check that your organization key is correct (found in SonarCloud URL)
Ensure the token has access to the specified organization
Try running the server directly:
SONARCLOUD_TOKEN="your_token" SONARCLOUD_ORGANIZATION="your_org" npx community-sonarcloud-mcp-server
"No projects found" or empty responses
Verify your token has Browse permissions for the organization
Check that projects exist in the specified organization
Ensure your user account has access to the organization's projects
MCP Server not starting
Check that Node.js version is compatible (18+)
Verify npm/npx is working correctly
Try installing globally first:
npm install -g community-sonarcloud-mcp-server
Usage Examples
Once configured, you can ask your AI assistant questions like:
"What projects do I have in SonarCloud?"
"Show me all bugs in my main project"
"What's the test coverage for my latest pull request?"
"List all critical security vulnerabilities"
"Show me the quality gate status for project X"
"What coding rules are failing in this project?"
The server will automatically query SonarCloud and return structured data for analysis.
Development
git clone https://github.com/langtind/community-sonarcloud-mcp-server.git
cd community-sonarcloud-mcp-server
npm install
npm run devBuilding
npm run build
npm startTesting
# Test the server directly
SONARCLOUD_TOKEN="your_token" SONARCLOUD_ORGANIZATION="your_org" npm startContributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
Model Context Protocol - The protocol this server implements
SonarCloud - The service this server integrates with
Claude Code - AI coding assistant that works great with this server
Available Tools
12 toolschange_issue_statusC
Change the status of a SonarQube issue
Inputs: key (required), transition (required).
get_measuresC
Get component measures/metrics
Inputs: component (required), strategy, metricKeys, pullRequest.
get_pull_requestsB
List pull requests for a project
Inputs: project (required).
get_quality_gate_statusC
Get Quality Gate status for a project
Inputs: projectKey (required), branch, pullRequest.
get_raw_sourceC
Get source code as raw text
Inputs: key (required), branch, pullRequest.
list_languagesA
List all programming languages supported
Inputs: q.
list_projectsA
List projects in the organization
Inputs: q, pageSize.
list_quality_gatesB
List all quality gates
Inputs: no named parameters.
list_rule_repositoriesC
List rule repositories
Inputs: q, language.
search_issuesC
Search for issues in SonarCloud projects
Inputs: types, project, pageSize, resolved, +4 more.
search_metricsC
Search for available metrics
Inputs: q, pageSize.
show_ruleA
Show detailed information about a rule
Inputs: key (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools target distinct resources and actions, such as listing quality gates versus getting a project's quality gate status. The only mild boundary is between search_metrics (metric catalog) and get_measures (actual metric values), but their descriptions make the distinction clear.
The set mostly follows a lowercase verb_noun pattern but mixes verbs: list_, search_, get_, show_, and change_. For example, get_pull_requests could be list_pull_requests and show_rule could be get_rule, so the pattern is readable but not fully consistent.
12 tools is well-scoped for a SonarCloud-focused server. Each tool covers a meaningful aspect of code quality analysis without feeling redundant or overwhelming.
The server covers core read-oriented workflows: projects, quality gates, issues, measures, metrics, rules, languages, pull requests, and source. Minor gaps exist, such as issue comments, project detail beyond listing, or quality gate management, but agents can accomplish common analysis tasks without dead ends.
Maintenance
Related MCP Connectors
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server for interacting with SonarQube code quality platform.31MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that provides AI assistants with access to SonarQube code quality, security, and project analytics data.7115 npmMIT
- AlicenseCqualityDmaintenanceA Python MCP server for SonarQube, enabling AI agents to query projects, issues, quality gates, coverage, and security hotspots.13MIT
- AlicenseAqualityBmaintenanceA TypeScript MCP server that turns the Polarion ALM REST API into a tool-based interface for AI assistants.293317 npm6MIT