{
  "markdown": "# SonarQube MCP Server\n\n[![Build](https://github.com/SonarSource/sonarqube-mcp-server/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SonarSource/sonarqube-mcp-server/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=SonarSource_sonarqube-mcp-server&metric=alert_status&token=364a508a1e77096460f8571d8e66b41c99c95bea)](https://sonarcloud.io/summary/new_code?id=SonarSource_sonarqube-mcp-server)\n\nThe SonarQube MCP Server is a Model Context Protocol (MCP) server that enables seamless integration with SonarQube Server or Cloud for code quality and security.\nIt also supports the analysis of code snippet directly within the agent context.\n\n## Quick setup\n\n<details>\n<summary>Security best practices</summary>\n\n> 🔒 **Important**: Your SonarQube token is a sensitive credential. Follow these security practices:\n\n**When using CLI commands:**\n- **Avoid hardcoding tokens** in command-line arguments – they get saved in shell history\n- **Use environment variables** – set tokens in environment variables before running commands\n\n**When using configuration files:**\n- **Never commit tokens** to version control\n- **Use environment variable substitution** in config files when possible\n\n</details>\n\n### 🚀 Generate your configuration\n\nThe fastest way to get started is the **[SonarQube MCP Server Configuration Generator](https://mcp.sonarqube.com/config-generator.html)** – an interactive tool that produces a ready-to-use configuration for your preferred AI agent client.\n\n### Manual setup\n\nIf you prefer to configure things yourself, the simplest method is to use our container image at [sonarsource/sonarqube-mcp](https://hub.docker.com/r/sonarsource/sonarqube-mcp/tags). Use `sonarsource/sonarqube-mcp` for automatic updates (with `--pull=always`), or pin to a version tag (e.g., `sonarsource/sonarqube-mcp:1.19.0.2785`) for reproducible deployments. Read below if you want to build it locally.\n\n> **Note:** While the examples below use `docker`, any OCI-compatible container runtime works (e.g., Podman, nerdctl). Simply replace `docker` with your preferred tool.\n\n<details>\n<summary>Antigravity</summary>\n\nSonarQube MCP Server is available in the Antigravity MCP Store. Follow these instructions:\n\n1. Open the **Agent Side Panel**\n2. Click the three dots (**...**) at the top right and select **MCP Servers**\n3. Search for `SonarQube` and select **Install**\n4. Provide the required SonarQube User token. You can also provide your organization key for SonarQube Cloud or the SonarQube URL if connecting to SonarQube Server.\n\nFor **SonarQube Cloud US**, set the URL to `https://sonarqube.us`.\n\nAlternatively, you can manually configure the server via `mcp_config.json`:\n\n* To connect with SonarQube Cloud:\n\nIn the Agent Side Panel, click the three dots (**...**) -> **MCP Store** -> **Manage MCP Servers** -> **View raw config**, and add the following:\n\n```json\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"--init\", \"--pull=always\", \"-i\", \"--rm\", \"-e\", \"SONARQUBE_TOKEN\", \"-e\", \"SONARQUBE_ORG\", \"sonarsource/sonarqube-mcp\"],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"<YOUR_TOKEN>\",\n        \"SONARQUBE_ORG\": \"<YOUR_ORG>\"\n      }\n    }\n  }\n}\n```\n\nFor **SonarQube Cloud US**, manually add `\"SONARQUBE_URL\": \"https://sonarqube.us\"` to the `env` section and `\"-e\", \"SONARQUBE_URL\"` to the `args` array.\n\n* To connect with SonarQube Server:\n\n```json\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"--init\", \"--pull=always\", \"-i\", \"--rm\", \"-e\", \"SONARQUBE_TOKEN\", \"-e\", \"SONARQUBE_URL\", \"sonarsource/sonarqube-mcp\"],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"<YOUR_USER_TOKEN>\",\n        \"SONARQUBE_URL\": \"<YOUR_SERVER_URL>\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Claude Code</summary>\n\n* To connect with SonarQube Cloud:\n\n```bash\nclaude mcp add sonarqube \\\n  --env SONARQUBE_TOKEN=$SONAR_TOKEN \\\n  --env SONARQUBE_ORG=$SONAR_ORG \\\n  -- docker run --init --pull=always -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_ORG sonarsource/sonarqube-mcp\n```\n\nFor **SonarQube Cloud US**, add `--env SONARQUBE_URL=https://sonarqube.us` to the command.\n\n* To connect with SonarQube Server:\n\n```bash\nclaude mcp add sonarqube \\\n  --env SONARQUBE_TOKEN=$SONAR_USER_TOKEN \\\n  --env SONARQUBE_URL=$SONAR_URL \\\n  -- docker run --init --pull=always -i --rm -e SONARQUBE_TOKEN -e SONARQUBE_URL sonarsource/sonarqube-mcp\n```\n\n</details>\n\n<details>\n<summary>Codex CLI</summary>\n\nManually edit the configuration file at `~/.codex/config.toml` and add the following configuration:\n\n* To connect with SonarQube Cloud:\n\n```toml\n[mcp_servers.sonarqube]\ncommand = \"docker\"\nargs = [\"run\", \"--init\", \"--pull=always\", \"--rm\", \"-i\", \"-e\", \"SONARQUBE_TOKEN\", \"-e\", \"SONARQUBE_ORG\", \"sonarsource/sonarqube-mcp\"]\nenv = { \"SONARQUBE_TOKEN\" = \"<YOUR_USER_TOKEN>\", \"SONARQUBE_ORG\" = \"<YOUR_ORG>\" }\n```\n\nFor **SonarQube Cloud US**, add `\"SONARQUBE_URL\" = \"https://sonarqube.us\"` to the `env` section and `\"-e\", \"SONARQUBE_URL\"` to the `args` array.\n\n* To connect with SonarQube Server:\n\n```toml\n[mcp_servers.sonarqube]\ncommand = \"docker\"\nargs = [\"run\", \"--init\", \"--pull=always\", \"--rm\", \"-i\", \"-e\", \"SONARQUBE_TOKEN\", \"-e\", \"SONARQUBE_URL\", \"sonarsource/sonarqube-mcp\"]\nenv = { \"SONARQUBE_TOKEN\" = \"<YOUR_TOKEN>\", \"SONARQUBE_URL\" = \"<YOUR_SERVER_URL>\" }\n```\n\n</details>\n\n<details>\n<summary>Cursor</summary>\n\n* To connect with SonarQube Cloud:\n\n[![Install for SonarQube Cloud](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=sonarqube&config=eyJlbnYiOnsiU09OQVJRVUJFX1RPS0VOIjoiWU9VUl9UT0tFTiIsIlNPTkFSUVVCRV9PUkciOiJZT1VSX1NPTkFSUVVCRV9PUkcifSwiY29tbWFuZCI6ImRvY2tlciBydW4gLS1pbml0IC0tcHVsbD1hbHdheXMgLWkgLS1ybSAtZSBTT05BUlFVQkVfVE9LRU4gLWUgU09OQVJRVUJFX09SRyBzb25hcnNvdXJjZS9zb25hcnF1YmUtbWNwIn0%3D)\n\nFor **SonarQube Cloud US**, manually add `\"SONARQUBE_URL\": \"https://sonarqube.us\"` to the `env` section in your MCP configuration after installation.\n\n* To connect with SonarQube Server:\n\n[![Install for SonarQube Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=sonarqube&config=eyJlbnYiOnsiU09OQVJRVUJFX1RPS0VOIjoiWU9VUl9VU0VSX1RPS0VOIiwiU09OQVJRVUJFX1VSTCI6IllPVVJfU09OQVJRVUJFX1VSTCJ9LCJjb21tYW5kIjoiZG9ja2VyIHJ1biAtLWluaXQgLS1wdWxsPWFsd2F5cyAtaSAtLXJtIC1lIFNPTkFSUVVCRV9UT0tFTiAtZSBTT05BUlFVQkVfVVJMIHNvbmFyc291cmNlL3NvbmFycXViZS1tY3AifQ%3D%3D)\n\n</details>\n\n<details>\n<summary>Gemini CLI</summary>\n\n> **Note:** The Gemini CLI extension has moved to the [sonarqube-agent-plugins](https://github.com/SonarSource/sonarqube-agent-plugins) repository. Please install it from there going forward.\n\nYou can install our MCP server extension by using the following command:\n\n```bash\ngemini extensions install https://github.com/SonarSource/sonarqube-agent-plugins\n```\n\nYou will need to set the required environment variables before starting Gemini:\n\n**Environment Variables Required:**\n\n* **For SonarQube Cloud:**\n  - `SONARQUBE_TOKEN` - Your SonarQube Cloud token\n  - `SONARQUBE_ORG` - Your organization key\n  - `SONARQUBE_URL` - (Optional) Set to `https://sonarqube.us` for SonarQube Cloud US\n\n* **For SonarQube Server:**\n  - `SONARQUBE_TOKEN` - Your SonarQube Server USER token\n  - `SONARQUBE_URL` - Your SonarQube Server URL\n\nOnce installed, the extension will be installed under `<home>/.gemini/extensions/sonarqube/gemini-extension.json`.\n\n</details>\n\n<details>\n<summary>GitHub Copilot CLI</summary>\n\nAfter starting Copilot CLI, run the following command to add the SonarQube MCP server:\n\n```bash\n/mcp add\n```\n\nYou will have to provide different information about the MCP server, you can use tab to navigate between fields.\n\n* To connect with SonarQube Cloud:\n\n```\nServer Name: sonarqube\nServer Type: Local (Press 1)\nCommand: docker\nArguments: run, --init, --pull=always, --rm, -i, -e, SONARQUBE_TOKEN, -e, SONARQUBE_ORG, sonarsource/sonarqube-mcp\nEnvironment Variables: SONARQUBE_TOKEN=<YOUR_TOKEN>,SONARQUBE_ORG=<YOUR_ORG>\nTools: *\n```\n\nFor **SonarQube Cloud US**, add `-e, SONARQUBE_URL` to Arguments and `SONARQUBE_URL=https://sonarqube.us` to Environment Variables.\n\n* To connect with SonarQube Server:\n\n```\nServer Name: sonarqube\nServer Type: Local (Press 1)\nCommand: docker\nArguments: run, --init, --pull=always, --rm, -i, -e, SONARQUBE_TOKEN, -e, SONARQUBE_URL, sonarsource/sonarqube-mcp\nEnvironment Variables: SONARQUBE_TOKEN=<YOUR_USER_TOKEN>,SONARQUBE_URL=<YOUR_SERVER_URL>\nTools: *\n```\n\nThe configuration file is located at `~/.copilot/mcp-config.json`.\n\n</details>\n\n<details>\n<summary>GitHub Copilot coding agent</summary>\n\nGitHub Copilot coding agent can leverage the SonarQube MCP server directly in your CI/CD.\n\nTo add the secrets to your Copilot environment, follow the Copilot [documentation](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp#setting-up-a-copilot-environment-for-copilot-coding-agent). Only secrets with names prefixed with **COPILOT_MCP_** will be available to your MCP configuration.\n\nIn your GitHub repository, navigate under **Settings -> Copilot -> Coding agent**, and add the following configuration in the MCP configuration section:\n\n* To connect with SonarQube Cloud:\n\n```\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"type\": \"local\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--init\",\n        \"--pull=always\",\n        \"--rm\",\n        \"-i\",\n        \"-e\",\n        \"SONARQUBE_TOKEN\",\n        \"-e\",\n        \"SONARQUBE_ORG\",\n        \"sonarsource/sonarqube-mcp\"\n      ],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"COPILOT_MCP_SONARQUBE_TOKEN\",\n        \"SONARQUBE_ORG\": \"COPILOT_MCP_SONARQUBE_ORG\"\n      },\n      \"tools\": [\"*\"]\n    }\n  }\n}\n```\n\nFor **SonarQube Cloud US**, add `\"-e\", \"SONARQUBE_URL\"` to the `args` array and `\"SONARQUBE_URL\": \"COPILOT_MCP_SONARQUBE_URL\"` to the `env` section, then set the secret `COPILOT_MCP_SONARQUBE_URL=https://sonarqube.us`.\n\n* To connect with SonarQube Server:\n\n```\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"type\": \"local\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--init\",\n        \"--pull=always\",\n        \"--rm\",\n        \"-i\",\n        \"-e\",\n        \"SONARQUBE_TOKEN\",\n        \"-e\",\n        \"SONARQUBE_URL\",\n        \"sonarsource/sonarqube-mcp\"\n      ],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"COPILOT_MCP_SONARQUBE_USER_TOKEN\",\n        \"SONARQUBE_URL\": \"COPILOT_MCP_SONARQUBE_URL\"\n      },\n      \"tools\": [\"*\"]\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Kiro</summary>\n\nCreate a `.kiro/settings/mcp.json` file in your workspace directory (or edit if it already exists), add the following configuration:\n\n* To connect with SonarQube Cloud:\n\n```\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--init\",\n        \"--pull=always\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \n        \"SONARQUBE_TOKEN\",\n        \"-e\",\n        \"SONARQUBE_ORG\",\n        \"sonarsource/sonarqube-mcp\"\n      ],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"<YOUR_TOKEN>\",\n        \"SONARQUBE_ORG\": \"<YOUR_ORG>\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": []\n    }\n  }\n}\n```\n\nFor **SonarQube Cloud US**, add `\"-e\", \"SONARQUBE_URL\"` to the `args` array and `\"SONARQUBE_URL\": \"https://sonarqube.us\"` to the `env` section.\n\n* To connect with SonarQube Server:\n\n```\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--init\",\n        \"--pull=always\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \n        \"SONARQUBE_TOKEN\",\n        \"-e\",\n        \"SONARQUBE_URL\",\n        \"sonarsource/sonarqube-mcp\"\n      ],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"<YOUR_USER_TOKEN>\",\n        \"SONARQUBE_URL\": \"<YOUR_SERVER_URL>\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": []\n    }\n  }\n}\n```\n\n</details>\n    \n<details>\n<summary>VS Code</summary>\n\nYou can use the following buttons to simplify the installation process within VS Code.\n\n[![Install for SonarQube Cloud](https://img.shields.io/badge/VS_Code-Install_for_SonarQube_Cloud-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=sonarqube&inputs=%5B%7B%22id%22%3A%22SONARQUBE_TOKEN%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22SonarQube%20Cloud%20Token%22%2C%22password%22%3Atrue%7D%2C%7B%22id%22%3A%22SONARQUBE_ORG%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22SonarQube%20Cloud%20Organization%20Key%22%2C%22password%22%3Afalse%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22--init%22%2C%22--pull%3Dalways%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22SONARQUBE_TOKEN%22%2C%22-e%22%2C%22SONARQUBE_ORG%22%2C%22mcp%2Fsonarqube%22%5D%2C%22env%22%3A%7B%22SONARQUBE_TOKEN%22%3A%22%24%7Binput%3ASONARQUBE_TOKEN%7D%22%2C%22SONARQUBE_ORG%22%3A%22%24%7Binput%3ASONARQUBE_ORG%7D%22%7D%7D)\n\nFor **SonarQube Cloud US**, manually add `\"SONARQUBE_URL\": \"https://sonarqube.us\"` to the `env` section in your MCP configuration after installation.\n\n[![Install for SonarQube Server](https://img.shields.io/badge/VS_Code-Install_for_SonarQube_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=sonarqube&inputs=%5B%7B%22id%22%3A%22SONARQUBE_TOKEN%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22SonarQube%20Server%20User%20Token%22%2C%22password%22%3Atrue%7D%2C%7B%22id%22%3A%22SONARQUBE_URL%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22SonarQube%20Server%20URL%22%2C%22password%22%3Afalse%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22--init%22%2C%22--pull%3Dalways%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22SONARQUBE_TOKEN%22%2C%22-e%22%2C%22SONARQUBE_URL%22%2C%22mcp%2Fsonarqube%22%5D%2C%22env%22%3A%7B%22SONARQUBE_TOKEN%22%3A%22%24%7Binput%3ASONARQUBE_TOKEN%7D%22%2C%22SONARQUBE_URL%22%3A%22%24%7Binput%3ASONARQUBE_URL%7D%22%7D%7D)\n\n</details>\n<details>\n<summary>Windsurf</summary>\n\nSonarQube MCP Server is available as a Windsurf plugin. Follow these instructions:\n\n1. Open Windsurf **Settings** > **Cascade** > **MCP Servers** and select **Open MCP Marketplace** \n2. Search for `sonarqube` on the Cascade MCP Marketplace\n3. Choose the **SonarQube MCP Server** and select **Install**\n4. Add the required SonarQube User token. Then add the organization key if you want to connect with SonarQube Cloud, or the SonarQube URL if you want to connect to SonarQube Server or Community Build.\n\nFor **SonarQube Cloud US**, set the URL to `https://sonarqube.us`.\n\n</details>\n\n<details>\n<summary>Zed</summary>\n\nNavigate to the **Extensions** view in Zed and search for **SonarQube MCP Server**.\nWhen installing the extension, you will be prompted to provide the necessary environment variables:\n\n* When using SonarQube Cloud:\n\n```\n{\n  \"sonarqube_token\": \"YOUR_SONARQUBE_TOKEN\",\n  \"sonarqube_org\": \"SONARQUBE_ORGANIZATION_KEY\",\n  \"docker_path\": \"DOCKER_PATH\"\n}\n```\n\nFor **SonarQube Cloud US**, add `\"sonarqube_url\": \"https://sonarqube.us\"` to the configuration.\n\n* When using SonarQube Server:\n\n```\n{\n  \"sonarqube_token\": \"YOUR_SONARQUBE_USER_TOKEN\",\n  \"sonarqube_url\": \"YOUR_SONARQUBE_SERVER_URL\",\n  \"docker_path\": \"DOCKER_PATH\"\n}\n```\n\nThe `docker_path` is the path to a docker executable. Examples:\n\nLinux/macOS: `/usr/bin/docker` or `/usr/local/bin/docker`\n\nWindows: `C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe`\n\n</details>\n\n> 💡 **Tip:** We recommend pulling the latest image regularly or before reporting issues to ensure you have the most up-to-date features and fixes.\n\n## Manual installation\n\nYou can manually install the SonarQube MCP server by copying the following snippet in the MCP servers configuration file:\n\n* To connect with SonarQube Cloud:\n\n```JSON\n{\n  \"sonarqube\": {\n    \"command\": \"docker\",\n    \"args\": [\n      \"run\",\n      \"--init\",\n      \"--pull=always\",\n      \"-i\",\n      \"--rm\",\n      \"-e\",\n      \"SONARQUBE_TOKEN\",\n      \"-e\",\n      \"SONARQUBE_ORG\",\n      \"sonarsource/sonarqube-mcp\"\n    ],\n    \"env\": {\n      \"SONARQUBE_TOKEN\": \"<token>\",\n      \"SONARQUBE_ORG\": \"<org>\"\n    }\n  }\n}\n```\n\n* To connect with SonarQube Server:\n\n```JSON\n{\n  \"sonarqube\": {\n    \"command\": \"docker\",\n    \"args\": [\n      \"run\",\n      \"--init\",\n      \"--pull=always\",\n      \"-i\",\n      \"--rm\",\n      \"-e\",\n      \"SONARQUBE_TOKEN\",\n      \"-e\",\n      \"SONARQUBE_URL\",\n      \"sonarsource/sonarqube-mcp\"\n    ],\n    \"env\": {\n      \"SONARQUBE_TOKEN\": \"<token>\",\n      \"SONARQUBE_URL\": \"<url>\"\n    }\n  }\n}\n```\n\n## Integration with SonarQube for IDE\n\nThe SonarQube MCP Server can integrate with [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/) to further enhance your development workflow, providing better code analysis and insights directly within your IDE.\n\n<details>\n<summary>Configuration</summary>\n\nWhen using SonarQube for IDE, the `SONARQUBE_IDE_PORT` environment variable should be set with the correct port number. SonarQube for VS Code includes a Quick Install button, which automatically sets the correct port configuration.\n\nFor example, with SonarQube Cloud:\n\n```JSON\n{\n  \"sonarqube\": {\n    \"command\": \"docker\",\n    \"args\": [\n      \"run\",\n      \"--init\",\n      \"--pull=always\",\n      \"-i\",\n      \"--rm\",\n      \"-e\",\n      \"SONARQUBE_TOKEN\",\n      \"-e\",\n      \"SONARQUBE_ORG\",\n      \"-e\",\n      \"SONARQUBE_IDE_PORT\",\n      \"sonarsource/sonarqube-mcp\"\n    ],\n    \"env\": {\n      \"SONARQUBE_TOKEN\": \"<token>\",\n      \"SONARQUBE_ORG\": \"<org>\",\n      \"SONARQUBE_IDE_PORT\": \"<64120-64130>\"\n    }\n  }\n}\n```\n\n> When running the MCP server in a container on Linux, the container cannot access the SonarQube for IDE embedded server running on localhost. To allow the container to connect to the SonarQube for IDE server, add the `--network=host` option to your container run command.\n\n</details>\n\n## Configuration\n\nDepending on your environment, you should provide specific environment variables.\n\n### Base\n\nYou should add the following variable when running the MCP Server:\n\n| Environment variable             | Description                                                                                                                                                                                                                 |\n|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `STORAGE_PATH`                   | Mandatory absolute path to a writable directory where SonarQube MCP Server will store its files (e.g., for creation, updates, and persistence), it is automatically provided when using the container image                 |\n| `SONARQUBE_PROJECT_KEY`          | Optional default project key. When set, all tools that require a project key will use this value automatically — the `projectKey` parameter is removed from their schema entirely. Useful when working on a single project. |\n| `SONARQUBE_IDE_PORT`             | Optional port number between 64120 and 64130 used to connect SonarQube MCP Server with SonarQube for IDE.                                                                                                                   |\n| `SONARQUBE_DEBUG_ENABLED`        | When set to `true`, enables debug logging. Debug logs are written to both the log file and STDERR. Useful for troubleshooting connectivity or configuration issues. Default: `false`.                                       |\n| `SONARQUBE_LOG_TO_FILE_DISABLED` | When set to `true`, disables writing logs to disk entirely. No log files will be created under `STORAGE_PATH/logs/`. Useful in containerized or ephemeral environments where file logging is undesirable. Default: `false`. |\n\n### Workspace Mount (Reducing Context Bloat)\n\nBy default, analysis tool `analyze_code_snippet` requires the agent to pass the full file content as a `fileContent` argument. For large files or when analyzing many files in a session, this significantly increases context window usage and cost.\n\n**Solution:** mount your project directory into the container at `/app/mcp-workspace`. When this mount is detected, the server reads files directly from disk using the project-relative `filePath` argument — file content never passes through the agent context.\n\n```json\n{\n  \"args\": [\n    \"run\", \"-i\", \"--rm\", \"--init\", \"--pull=always\",\n    \"-e\", \"SONARQUBE_TOKEN\",\n    \"-e\", \"SONARQUBE_ORG\",\n    \"-v\", \"/path/to/your/project:/app/mcp-workspace\",\n    \"sonarsource/sonarqube-mcp\"\n  ]\n}\n```\n\nWhen the mount is active:\n- `run_advanced_code_analysis` becomes available if your organization is entitled to it\n- `analyze_code_snippet`: `filePath` is required and `fileContent` is not used — the server resolves the file the same way\n\n### Selective Tool Enablement\n\nBy default, only important toolsets are enabled to reduce context overhead. You can enable additional toolsets as needed.\n\n| Environment variable  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `SONARQUBE_TOOLSETS`  | Comma-separated list of toolsets to enable. When set, only these toolsets will be available. If not set, default important toolsets are enabled (`analysis`, `ide`, `issues`, `projects`, `quality-gates`, `rules`, `duplications`, `measures`, `security-hotspots`, `dependency-risks`, `coverage`, `cag`). **Note:** The `projects` toolset is always enabled as it's required to find project keys for other operations. Vortex context tools (deprecated name: Context Augmentation/CAG) and Vortex analysis tools (deprecated name: Advanced Analysis/A3S) are only available in stdio mode and share a single combined organization entitlement — an org must be entitled to both to use either. On SonarQube Server, stdio lists Vortex context and `run_advanced_code_analysis` when both the CAG and A3S hubs are entitled. Prefer the unified `vortex` toolset key. The deprecated `cag` and `analysis` keys still work; a startup warning and a deprecation note in the server instructions are emitted when they are used without `vortex`. In Streamable HTTP mode, clients can send a `SONARQUBE_TOOLSETS` HTTP header to narrow this further per-request, but cannot enable toolsets beyond what the server was launched with (see [Streamable HTTP transport](#2-http-streamable-http) below). |\n| `SONARQUBE_READ_ONLY` | When set to `true`, enables read-only mode which disables all write operations (changing issue status for example). This filter is cumulative with `SONARQUBE_TOOLSETS` if both are set. Default: `false`. In Streamable HTTP mode, clients can send a `SONARQUBE_READ_ONLY` HTTP header to further restrict individual requests to read-only, but cannot lift a server-level read-only restriction (see [Streamable HTTP transport](#2-http-streamable-http) below).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n\n<details>\n<summary>Available Toolsets</summary>\n\n| Toolset               | Key                 | Description                                                                                                                                                 |\n|-----------------------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Analysis**          | `analysis`          | Code analysis tools (local analysis via `analyze_code_snippet`, **deprecated** in favor of `analyze_file_list`/Vortex analysis)                                                                      |\n| **IDE**               | `ide`               | SonarQube for IDE bridge tools (file analysis, automatic analysis toggle) — currently also included in `analysis`                                           |\n| **Issues**            | `issues`            | Search and manage SonarQube issues                                                                                                                          |\n| **Security Hotspots** | `security-hotspots` | Search and review Security Hotspots                                                                                                                         |\n| **Projects**          | `projects`          | Browse and search SonarQube projects                                                                                                                        |\n| **Quality Gates**     | `quality-gates`     | Access quality gates and their status                                                                                                                       |\n| **Rules**             | `rules`             | Browse and search SonarQube rules                                                                                                                           |\n| **Sources**           | `sources`           | Access source code and SCM information                                                                                                                      |\n| **Duplications**      | `duplications`      | Find code duplications across projects                                                                                                                      |\n| **Measures**          | `measures`          | Retrieve metrics and measures (includes both measures and metrics tools)                                                                                    |\n| **Languages**         | `languages`         | List supported programming languages                                                                                                                        |\n| **Portfolios**        | `portfolios`        | Manage portfolios and enterprises (Cloud and Server)                                                                                                        |\n| **System**            | `system`            | System administration tools (Server only)                                                                                                                   |\n| **Webhooks**          | `webhooks`          | Manage webhooks                                                                                                                                             |\n| **Dependency Risks**  | `dependency-risks`  | Analyze dependency risks and security issues (SCA)                                                                                                          |\n| **Coverage**          | `coverage`          | Test coverage analysis and improvement tools                                                                                                                |\n| **Vortex Context**    | `cag`               | Vortex context tools — stdio only. **Deprecated** in favor of `vortex` (old name: Context Augmentation/CAG)                                                 |\n| **Vortex**            | `vortex`            | Unified, **recommended** toolset surfacing both Vortex context and Vortex analysis tools under one name (stdio only; Cloud needs combined org entitlement; Server needs both hubs entitled) |\n| **Agentic Readiness** | `agentic-readiness` | Agentic Readiness Assessment tools (SonarQube Cloud, requires org entitlement)                                                                              |\n\n#### Examples\n\n**Enable analysis, issues, and quality gates toolsets (using Docker with SonarQube Cloud):**\n\n```bash\ndocker run --init --pull=always -i --rm \\\n  -e SONARQUBE_TOKEN=\"<token>\" \\\n  -e SONARQUBE_ORG=\"<org>\" \\\n  -e SONARQUBE_TOOLSETS=\"analysis,issues,quality-gates\" \\\n  sonarsource/sonarqube-mcp\n```\n\nNote: The `projects` toolset is always enabled automatically, so you don't need to include it in `SONARQUBE_TOOLSETS`.\n\n**Enable read-only mode (using Docker with SonarQube Cloud):**\n\n```bash\ndocker run --init --pull=always -i --rm \\\n  -e SONARQUBE_TOKEN=\"<token>\" \\\n  -e SONARQUBE_ORG=\"<org>\" \\\n  -e SONARQUBE_READ_ONLY=\"true\" \\\n  sonarsource/sonarqube-mcp\n```\n\n</details>\n\n#### SonarQube Cloud\n\nTo enable full functionality, the following environment variables must be set before starting the server:\n\n| Environment variable  | Description                                                                                                               | Required |\n|-----------------------|---------------------------------------------------------------------------------------------------------------------------|----------|\n| `SONARQUBE_TOKEN`     | Your SonarQube Cloud [token](https://docs.sonarsource.com/sonarqube-cloud/managing-your-account/managing-tokens/)         | Yes      |\n| `SONARQUBE_ORG`       | Your SonarQube Cloud organization [key](https://sonarcloud.io/account/organizations)                                      | Yes      |\n| `SONARQUBE_URL`       | Custom SonarQube Cloud URL (defaults to `https://sonarcloud.io`). Use this for SonarQube Cloud US: `https://sonarqube.us` | No       |\n\n**Examples:**\n\n- **SonarQube Cloud**: Only `SONARQUBE_TOKEN` and `SONARQUBE_ORG` are needed\n- **SonarQube Cloud US**: Set `SONARQUBE_TOKEN`, `SONARQUBE_ORG`, and `SONARQUBE_URL=https://sonarqube.us`\n\n#### SonarQube Server\n\n| Environment variable | Description                                                                                                                                 | Required |\n|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------|----------|\n| `SONARQUBE_TOKEN`     | Your SonarQube Server **USER** [token](https://docs.sonarsource.com/sonarqube-server/latest/user-guide/managing-tokens/#generating-a-token) | Yes      |\n| `SONARQUBE_URL`       | Your SonarQube Server URL                                                                                                                   | Yes      |\n\n> ⚠️ Connection to SonarQube Server requires a token of type **USER** and will not function properly if project tokens or global tokens are used.\n\n> 💡 **Configuration Tip (stdio mode)**: The presence of `SONARQUBE_ORG` determines whether you're connecting to SonarQube Cloud or Server. If `SONARQUBE_ORG` is set, SonarQube Cloud is used; otherwise, SonarQube Server is used.\n\n### Transport Modes\n\nThe [MCP specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports) defines two transport mechanisms: **Stdio** and **Streamable HTTP**. The SonarQube MCP Server supports both:\n\n| MCP transport       | Server mode                           | Typical use                                                                                                            |\n|---------------------|---------------------------------------|------------------------------------------------------------------------------------------------------------------------|\n| **Stdio**           | Default (no `SONARQUBE_TRANSPORT`)    | Local MCP clients that launch the server as a subprocess (Cursor, Claude Code, VS Code, etc.)                          |\n| **Streamable HTTP** | `SONARQUBE_TRANSPORT=http` or `https` | Remote or multi-user deployments; clients connect to `/mcp` over HTTP(S) (e.g. Windsurf with a self-hosted server URL) |\n\n> **Note:** **Streamable HTTP** is the current MCP network transport. The older SSE-only HTTP transport from earlier MCP versions is deprecated and not supported.\n\n#### 1. **Stdio** (Default - Recommended for Local Development)\nThe recommended mode for local development and single-user setups, used by most MCP clients.\n\n**Example - Docker with SonarQube Cloud:**\n```json\n{\n  \"mcpServers\": {\n    \"sonarqube\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"--init\", \"--pull=always\", \"-i\", \"--rm\", \"-e\", \"SONARQUBE_TOKEN\", \"-e\", \"SONARQUBE_ORG\", \"sonarsource/sonarqube-mcp\"],\n      \"env\": {\n        \"SONARQUBE_TOKEN\": \"<your-token>\",\n        \"SONARQUBE_ORG\": \"<your-org>\"\n      }\n    }\n  }\n}\n```\n\n#### 2. **HTTP (Streamable HTTP)**\nUnencrypted Streamable HTTP transport. Use HTTPS instead for multi-user deployments.\n\n> ⚠️ **Not Recommended:** Use **Stdio** for local development or **HTTPS (Streamable HTTP)** for multi-user production deployments.\n\n| Environment variable | Description                                                      | Default         |\n|----------------------|------------------------------------------------------------------|-----------------|\n| `SONARQUBE_TRANSPORT`| Set to `http` to enable Streamable HTTP transport                  | Not set (stdio) |\n| `SONARQUBE_HTTP_PORT`| Port number (1024-65535)                                         | `8080`          |\n| `SONARQUBE_HTTP_HOST`| Host to bind (defaults to localhost for security)                | `127.0.0.1`     |\n| `SONARQUBE_HTTP_ALLOWED_ORIGINS` | Comma-separated browser origins allowed for CORS (e.g. `https://my-app.example.com`) | Not set |\n| `SONARQUBE_MCP_IN_CONTAINER` | Set to `true` when running inside a container. The official Docker image sets this automatically; set it yourself when using other OCI runtimes (Podman, Kubernetes, Nomad, etc.). | `false` |\n\n**Note:** In Streamable HTTP mode (HTTP or HTTPS), the server is stateless — each client request must include an `Authorization: Bearer <token>` header carrying the user's own SonarQube token. For SonarQube Cloud, the organization is resolved as follows:\n- If `SONARQUBE_ORG` is set at server startup, all requests are routed to that organization. Clients must **not** send a `SONARQUBE_ORG` header — doing so will result in an error.\n- If `SONARQUBE_ORG` is not set at server startup, each client **must** supply a `SONARQUBE_ORG` header on every request.\nClients can also narrow the visible tools per-request by supplying `SONARQUBE_TOOLSETS` and/or `SONARQUBE_READ_ONLY` headers; these apply additional filtering on top of the server-level configuration — they can only reduce the scope, never expand it.\nNo session state is maintained between requests.\n\n> **Deprecated:** The `SONARQUBE_TOKEN` request header is still accepted for backward compatibility but will be removed in a future version. Migrate to `Authorization: Bearer <token>`.\n\n#### 3. **HTTPS (Streamable HTTP over TLS)** (Recommended for Multi-User Production Deployments)\nSecure Streamable HTTP transport with TLS encryption. Requires SSL certificates.\n\n> ✅ **Recommended for Production:** Use HTTPS when deploying the MCP server for multiple users over Streamable HTTP. The server binds to `127.0.0.1` (localhost) by default for security.\n\n| Environment variable             | Description                                                                                                                                                                        | Default         |\n|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|\n| `SONARQUBE_TRANSPORT`            | Set to `https` to enable Streamable HTTP transport over TLS       | Not set (stdio) |\n| `SONARQUBE_HTTP_PORT`            | Port number (typically 8443 for HTTPS)                                                                                                                                             | `8080`          |\n| `SONARQUBE_HTTP_HOST`            | Host to bind (defaults to localhost for security)                                                                                                                                  | `127.0.0.1`     |\n| `SONARQUBE_HTTP_ALLOWED_ORIGINS` | Comma-separated browser origins allowed for CORS (e.g. `https://my-app.example.com`)                                                                                               | Not set         |\n| `SONARQUBE_MCP_IN_CONTAINER`     | Set to `true` when running inside a container. The official Docker image sets this automatically; set it yourself when using other OCI runtimes (Podman, Kubernetes, Nomad, etc.). | `false`         |\n\n**SSL Certificate Configuration (Optional):**\n\n| Environment variable | Description                                    | Default                     |\n|----------------------|------------------------------------------------|-----------------------------|\n| `SONARQUBE_HTTPS_KEYSTORE_PATH`    | Path to keystore file (.p12 or .jks) | `/etc/ssl/mcp/keystore.p12` |\n| `SONARQUBE_HTTPS_KEYSTORE_PASSWORD`| Keystore password                     | `sonarlint`                 |\n| `SONARQUBE_HTTPS_KEYSTORE_TYPE`    | Keystore type (PKCS12 or JKS)        | `PKCS12`                    |\n\n**Example - Docker with SonarQube Cloud:**\n\n> **Note:** When running in a container, set `SONARQUBE_HTTP_HOST=0.0.0.0` so the container listens on all interfaces and the runtime's port mapping works, and set `SONARQUBE_MCP_IN_CONTAINER=true` to tell the server it is inside a container. The official Docker image sets the latter automatically; set it yourself when using other OCI runtimes (Podman, Kubernetes, Nomad, etc.). The host-side port flag controls who can reach the server from outside the container. `SONARQUBE_HTTP_HOST=0.0.0.0` only controls where the server listens inside the container — browser CORS still allows localhost origins by default.\n\nFor a server running **locally on your machine** (accessible only from localhost):\n```bash\ndocker run --init --pull=always -p 127.0.0.1:8443:8443 \\\n  -v $(pwd)/keystore.p12:/etc/ssl/mcp/keystore.p12:ro \\\n  -e SONARQUBE_TRANSPORT=https \\\n  -e SONARQUBE_HTTP_HOST=0.0.0.0 \\\n  -e SONARQUBE_HTTP_PORT=8443 \\\n  -e SONARQUBE_TOKEN=\"<init-token>\" \\\n  -e SONARQUBE_ORG=\"<your-org>\" \\\n  sonarsource/sonarqube-mcp\n```\n\nFor a server **accessible from the network** (remote deployments):\n```bash\ndocker run --init --pull=always -p 8443:8443 \\\n  -v $(pwd)/keystore.p12:/etc/ssl/mcp/keystore.p12:ro \\\n  -e SONARQUBE_TRANSPORT=https \\\n  -e SONARQUBE_HTTP_HOST=0.0.0.0 \\\n  -e SONARQUBE_HTTP_PORT=8443 \\\n  -e SONARQUBE_TOKEN=\"<init-token>\" \\\n  -e SONARQUBE_ORG=\"<your-org>\" \\\n  sonarsource/sonarqube-mcp\n```\n\n**Client Configuration (SonarQube Cloud):**\n```json\n{\n  \"mcpServers\": {\n    \"sonarqube-https\": {\n      \"url\": \"https://your-server:8443/mcp\",\n      \"headers\": {\n        \"Authorization\": \"Bearer <your-token>\",\n        \"SONARQUBE_ORG\": \"<your-org>\",\n        \"SONARQUBE_TOOLSETS\": \"issues,quality-gates\",\n        \"SONARQUBE_READ_ONLY\": \"true\"\n      }\n    }\n  }\n}\n```\n\n**Client Configuration (SonarQube Server):**\n```json\n{\n  \"mcpServers\": {\n    \"sonarqube-https\": {\n      \"url\": \"https://your-server:8443/mcp\",\n      \"headers\": {\n        \"Authorization\": \"Bearer <your-token>\",\n        \"SONARQUBE_TOOLSETS\": \"issues,quality-gates\",\n        \"SONARQUBE_READ_ONLY\": \"true\"\n      }\n    }\n  }\n}\n```\n\n> **Note:** `SONARQUBE_TOOLSETS` and `SONARQUBE_READ_ONLY` are optional per-request headers that narrow the server-level tool set for that specific request. They can only reduce scope — they cannot enable toolsets or lift restrictions beyond what the server was launched with.\n\n**Note:** For local development, use Stdio transport instead (the default). HTTPS Streamable HTTP is intended for multi-user production deployments with proper SSL certificates.\n\n#### Service Endpoints\n\nWhen running in **Streamable HTTP** mode (`http` or `https`), the server exposes a few unauthenticated service endpoints in addition to the MCP endpoint at `/mcp`. These are intended for service-to-service use (monitoring, orchestration, client compatibility checks) and do not require an `Authorization` header.\n\n| Endpoint  | Method | Description                                                                                   | Example response                  |\n|-----------|--------|-----------------------------------------------------------------------------------------------|-----------------------------------|\n| `/health` | `GET`  | Liveness probe. Returns `200 OK` with an empty body once the server is accepting requests.    | *(empty body)*                    |\n| `/info`   | `GET`  | Returns the MCP server version as JSON. Useful for verifying the deployed server version.     | `{\"version\":\"1.16.0\"}`            |\n\nThese endpoints are not available when running with the **Stdio** transport.\n\n### Custom Certificates\n\nIf your SonarQube Server uses a self-signed certificate or a certificate from a private Certificate Authority (CA), you can add custom certificates to the container that will automatically be installed.\n\n<details>\n<summary>Configuration</summary>\n\n#### Using Volume Mount\n\nMount a directory containing your certificates when running the container:\n\n```bash\ndocker run --init --pull=always -i --rm \\\n  -v /path/to/your/certificates/:/usr/local/share/ca-certificates/:ro \\\n  -e SONARQUBE_TOKEN=\"<token>\" \\\n  -e SONARQUBE_URL=\"<url>\" \\\n  sonarsource/sonarqube-mcp\n```\n\n#### Supported Certificate Formats\n\nThe container supports the following certificate formats:\n- `.crt` files (PEM or DER encoded)\n- `.pem` files (PEM encoded)\n\n#### MCP Configuration with Certificates\n\nWhen using custom certificates, you can modify your MCP configuration to mount the certificates:\n\n```JSON\n{\n  \"sonarqube\": {\n    \"command\": \"docker\",\n    \"args\": [\n      \"run\",\n      \"--init\",\n      \"--pull=always\",\n      \"-i\",\n      \"--rm\",\n      \"-v\",\n      \"/path/to/your/certificates/:/usr/local/share/ca-certificates/:ro\",\n      \"-e\",\n      \"SONARQUBE_TOKEN\",\n      \"-e\",\n      \"SONARQUBE_URL\",\n      \"sonarsource/sonarqube-mcp\"\n    ],\n    \"env\": {\n      \"SONARQUBE_TOKEN\": \"<token>\",\n      \"SONARQUBE_URL\": \"<url>\"\n    }\n  }\n}\n```\n\n> **Note:** Running the server [from a JAR](#build) instead of the container? The volume mount above installs certificates into the container's OS trust store, which the server also reads. If you cannot use the OS trust store — notably on Windows, where it is not consulted — point the JVM at a Java truststore holding the CA certificate: `-Djavax.net.ssl.trustStore=/path/to/truststore.p12 -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=<passphrase>`. It is added on top of the default trusted certificates.\n\n</details>\n\n### Proxy\n\nThe SonarQube MCP Server supports HTTP and SOCKS5 proxies through standard Java proxy system properties.\n\n<details>\n<summary>Configuration</summary>\n\n#### HTTP/HTTPS Proxy\n\nYou can configure proxy settings using Java system properties. These can be set as environment variables or passed as JVM arguments.\n\n**Common Proxy Properties:**\n\n| Property | Description | Example |\n|----------|-------------|---------|\n| `http.proxyHost` | HTTP proxy hostname | `proxy.example.com` |\n| `http.proxyPort` | HTTP proxy port | `8080` |\n| `https.proxyHost` | HTTPS proxy hostname | `proxy.example.com` |\n| `https.proxyPort` | HTTPS proxy port | `8443` |\n| `http.nonProxyHosts` | Hosts that bypass the proxy (pipe-separated) | `localhost\\|127.0.0.1\\|*.internal.com` |\n\n**HTTP/HTTPS Proxy Authentication:**\n\n| Property | Description | Example |\n|----------|-------------|---------|\n| `http.proxyUser` | HTTP proxy username | `myuser` |\n| `http.proxyPassword` | HTTP proxy password | `mypassword` |\n| `https.proxyUser` | HTTPS proxy username | `myuser` |\n| `https.proxyPassword` | HTTPS proxy password | `mypassword` |\n\n#### SOCKS5 Proxy\n\nSOCKS5 proxies are supported.\n\n| Property                  | Description                        | Default | Example      |\n|---------------------------|------------------------------------|---------|--------------|\n| `socksProxyHost`          | SOCKS5 proxy hostname              | —       | `localhost`  |\n| `socksProxyPort`          | SOCKS5 proxy port                  | `1080`  | `1080`       |\n| `java.net.socks.username` | SOCKS5 username (if auth required) | —       | `myuser`     |\n| `java.net.socks.password` | SOCKS5 password (if auth required) | —       | `mypassword` |\n\n</details>\n\n### Client Certificate (Mutual TLS)\n\nIf your SonarQube Server requires clients to present a certificate during the TLS handshake (mutual TLS), you can provide a PKCS12 keystore by mounting it into the container and passing its location via `JAVA_OPTS`.\n\n<details>\n<summary>Configuration</summary>\n\n#### Using a PKCS12 keystore\n\nMount your `.p12` or `.pfx` file into the container and set the `JAVA_OPTS` environment variable with the keystore properties:\n\n```bash\ndocker run --init --pull=always -i --rm \\\n  -v /path/to/client.p12:/etc/ssl/mcp/client.p12:ro \\\n  -e JAVA_OPTS=\"-Djavax.net.ssl.keyStore=/etc/ssl/mcp/client.p12 -Djavax.net.ssl.keyStoreType=PKCS12 -Djavax.net.ssl.keyStorePassword=<passphrase>\" \\\n  -e SONARQUBE_TOKEN=\"<token>\" \\\n  -e SONARQUBE_URL=\"<url>\" \\\n  sonarsource/sonarqube-mcp\n```\n\n> **Note:** The certificate file must be readable by the container process. Check and fix permissions if needed:\n> ```bash\n> ls -la /path/to/client.p12       # look for -rw-r--r-- (644) or wider\n> chmod 644 /path/to/client.p12    # grant read access to the container user\n> ```\n\nOmit `-Djavax.net.ssl.keyStorePassword` if the keystore has no passphrase. Note that the passphrase used here would be visible through `docker inspect` or process list.\n\n#### MCP Configuration with a Client Certificate\n\n```json\n{\n  \"sonarqube\": {\n    \"command\": \"docker\",\n    \"args\": [\n      \"run\", \"--init\", \"--pull=always\", \"-i\", \"--rm\",\n      \"-v\", \"/path/to/client.p12:/etc/ssl/mcp/client.p12:ro\",\n      \"-e\", \"JAVA_OPTS\",\n      \"-e\", \"SONARQUBE_TOKEN\",\n      \"-e\", \"SONARQUBE_URL\",\n      \"sonarsource/sonarqube-mcp\"\n    ],\n    \"env\": {\n      \"JAVA_OPTS\": \"-Djavax.net.ssl.keyStore=/etc/ssl/mcp/client.p12 -Djavax.net.ssl.keyStoreType=PKCS12 -Djavax.net.ssl.keyStorePassword=<passphrase>\",\n      \"SONARQUBE_TOKEN\": \"<token>\",\n      \"SONARQUBE_URL\": \"<url>\"\n    }\n  }\n}\n```\n\n#### Using a PKCS12 keystore with a standalone JAR\n\nWhen running the server [from a JAR](#build), pass the keystore properties as JVM arguments before `-jar`:\n\n```bash\njava \\\n  -Djavax.net.ssl.keyStore=/path/to/client.p12 \\\n  -Djavax.net.ssl.keyStoreType=PKCS12 \\\n  -Djavax.net.ssl.keyStorePassword=<passphrase> \\\n  -jar <path_to_sonarqube_mcp_server_jar>\n```\n\nOmit `-Djavax.net.ssl.keyStorePassword` if the keystore has no passphrase.\n\n#### MCP Configuration with a Client Certificate (JAR)\n\n```json\n{\n  \"sonarqube\": {\n    \"command\": \"java\",\n    \"args\": [\n      \"-Djavax.net.ssl.keyStore=/path/to/client.p12\",\n      \"-Djavax.net.ssl.keyStoreType=PKCS12\",\n      \"-Djavax.net.ssl.keyStorePassword=<passphrase>\",\n      \"-jar\",\n      \"<path_to_sonarqube_mcp_server_jar>\"\n    ],\n    \"env\": {\n      \"SONARQUBE_TOKEN\": \"<token>\",\n      \"SONARQUBE_URL\": \"<url>\"\n    }\n  }\n}\n```\n\n> **Note:** PEM certificate and key files (separate `.crt`/`.key` files) must be converted to PKCS12 format first. Use `openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12` to convert them.\n\n</details>\n\n## Tools\n\n### Analysis\n\n- **analyze_code_snippet** - Analyze file content with SonarQube analyzers to identify code quality and security issues. Always analyzes the complete file content for accuracy. Optionally filter results to a specific code snippet.\n\n  > **Deprecated:** `analyze_code_snippet` will be removed in a future release. Connect SonarQube for IDE to use `analyze_file_list`, or enable Vortex analysis for your organization to use `run_advanced_code_analysis` (see below).\n  \n  Usage:\n  - **With workspace mounted** (recommended): pass `filePath` (project-relative) — the server reads the file directly, keeping file content out of the agent context window\n  - **Without workspace mount**: pass complete `fileContent` for full file analysis (reports all issues)\n  - Add optional `codeSnippet` to filter results - only issues within the snippet will be reported (snippet location auto-detected)\n  \n  Parameters:\n  - `projectKey` - The SonarQube project key - _Required String_ _(Ignored when `SONARQUBE_PROJECT_KEY` is defined)_\n  - `filePath` - Project-relative path of the file to analyze (e.g., `src/main/java/MyClass.java`). Used when the workspace is mounted at `/app/mcp-workspace` - _String_\n  - `fileContent` - Complete file content as a string. Required when workspace is not mounted - _String_\n  - `codeSnippet` - Code snippet to filter issues (must match content in fileContent) - _String_\n  - `language` - Language of the code (e.g., 'java', 'python', 'js', 'ts', 'tsx', 'jsx') - _String_\n  - `scope` - Scope of the file: MAIN or TEST (default: MAIN) - _String_\n  \n  **Supported Languages:** Java, Kotlin, Python, Ruby, Go, JavaScript (`js`, `jsx`), TypeScript (`ts`, `tsx`), JSP, PHP, XML, HTML, CSS, CloudFormation, Kubernetes, Terraform, Azure Resource Manager, Ansible, Docker, Secrets detection\n\n**When integration with SonarQube for IDE is enabled:** _(these two tools are tagged under both the `analysis` and `ide` toolsets)_\n- **analyze_file_list** - Analyze files in the current working directory using SonarQube for IDE. This tool connects to a running SonarQube for IDE instance to perform code quality analysis on a list of files.\n    - `file_absolute_paths` - List of absolute file paths to analyze - _Required String[]_\n\n\n- **toggle_automatic_analysis** - Enable or disable SonarQube for IDE automatic analysis. When enabled, SonarQube for IDE will automatically analyze files as they are modified in the working directory. When disabled, automatic analysis is turned off.\n    - `enabled` - Enable or disable the automatic analysis - _Required Boolean_\n\nOn SonarQube Server, stdio lists Vortex context tools and `run_advanced_code_analysis` when both the CAG and A3S hubs are entitled.\n\n**When Vortex analysis is enabled**:\n\n> Requires having the workspace mounted at `/app/mcp-workspace`\n\n- **run_advanced_code_analysis** - Run Vortex analysis on a single file. Organization is inferred from MCP configuration (SonarQube Server uses the nil UUID placeholder).\n    - `projectKey` - The key of the project - _Required String_ _(Ignored when `SONARQUBE_PROJECT_KEY` is defined)_\n    - `branch` - Branch name used to retrieve the latest analysis context - _Required String_\n    - `filePath` - Project-relative path of the file to analyze (e.g., `src/main/java/MyClass.java`). - _Required String_\n    - `fileScope` - Defines in which scope the file originates from: 'MAIN' or 'TEST' (default: MAIN) - _String_\n\n### Coverage\n\n- **search_files_by_coverage** - Search for files in a project sorted by coverage (ascending - worst coverage first). This tool helps identify files that need test coverage improvements.\n  - `projectKey` - The project key to search in - _Required String_ _(Ignored when `SONARQUBE_PROJECT_KEY` is defined)_\n  - `branch` - Optional branch name for branch-based analysis. Use `list_branches` to discover valid names - _String_\n  - `pullRequest` - Optional pull request key/ID. Use `list_pull_requests` to discover valid keys - _String_\n  - `maxCoverage` - Maximum coverage threshold (0-100). Only return files with coverage <= this value - _Number_\n  - `pageIndex` - Page index (1-based, default: 1) - _Number_\n  - `pageSize` - Page size (default: 100, max: 500) - _Number_\n\n\n- **get_file_coverage_details** - Get line-by-line coverage information for a specific file, including which exact lines are uncovered and which have partially covered branches. This tool helps identify precisely where to add test coverage. Use after identifying files with low coverage via search_files_by_coverage.\n  - `key` - File key (e.g. my_project:src/foo/Bar.java) - _Required String_\n  - `branch` - Optional branch name for branch-based analysis. Use `list_branches` to discover valid names - _String_\n  - `pullRequest` - Optional pull request key/ID. Use `list_pull_requests` to discover valid keys - _String_\n  - `from` - First line to analyze (1-based, default: 1) - _Number_\n  - `to` - Last line to analyze (inclusive). If not specified, all lines are returned - _Number_\n\n### Dependency Risks\n\n**Note: Dependency risks are only available when connecting to SonarQube Server 2025.4 Enterprise or higher with SonarQube Advanced Security enabled.**\n\n- **search_dependency_risks** - Search for software composition analysis issues (dependency risks) of a SonarQube project, paired with releases that appear in the analyzed project, application, or portfolio.\n  - `projectKey` - Project key - _Required String_ _(Ignored when `SONARQUBE_PROJECT_KEY` is defined)_\n  - `branch` - Optional branch name for branch-based analysis. Use `list_branches` to discover valid names - _String_\n  - `pullRequest` - Optional pull request key/ID. Use `list_pull_requests` to discover valid keys - _String_\n  - `pageIndex` - Optional page index (1-based, default: 1) - _Integer_\n  - `pageSize` - Optional page size. Must be greater than 0 and less than or equal to 500 (default: 100) - _Integer_\n\n### Enterprises\n\n**Note: Enterprises are only available when connecting to SonarQube Cloud.**\n\n- **list_enterprises** - List the enterprises available in SonarQube Cloud that you have access to. Use this tool to discover enterprise IDs that can be used with other tools.\n    - `enterpriseKey` - Optional enterprise key to filter results - _String_\n\n### Issues\n\n- **change_sonar_issue_status** - Change the status of a SonarQube issue to \"accept\", \"falsepositive\" or to \"reopen\" an issue.\n  - `key` - Issue key - _Required String_\n  - `status` - New issue's status - _Required Enum {\"accept\", \"falsepositive\", \"reopen\"}_\n  - `comment` - Optional comment explaining the status change - _String_\n\n\n- **search_sonar_issues_in_projects** - Search for SonarQube issues in my organization's projects.\n  - `projectKeys` - Optional list of SonarQube project keys - _String[]_\n  - `branch` - Optional branch name for branch-based analysis. Use `list_branches` to discover valid names - _String_\n  - `pullRequest` - Optional pull request key/ID. Use `list_pull_requests` to discover valid keys - _String_\n  - `severities` - Optional list of severities to filter by. Possible values: INFO, LOW, MEDIUM, HIGH, BLOCKER - _String[]_\n  - `impactSoftwareQualities` - Optional list of software qualities to filter by. Possible values: MAINTAINABILITY, RELIABILITY, SECURITY - _String[]_\n  - `issueStatuses` - Optional list of issue statuses to filter by. Possible values: OPEN, CONFIRMED, FALSE_POSITIVE, ACCEPTED, FIXED, IN_SANDBOX - _String[]_\n  - `inNewCodePeriod` - Only return issues in the new code period. Requires exactly one entry across `projectKeys` and `files` - _Boolean_\n  - `issueKey` - Optional issue key to fetch a specific issue - _String_\n  - `pageIndex` - Optional 1-based page index (default: 1) - _Integer_\n  - `pageSize` - Optional page size. Must be greater than 0 and less than or equal to 500 (default: 100) - _Integer_\n\n### Security Hotspots\n\n- **search_security_hotspots** - Search for Security Hotspots in a SonarQube project.\n  - `projectKey` - Project or application key - _Required String_ _(Ignored when `SONARQUBE_PROJECT_KEY` is defined)_\n  - `hotspotKeys` - Comma-separated list of specific Security Hotspot keys to retrieve - _String[]_\n  - `branch` - Optional branch name for branch-based analysis. Use `list_branches` to discover valid names - _String_\n  - `pullRequest` - Optional pull request key/ID. Use `list_pull_requests` to discover valid keys - _String_\n  - `files` - Optional list of file paths to filter - _String[]_\n  - `status` - Optional status filter: TO_REVIEW, REVIEWED - _String_\n  - `resolution` - Optional resolution filter: FIXED, SAFE, ACKNOWLEDGED - _String_\n  - `sinceLeakPeriod` - Filter hotspots created since the leak period (new code) - _Boolean_\n  - `onlyMine` - Show only hotspots assigned to me - _Boolean_\n  - `pageIndex` - Optional 1-based page index (default: 1) - _Integer_\n  - `pageSize` - Optional page size. Must be greater than 0 and less than or equal to 500 (default: 100) - _Integer_\n\n\n- **show_security_hotspot** - Get detailed information about a specific Security Hotspot, including rule details, code context, flows, and comments.\n  - `hotspotKey` - Security Hotspot key - _Required String_\n\n\n- **change_security_hotspot_status** - Review a Security Hotspot by changing its status. When marking as REVIEWED, you must specify a resolution (FIXED, SAFE, or ACKNOWLEDGED).\n  - `hotspotKey` - Security Hotspot key - _Required String_\n  - `status` - New status - _Required Enum {\"TO_REVIEW\", \"REVIEWED\"}_\n  - `resolution` - Resolution when status is REVIEWED - _Enum {\"FIXED\", \"SAFE\", \"ACKNOWLEDGED\"}_\n  - `comment` - Optional review comment - _String_\n\n### Languages\n\n- **list_languages** - List all programming languages supported in this SonarQube instance.\n    - `q` - Optional pattern to match language keys/names against - _String_\n\n### Measures\n\n- **get_component_measures** - Get SonarQube measures for a component (project, directory, file).\n  - `projectKey` - The project key - _Required String when `SONARQUBE_PROJECT_KEY` is not configured_\n  - `branch` - Optional branch name for branch-based analysis. Use `list_branches` to discover valid names - _String_\n  - `metricKeys` - Optional metric keys to retrieve (e.g. ncloc, complexity, violations, coverage) - _String[]_\n  - `pullRequest` - Optional pull request key/ID. Use `list_pull_requests` to discover valid keys - _String_\n\n### Metrics\n\n- **search_metrics** - Search for SonarQube met",
  "bytes": 60000,
  "sha": "947366b8ca39e3ad9eac776111f2622e1bac7758dad2d5508469554b2b2ca34d",
  "repo_slug": "sonarsource/sonarqube-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_sonarsource_sonarqube_mcp_serv_61ed67b2/readme"
}