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

# Cursor (IDE)

> Add Trunk's MCP Server to Cursor

## One-click setup

Use the "Add to Cursor" action to add the Trunk MCP server:

<p align="center">
  <a href="https://cursor.com/en/install-mcp?name=trunk&config=eyJ1cmwiOiJodHRwczovL21jcC50cnVuay5pby9tY3AifQ%3D%3D">
    <img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Add trunk MCP server to Cursor" />
  </a>
</p>

Once clicked, follow instructions to open the MCP configuration in Cursor. A new settings window to confirm the installation of the MCP server will be shown. Click on "Install" to proceed.

<Frame>
  <img src="https://mintcdn.com/trunk-4cab4936/WAR0qJ1WO0rtUlqz/assets/flaky-tests/reference/mcp-reference/configuration/Screenshot_2025-09-10_at_11.28.24_AM.png?fit=max&auto=format&n=WAR0qJ1WO0rtUlqz&q=85&s=c2a874d68294353033f9edf9c7ce5789" alt="" width="812" height="516" data-path="assets/flaky-tests/reference/mcp-reference/configuration/Screenshot_2025-09-10_at_11.28.24_AM.png" />
</Frame>

## Alternative: Update MCP configuration

Add the following [configuration](https://docs.cursor.com/en/context/mcp#model-context-protocol-mcp) to your project's `.cursor/mcp.json` file. If you want to enable it only for yourself, add it to `~/.cursor/mcp.json` instead.

```json theme={null}
{
  "mcpServers": {
    "trunk": {
      "url": "https://mcp.trunk.io/mcp"
    }
  }
}
```

## Authentication with OAuth (default)

After the MCP server was added to Cursor, users need to authorize Cursor to communicate with the server. Follow these steps to complete auth.

**Step 1: Open MCP Settings**

Run `CMD+Shift+P` to open the command palette and choose `View: Open MCP Settings`

**Step 2: Enable the Trunk MCP server**

A "Needs authentication" status will be shown:

<Frame>
  <img src="https://mintcdn.com/trunk-4cab4936/WAR0qJ1WO0rtUlqz/assets/flaky-tests/reference/mcp-reference/configuration/Screenshot_2025-09-10_at_11.28.34_AM.png?fit=max&auto=format&n=WAR0qJ1WO0rtUlqz&q=85&s=0915f91ca0bca503ba7948d28b4f46ff" alt="" width="788" height="134" data-path="assets/flaky-tests/reference/mcp-reference/configuration/Screenshot_2025-09-10_at_11.28.34_AM.png" />
</Frame>

**Step 3: Login & authorize**

A new webpage will be opened. Login with your Trunk account and follow instructions to authorize Cursor to communicate with the MCP server.

**Step 4: Confirm**

Follow instructions to get back to Cursor. With auth completed, Cursor will be able to fetch the tools exposed by Trunk's MCP server:

<Frame>
  <img src="https://mintcdn.com/trunk-4cab4936/WAR0qJ1WO0rtUlqz/assets/flaky-tests/reference/mcp-reference/configuration/Screenshot_2025-09-10_at_11.29.00_AM.png?fit=max&auto=format&n=WAR0qJ1WO0rtUlqz&q=85&s=4a7976ae7fbe0e796c852b514103a21d" alt="" width="808" height="254" data-path="assets/flaky-tests/reference/mcp-reference/configuration/Screenshot_2025-09-10_at_11.29.00_AM.png" />
</Frame>

## Alternative: Authentication with API token

If you prefer not to use the OAuth flow, you can authenticate with your Trunk organization API token. Find your token under **Settings** → **Organization** → **General**, in the **API** section of the Trunk dashboard.

Add the token to your `.cursor/mcp.json`:

```json theme={null}
{
  "mcpServers": {
    "trunk": {
      "url": "https://mcp.trunk.io/mcp",
      "headers": {
        "Authorization": "Bearer ${TRUNK_API_TOKEN}"
      }
    }
  }
}
```

Set `TRUNK_API_TOKEN` as an environment variable. Cursor interpolates environment variables in MCP configuration files automatically.
