For the complete documentation index, see llms.txt. This page is also available as Markdown.

GitHub Copilot cloud agent

Set up the SonarQube MCP Server with the GitHub Copilot cloud agent and start using Sonar tools in your CI/CD environment.

The GitHub Copilot cloud agent is an autonomous AI agent that operates inside your GitHub repository and CI/CD environment. Use this MCP server setup when you want Sonar tools available to the cloud agent during pull request workflows and automated tasks.

If you're setting up the SonarQube agent through GitHub agent apps, see Set up the SonarQube agent through GitHub agent apps instead.

Choose your setup

The SonarQube MCP Server lets an AI agent query your SonarQube projects. With it, the GitHub Copilot cloud agent can look up issues, quality gates, and coverage while it works. You can use the SonarQube Cloud-hosted or SonarQube Server-hosted MCP server, or run your own. Choose how to connect:

Option
Is best for
What you get
Who sets it up

SonarQube Cloud users

Nothing to install and a smaller, fixed subset of tools. No Sonar Vortex.

You connect

SonarQube Server 2026.3 and later (Developer, Enterprise, and Data Center editions)

Nothing to install on your machine. No Sonar Vortex.

An administrator installs it, and then you connect

Full control

The MCP server that you run yourself, with the Sonar Vortex analysis and context tools through the Stdio transport

You

The configuration generator gives you a snippet to paste into the MCP configuration section of the Copilot Cloud agent settings in your GitHub repository.

Connect to a SonarQube-hosted MCP server

To avoid running and maintaining your own MCP infrastructure while always using the current server version, connect to a SonarQube-hosted MCP server:

Neither the SonarQube Cloud-hosted nor the SonarQube Server-hosted option supports Sonar Vortex, which requires local filesystem access. Sonar Vortex is not installed by a plugin or the SonarQube CLI for the GitHub Copilot cloud agent. To use it, set up a self-hosted MCP server. See Vortex with the MCP server.

To get the connection snippet for either option, use the configuration generator and select the matching hosting method.

Set up a self-hosted MCP server

A self-hosted MCP server runs on your machine or in your own environment, and you manage it yourself.

Before you start

The cloud agent uses GitHub repository or organization secrets to supply environment variables to the MCP server. Only secrets with names prefixed with COPILOT_MCP_ are available to your MCP configuration.

To add the required secrets to your repository, navigate to Settings > Secrets and variables > Agents > Secrets > New repository secret. Create one secret per environment variable your MCP server needs. To make the secrets available across all repositories in your organization, add them at the organization's Settings > Secrets and variables > Agents > Secrets > New organization secret instead.

The following common variables apply, stored as COPILOT_MCP_-prefixed secrets:

  • SONARQUBE_TOKEN (stored as COPILOT_MCP_SONARQUBE_TOKEN): Your SonarQube user token (stdio transport).

  • SONARQUBE_ORG (stored as COPILOT_MCP_SONARQUBE_ORG): Optional SonarQube Cloud organization key. When set, it fixes the organization. See SONARQUBE_ORG.

  • SONARQUBE_URL (stored as COPILOT_MCP_SONARQUBE_URL): Your SonarQube Server or SonarQube Community Build URL. Also required for SonarQube Cloud in the US region (https://sonarqube.us). Not needed for SonarQube Cloud in the EU region.

Warning: User tokens are required when setting up connected mode or your SonarQube MCP server with SonarQube (Server, Cloud). Your binding will not function properly if you use project tokens, global tokens, or scoped organization tokens during setup.

When using these features, your SONARQUBE_TOKEN lets your local MCP server configured for Stdio mode authenticate to the SonarQube Cloud API. See Sonar Vortex analysis and Sonar Vortex context for more information.

Configure manually

The SonarQube MCP Server supports three transport modes. Use Stdio for local development and most use cases, HTTPS for production and team deployments, and HTTP only on trusted internal networks.

Use the official SonarQube MCP Server configuration generator to get a configuration code snippet for your setup:

  1. Identify the target MCP Client.

  2. Choose a hosting method.

  3. Enter the information into the configuration generator.

  4. Paste the generated configuration into your configuration file.

To configure by hand instead, select a transport tab.

Use HTTPS when connecting the cloud agent to a shared MCP server deployed for a team. This requires an HTTPS transport server to be running and accessible.

In your GitHub repository, navigate to Settings > Code, planning, and automation > Copilot > Cloud agent and add the following configuration in the MCP configuration section:

Tip: To verify the connection, ask your AI agent to call the SonarQube MCP ping_system tool. For example: "Ping the SonarQube MCP server."

Note: No restart is required. Each Copilot cloud agent task runs in a fresh environment and picks up your updated COPILOT_MCP_* secrets automatically.

Important: The HTTP transport mode is not recommended. Use Stdio for local development or HTTPS for multi-user production deployments.

Use HTTP only on a trusted internal network or for local testing. This requires an HTTP transport server to be running.

In your GitHub repository, navigate to Settings > Code, planning, and automation > Copilot > Cloud agent and add the following configuration in the MCP configuration section:

Tip: To verify the connection, ask your AI agent to call the SonarQube MCP ping_system tool. For example: "Ping the SonarQube MCP server."

Note: No restart is required. Each Copilot cloud agent task runs in a fresh environment and picks up your updated COPILOT_MCP_* secrets automatically.

Use Sonar tools from the cloud agent

Once connected, the GitHub Copilot cloud agent can call SonarQube MCP tools during its automated workflows. See the SonarQube MCP Tools page for the full list of available tools.

Last updated

Was this helpful?