> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/agent-plugins/devin.md).

# Devin

Install the SonarQube plugin for the Devin CLI and Devin Desktop to bring code analysis, issue management, and secrets detection into your AI coding sessions.

The SonarQube plugin for Devin connects your AI coding agent to SonarQube's code quality and security features. It works with SonarQube Cloud or SonarQube Server.

Use the plugin from the Devin CLI and from Devin Desktop in Local mode. Devin Cloud sessions are not covered.

## Features

The plugin gives Devin SonarQube skills that you invoke as slash commands, a SonarQube reviewer subagent, and access to the full set of [Tools](https://docs.sonarsource.com/sonarqube-mcp-server/reference/tools.md) exposed by the SonarQube MCP Server, including:

* Code analysis: analyze code snippets and files in the agent context.
* Issues: search, review, and update code issues.
* Quality gates: check the quality gate status for a project.
* Security hotspots: search and review security hotspots.
* Coverage: find under-covered files and review line-by-line coverage.
* Dependencies: check third-party dependencies for software composition analysis (SCA) issues.

Through the SonarQube CLI integration set up by `sonar integrate devin`, Devin also receives:

* Secrets detection: hooks that keep credentials out of the files the agent reads and the prompts sent to Devin.
* [Vortex analysis](https://docs.sonarsource.com/agent-centric-development-cycle/inside-your-agent-the-agentic-loop/sonar-vortex-analysis.md) (available with a Vortex subscription: SonarQube Cloud Team (annual) or Enterprise plan, or SonarQube Server 2026.5 or newer Enterprise and Data Center editions): a hook that runs after Devin edits files.
* [Vortex context](https://docs.sonarsource.com/agent-centric-development-cycle/inside-your-agent-the-agentic-loop/sonar-vortex-context.md) (available with a Vortex subscription: SonarQube Cloud Team (annual) or Enterprise plan, or SonarQube Server 2026.5 or newer Enterprise and Data Center editions): hooks that inject project guidelines, architecture, semantic-navigation, and dependency context when a session starts and when a subagent starts.

## Prerequisites

* A SonarQube Cloud organization or SonarQube Server instance.
* The [Devin CLI](https://docs.devin.ai/) or Devin Desktop installed.
* The SonarQube CLI 1.11.0 or newer installed, with `sonar` on the PATH that Devin uses. Earlier versions do not include the `sonar integrate devin` command. The plugin's MCP Server starts through the `sonar` command and uses your `sonar auth login` session.
* A container runtime (Docker, Podman, or nerdctl) to run the SonarQube MCP Server image. The first start pulls the image, which can take a moment.

## Install

Install the plugin from the [SonarSource/sonarqube-agent-plugins](https://github.com/SonarSource/sonarqube-agent-plugins) repository:

```bash
devin plugins install SonarSource/sonarqube-agent-plugins
```

This installs the latest changes from the repository's default branch, not a tagged release.

## Configuration

After installing the plugin, finish setup in two steps.

### Step 1: Authenticate

Log in so the MCP Server can connect:

```bash
sonar auth login
```

Use the command for your scenario:

| Scenario             | Command                                                             |
| -------------------- | ------------------------------------------------------------------- |
| SonarQube Cloud (EU) | `sonar auth login -o <YourOrganizationKey>`                         |
| SonarQube Cloud (US) | `sonar auth login -o <YourOrganizationKey> -s https://sonarqube.us` |
| SonarQube Server     | `sonar auth login -s <YourServerURL>`                               |

Your browser opens to complete login, and the token is stored in your system keychain. Check your authentication anytime with `sonar auth status`.

### Step 2: Install secrets hooks, Vortex analysis, and Vortex context

Run the integration command:

```bash
sonar integrate devin
```

In an interactive terminal, the command shows these recommended components, then asks you to install them (**Install recommended**) or customize the selection: the secrets-detection hooks, the SonarQube MCP Server configuration, and, with a Vortex subscription, the Vortex analysis hook and the Vortex context hooks. The integration is global: it applies to all Devin sessions on this machine.

Run the guided integration skill from a Devin session instead:

```
/sonarqube:sonar-integrate
```

Restart the Devin session afterward so that Devin loads the new hooks and MCP configuration.

## Verify that it works

### Test the secrets hook

1. Restart Devin so the newly installed hooks are active. To confirm they're loaded, run `/hooks` in Devin.
2. Compose a prompt to Devin that contains a fake-looking but secret-shaped value:

   ```
   Here is my key: sqp_1aa323ae0689cd4a1abd062a2ad0a224ae8a1d13
   ```
3. Send the prompt.
4. Devin should block the prompt and report that Sonar detected secrets in it.

### Test the MCP server

In Devin, run `/mcp`. The `sonarqube` server should show as connected. Then ask: *"List my SonarQube projects."* Devin should call the SonarQube MCP server and return your project list. If it does not, run `sonar auth status` to confirm the underlying token is healthy, check that your container runtime is running, and restart Devin.

### Test Sonar Vortex

To confirm that Vortex analysis and context are both working, see [Checking that Vortex works properly](https://docs.sonarsource.com/agent-centric-development-cycle/inside-your-agent-the-agentic-loop/how-to-guides/check-vortex-setup.md).

## Non-interactive install

For provisioning scripts and onboarding automation, skip the interactive prompts and run the SonarQube CLI directly:

```bash
sonar integrate devin --non-interactive
```

In non-interactive mode the CLI does not prompt. Run `sonar auth status` afterward to confirm the integration is wired up. See [Devin](https://docs.sonarsource.com/sonarqube-cli/integrations/devin.md) in the SonarQube CLI docs for full details.

## Usage

After setup, invoke SonarQube skills in Devin using slash commands or natural language. Both options are shown for each skill.

### List projects

```
/sonarqube:sonar-list-projects                    # all accessible projects
/sonarqube:sonar-list-projects my-project         # search by name or key
```

Or in natural language:

* "List my SonarQube projects."
* "Search for projects with `auth` in the name."

### List issues

```
/sonarqube:sonar-list-issues                                        # issues in the current project
/sonarqube:sonar-list-issues my-project --severity CRITICAL
```

Or in natural language:

* "List the issues in `my-project`."
* "Show me critical issues in `my-project`."
* "Search issues in `my-project` on branch `main`."

### Fix an issue

```
/sonarqube:sonar-fix-issue java:S1481 src/main/java/MyClass.java
/sonarqube:sonar-fix-issue python:S2077 src/auth/login.py:34
```

Or in natural language:

* "Fix the issue `java:S1481` in `src/main/java/MyClass.java`."
* "Help me fix `python:S2077` on line 34 of `src/auth/login.py`."

### Quality gate

```
/sonarqube:sonar-quality-gate
/sonarqube:sonar-quality-gate my-project --branch main
```

Or in natural language:

* "Check the quality gate status for `my-project`."
* "Show me the quality gate for `my-project` on pull request 42."

### Analyze a file

```
/sonarqube:sonar-analyze
/sonarqube:sonar-analyze src/auth/login.py
```

Or in natural language:

* "Analyze `src/auth/login.py` for code quality and security issues."
* "Run analysis on the current file."

### Coverage

```
/sonarqube:sonar-coverage
/sonarqube:sonar-coverage my-project --max 50
/sonarqube:sonar-coverage my-project --file src/auth/login.py
```

Or in natural language:

* "What files in `my-project` have less than 50% coverage?"
* "Show me line-by-line coverage for `src/auth/login.py`."

### Duplication

```
/sonarqube:sonar-duplication
/sonarqube:sonar-duplication my-project --pr 42
/sonarqube:sonar-duplication my-project --file src/auth/login.py
```

Or in natural language:

* "Find duplicated files in `my-project`."
* "Show duplications in `my-project` on pull request 42."

### Dependency risks

Dependency risks require SonarQube Advanced Security.

```
/sonarqube:sonar-dependency-risks
/sonarqube:sonar-dependency-risks my-project --pr 42
```

Or in natural language:

* "List dependency risks in `my-project`."
* "Show me SCA issues on pull request 42."

### Security hotspots

Access security hotspots through the same `sonar-list-issues` skill:

```
/sonarqube:sonar-list-issues my-project
```

Or in natural language:

* "Search security hotspots in `my-project`."
* "Show hotspots in `my-project` that are still to review."

For the full reference of what the agent can call, see the [Tools](https://docs.sonarsource.com/sonarqube-mcp-server/reference/tools.md) page.

## Uninstall

To remove the SonarQube plugin from Devin, run:

```bash
devin plugins remove sonarqube
```

Removing the plugin removes the skills, the subagent, and the MCP wiring that it registered. The secrets hooks, Vortex hooks, Vortex instructions in `AGENTS.md`, and SonarQube MCP Server configuration written by `sonar integrate devin` stay in your Devin configuration until you remove them. To remove those, see [Uninstall](https://docs.sonarsource.com/sonarqube-cli/integrations/devin.md#uninstall) on the SonarQube CLI integration page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/agent-plugins/devin.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
