Model Context Protocol (MCP) server for SonarCloud integration - provides AI tools for querying code quality metrics, issues, and project data
npm install community-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.
- 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
``bash`
npm install -g community-sonarcloud-mcp-server
Or run directly with npx:
`bash`
npx community-sonarcloud-mcp-server
bash
export SONARCLOUD_TOKEN="your_token_here"
export SONARCLOUD_ORGANIZATION="your_org_here"
export SONARCLOUD_URL="https://sonarcloud.io" # Optional, defaults to sonarcloud.io
`$3
`bash
npx community-sonarcloud-mcp-server --token "your_token" --org "your_org" --url "https://sonarcloud.io"
`$3
Create a config file and use:
`bash
npx community-sonarcloud-mcp-server --config ./sonarcloud-config.json
`Config file format:
`json
{
"token": "your_sonarcloud_token",
"organization": "your_organization_key",
"url": "https://sonarcloud.io"
}
`$3
If token/organization is missing and running interactively, the server will prompt for them.Priority order: CLI args > Environment vars > Config file > Prompts
Available Tools
This server provides 12 comprehensive tools for SonarCloud integration:
$3
- list_projects - List all projects in your organization
- search_issues - Search and filter issues by project, severity, type, status
- get_pull_requests - List pull requests for a specific project
- change_issue_status - Mark issues as confirmed, false positive, won't fix, or reopen$3
- get_measures - Get detailed metrics (coverage, bugs, vulnerabilities, code smells, technical debt)
- search_metrics - Discover available metrics and their descriptions
- get_quality_gate_status - Check if projects pass quality gates
- list_quality_gates - List all available quality gate configurations$3
- show_rule - Get detailed information about specific coding rules
- list_rule_repositories - Browse rule repositories by language
- list_languages - See all supported programming languages$3
- get_raw_source - Retrieve raw source code for any file in your projectsEach tool returns structured JSON data optimized for AI analysis and decision-making.
Quick Setup
$3

$3

$3

Manual Configuration
Add this server to your MCP configuration file (
.mcp.json for Claude Code):$3
`json
{
"mcpServers": {
"community-sonarcloud-mcp": {
"command": "npx",
"args": ["community-sonarcloud-mcp-server"],
"env": {
"SONARCLOUD_TOKEN": "your_token_here",
"SONARCLOUD_ORGANIZATION": "your_org_here"
}
}
}
}
`$3
`bash
npm install -g community-sonarcloud-mcp-server
`Then reference the global installation:
`json
{
"mcpServers": {
"community-sonarcloud-mcp": {
"command": "sonarcloud-mcp",
"env": {
"SONARCLOUD_TOKEN": "your_token_here",
"SONARCLOUD_ORGANIZATION": "your_org_here"
}
}
}
}
`$3
1. Go to SonarCloud
2. Navigate to My Account → Security
3. Generate a new token with appropriate permissions
4. Copy the token and add it to your configuration
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
`bash
git clone https://github.com/langtind/community-sonarcloud-mcp-server.git
cd community-sonarcloud-mcp-server
npm install
npm run dev
`$3
`bash
npm run build
npm start
`$3
`bash
Test the server directly
SONARCLOUD_TOKEN="your_token" SONARCLOUD_ORGANIZATION="your_org" npm start
``1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request
MIT License - see LICENSE file for details.
- 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