> 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/sonarqube-for-vs-code/ai-capabilities/ides/cursor.md).

# Cursor

Install SonarQube for VS Code in Cursor, set up connected mode, and configure SonarQube MCP Server or CLI integration.

## Installation

The SonarQube for VS Code extension can easily be installed in Cursor from either the [Open VSX registry](https://open-vsx.org/extension/SonarSource/sonarlint-vscode) or by using Cursor’s [VS Code Migration](https://cursor.com/docs/configuration/migrations/vscode) tools.

To install the SonarQube for VS Code extension in Cursor:

1. Open the **Extensions** view by pressing `Ctrl + Shift + X` (or `Cmd + Shift + X` on Mac).
2. Search for `sonarqube`.
3. Finish the installation by selecting the **Install** button

Once installed, set up [connected mode](/sonarqube-for-vs-code/connect-your-ide/setup.md) if you want to configure a self-hosted SonarQube MCP Server for Cursor. Open the **AI Integrations** view to set up your CLI integration for a supported agent.

### Migrate extensions from VS Code

Cursor provides a workflow to [import your VS Code settings](https://cursor.com/docs/configuration/migrations/vscode), including your extensions.

If you were using connected mode or the [#sonarqube-mcp-server](#sonarqube-mcp-server "mention"), your SonarQube token will not be migrated but you will be prompted to reauthenticate any connections you created in VS Code.

{% hint style="info" %}
Cursor subscribers on their Enterprise plan should add SonarQube for VS Code to the list of allowed extensions. Please see the Cursor documentation to [Configure (your) allowed extensions](https://docs.cursor.com/en/account/teams/enterprise-settings#configure-allowed-extensions).
{% endhint %}

## SonarQube MCP Server

The SonarQube MCP Server is a Model Context Protocol (MCP) server that runs locally and enables a seamless connection between your AI agents and your SonarQube platform. The tools are designed to bridge the divide between productivity and quality. Please see the full details in the SonarQube [SonarQube MCP Server](https://docs.sonarsource.com/sonarqube-mcp-server/) documentation.

### Setup the SonarQube MCP Server

1. Set up a connected-mode connection to SonarQube Server or SonarQube Cloud
2. Open **SonarQube Setup** > **AI Integrations**, and expand **Manage agents** in the **SonarQube MCP Server** card. The Cursor row shows the configuration file that will be updated
3. Select **Set up** in the Cursor row, then select the IDE connection to use if you have more than one. The extension updates only Cursor's configuration file
4. Use **Open configuration** to inspect an existing entry. Select **MCP configuration guide**, at the bottom of the card, for manual setup instructions

Self-hosted MCP setup does not require SonarQube CLI installation or CLI authentication. This view only configures a self-hosted MCP server, not the SonarQube Server-hosted or SonarQube Cloud-hosted MCP server. Its status describes the file it inspected:

* **Not configured**: Select **Set up** to create the SonarQube entry
* **Configured**: A self-hosted SonarQube entry exists. Select **Open configuration** to inspect it
* **Managed by CLI**: The inspected file contains an entry managed by the SonarQube CLI. Open the file to inspect it; self-hosted setup does not change that entry
* **Needs attention**: The file is malformed or its `sonarqube` entry cannot be managed by this view. Select **Open configuration** to inspect the diagnostic. An existing MCP connection may still work

At startup, the extension refreshes `SONARQUBE_IDE_PORT` only in a recognized self-hosted entry that already has that key. It does not add a missing key or change the server URL, token, or other settings.

The view currently checks for an MCP entry named `sonarqube`. A URL-based, cloud-hosted entry with that name may show **Needs attention**, but the extension does not replace it. An entry under another name remains untouched but is not recognized as the SonarQube entry, so **Set up** may create a separate `sonarqube` entry.

The extension preserves unrelated configuration when it updates a supported file. It does not replace malformed configuration with an empty file or overwrite an entry managed by the SonarQube CLI. If it detects legacy agent instructions in your workspace, **Open file** opens those instructions for review.

Self-hosted MCP setup is unavailable in remote IDE windows. Use the documentation links or open an existing configuration file.

For manual setup, see [the Cursor quickstart guide](/sonarqube-mcp-server/setup/quickstart-guides/cursor.md). More information about the available tools can be found in the SonarQube MCP Server documentation, on the [SonarQube MCP Server tools](/sonarqube-mcp-server/reference/tools.md) page.

### Configure your AI agent

Open **SonarQube Setup** > **AI Integrations** to see detected agents and the available SonarQube CLI and self-hosted MCP actions. Expand **Manage agents** in either card to see each agent's status. Detection alone does not confirm that SonarQube integration has been completed. See the [MCP quickstart guides](/sonarqube-mcp-server/setup/quickstart-guides.md) for manual setup instructions.

## Related pages

* [AI CodeFix](/sonarqube-for-vs-code/ai-capabilities/ai-codefix.md)
* [AI integrations](/sonarqube-for-vs-code/ai-capabilities/integrations.md)
* Getting started with other [Supported IDEs](/sonarqube-for-vs-code/getting-started/ides.md)
* [Connected mode setup](/sonarqube-for-vs-code/connect-your-ide/setup.md)

## Related online courses

* <i class="fa-video">:video:</i> [Setting up SonarQube for IDE in Connected Mode with Cursor](https://www.sonarsource.com/learn/course/sonarqube-for-ide/ad2919d7-197f-4ad8-8605-7d8c10d4cd09/setting-up-sonarqube-for-ide-in-connected-mode-with-cursor)


---

# 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/sonarqube-for-vs-code/ai-capabilities/ides/cursor.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.
