Get the FREE Ultimate OpenClaw Setup Guide →

fastmcp-sonarqube-metrics

Chat with your SonarQube data: explore metrics, compare trends, and track issues—effortlessly.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio archai-labs-fastmcp-sonarqube-metrics python server.py \
  --env TRANSPORT="stdio or sse" \
  --env GEMINI_MODEL="Optional Gemini/OpenAI model name" \
  --env SONARQUBE_URL="URL of your SonarQube instance (e.g., http://localhost:9000)" \
  --env GEMINI_API_KEY="Optional Gemini/OpenAI API key" \
  --env SONARQUBE_TOKEN="Your SonarQube API token" \
  --env AZURE_OPENAI_API_KEY="Optional Azure OpenAI API key" \
  --env AZURE_OPENAI_ENDPOINT="Optional Azure OpenAI endpoint" \
  --env AZURE_OPENAI_DEPLOYMENT="Optional Azure OpenAI deployment name" \
  --env AZURE_OPENAI_API_VERSION="Optional Azure OpenAI API version"

How to use

This MCP server exposes a set of tools to interact with a SonarQube instance via the FastMCP framework. It provides health checks, project management actions, and metric retrieval including current and historical metrics, plus component-tree metrics and issues. Use the server to programmatically query SonarQube data through the MCP client interfaces, enabling integration with dashboards, automation pipelines, or custom reporting tools. Typical usage involves starting the Python server, configuring environment variables for SonarQube access, and invoking tools such as get_status, get_sonarqube_metrics, get_sonarqube_metrics_history, get_sonarqube_component_tree_metrics, list_projects, and get_project_issues through a compatible MCP client.

How to install

Prerequisites:\n- Python 3.7+\n- Access to a SonarQube instance with API permissions\n- FastMCP library installed in your environment\n\nInstall steps:\n1. Clone the repository (or download the project):\n git clone <repository_url>\n cd fastmcp-sonarqube-metrics\n\n2. Create and activate a virtual environment:\n python3 -m venv venv\n # macOS/Linux\n source venv/bin/activate\n # Windows (PowerShell)\n .\venv\Scripts\Activate.ps1\n\n3. Install dependencies:\n pip install fastmcp httpx pydantic python-dotenv\n\n4. Configure environment variables (example):\n export SONARQUBE_URL="http://localhost:9000"\n export SONARQUBE_TOKEN="your_token"\n export TRANSPORT="stdio"\n\n5. Run the server:\n python server.py\n\n6. (Optional) Run the client for testing:\n python client_test.py\n\nNotes:\n- Ensure your SonarQube instance is reachable from the environment running the server.\n- Depending on your setup, you may need to adjust network/firewall settings to allow API access.\n- The .env file can be used to persist environment variables for convenience.

Additional notes

Tips and common considerations:\n- Ensure SONARQUBE_TOKEN has the required permissions for the operations you plan to perform (read vs. admin actions).\n- The TRANSPORT setting should match your client configuration (stdio for local testing, sse for server-sent events).\n- The GEMINI_* and AZURE_OPENAI_* variables are optional and used if you enable integration with LLMs or AI assistants to help formulate or interpret queries.\n- Use list_projects to discover available SonarQube projects before querying metrics.\n- If you encounter pagination issues in get_sonarqube_component_tree_metrics, verify SonarQube API pagination settings and ensure the server has proper network access.\n- Keep dependencies updated to stay compatible with FastMCP changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers