> 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/sonarqube-cli-in-agentic-workflows.md).

# SonarQube CLI in agentic workflows

The `sonar integrate` command connects the [SonarQube CLI](https://docs.sonarsource.com/sonarqube-cli/) with your AI coding agent. It installs secrets-detection hooks, the SonarQube MCP server, [Agentic Analysis](/agent-centric-development-cycle/features/agentic-analysis.md), and [Context Augmentation](/agent-centric-development-cycle/features/context-augmentation.md) in one command.

## Supported agents

The following integrations are available:

| Agent          | Command                       |
| -------------- | ----------------------------- |
| Claude Code    | `sonar integrate claude`      |
| Codex CLI      | `sonar integrate codex`       |
| GitHub Copilot | `sonar integrate copilot`     |
| Cursor         | `sonar integrate cursor`      |
| Antigravity    | `sonar integrate antigravity` |

For detailed setup instructions, see the corresponding agent plugin page in [agent-plugins/](/agent-centric-development-cycle/developer-tools/agent-plugins.md).

## What the integration installs

For each supported agent, `sonar integrate` installs:

* Secrets detection: Hooks, instructions, or both that prevent the agent from reading files containing secrets or including them in prompts. The exact mechanism varies by agent.
* [Agentic Analysis](/agent-centric-development-cycle/features/agentic-analysis.md): Instructions or hooks that tell the agent to run `sonar analyze agentic` after edits. See [Make your agent verify its code](/agent-centric-development-cycle/how-to-guides/verify-your-code/make-your-agent-verify-its-code.md).
* [Context Augmentation](/agent-centric-development-cycle/features/context-augmentation.md): A skill that lets the agent pull project guidelines, architecture, semantic navigation, and dependency context as it works. See [Add context to generate better code](/agent-centric-development-cycle/how-to-guides/add-context-to-generate-better-code.md).
* [SonarQube MCP server](https://docs.sonarsource.com/sonarqube-mcp-server/): Configured so the agent can fetch projects, issues, and rules directly.

## List of commands

For the full list of SonarQube CLI commands, see [Commands](https://www.sonarsource.com/sonarqube/cli/commands#sonar-auth-login).


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/sonarqube-cli-in-agentic-workflows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
