> ## Documentation Index
> Fetch the complete documentation index at: https://docs.semgrep.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Cursor

> Add the hosted MCP server for Semgrep AppSec Platform to Cursor with OAuth or an API token.

Add the hosted MCP server to Cursor. For help choosing an authentication method, see [Authentication and access](https://docs.semgrep.dev/mcp/authentication.md).

## Prerequisites

* The [prerequisites for the hosted MCP server](https://docs.semgrep.dev/mcp/overview.md#prerequisites).

> [!NOTE]
>
> **Single-tenant URL**
>
> The steps on this page use `https://semgrep.dev/api/mcp`. On a single-tenant deployment, replace that URL with `https://YOUR_TENANT.semgrep.dev/api/mcp`. Use your subdomain for `YOUR_TENANT`. To connect to the read-only URL instead, see [Read-only URL](https://docs.semgrep.dev/mcp/authentication.md#read-only-url).

## Connect with OAuth

**Step 1**

Add the server to `~/.cursor/mcp.json` to make it available in every project, or to `.cursor/mcp.json` in a single project:

```json theme={null}
{
  "mcpServers": {
    "semgrep": {
      "url": "https://semgrep.dev/api/mcp"
    }
  }
}
```

**Step 2**

Open Cursor Settings and find `semgrep` under **Custom MCP Servers**.

**Step 3**

Start sign-in for `semgrep`.

**Step 4**

Sign in and select an organization in your browser.

**Step 5**

Confirm that `semgrep` shows as connected and lists its tools.

## Connect with an API token

**Step 1**

Add the server to `~/.cursor/mcp.json` or `.cursor/mcp.json` with an `Authorization` header:

```json theme={null}
{
  "mcpServers": {
    "semgrep": {
      "url": "https://semgrep.dev/api/mcp",
      "headers": {
        "Authorization": "Bearer ${env:SEMGREP_APP_TOKEN}"
      }
    }
  }
}
```

Cursor replaces `${env:SEMGREP_APP_TOKEN}` with the value of the `SEMGREP_APP_TOKEN` environment variable. Export it, set to a **Web API** or **Read-only** [API token](https://docs.semgrep.dev/mcp/authentication.md#token-scopes), in the environment where you start Cursor.

**Step 2**

Restart Cursor. In Cursor Settings, under **Custom MCP Servers**, confirm that `semgrep` shows as connected and lists its tools.

For more information, see [Cursor MCP documentation](https://cursor.com/docs/mcp).
