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

# IDE Setup

> Step-by-step setup for Greptile MCP server in Cursor, Claude Code, VS Code, and Codex CLI. Access code review tools and custom context directly from your IDE.

Configure the Greptile MCP server in your IDE to access code review tools and custom context.

<Note>
  **Prerequisite:** Get your API key from [app.greptile.com/settings/organization/api](https://app.greptile.com/settings/organization/api) (Settings > Organization > API Keys)
</Note>

## Setup by IDE

<Tabs>
  <Tab title="Cursor">
    <Steps>
      <Step title="Open Settings">
        Click the 'Settings' icon or press `Ctrl + Shift + J` (Windows/Linux) or `Cmd + Shift + J` (macOS).
      </Step>

      <Step title="Go to Tools & MCP">
        Click **Tools & MCP** in the left sidebar.

        <Frame>
          <img src="https://mintcdn.com/greptile/pPDrEYn7_-Bi_2Mg/images/cursor-tools-mcp.png?fit=max&auto=format&n=pPDrEYn7_-Bi_2Mg&q=85&s=e35ed3a88fd1275f6c5daac82cb0eba3" alt="Cursor Tools and MCP settings" width="272" height="197" data-path="images/cursor-tools-mcp.png" />
        </Frame>
      </Step>

      <Step title="Add Custom MCP">
        Click **Add Custom MCP**.

        <Frame>
          <img src="https://mintcdn.com/greptile/UPpVJVb6MO4m3Pv2/images/cursor-add-custom-mcp.png?fit=max&auto=format&n=UPpVJVb6MO4m3Pv2&q=85&s=193acc7fde5827f55d9c7fefd55bec7f" alt="Add custom MCP button" width="599" height="442" data-path="images/cursor-add-custom-mcp.png" />
        </Frame>
      </Step>

      <Step title="Configure mcp.json">
        Add the following configuration:

        ```json theme={}
        {
          "mcpServers": {
            "greptile": {
              "type": "http",
              "url": "https://api.greptile.com/mcp",
              "headers": {
                "Authorization": "Bearer YOUR_GREPTILE_API_KEY"
              }
            }
          }
        }
        ```

        Replace `YOUR_GREPTILE_API_KEY` with your actual API key. Save the file.
      </Step>

      <Step title="Verify Connection">
        Return to **Tools & MCP**. You should see Greptile with all 11 tools enabled.

        <Frame>
          <img src="https://mintcdn.com/greptile/pPDrEYn7_-Bi_2Mg/images/cursor-greptile-mcp-enabled.png?fit=max&auto=format&n=pPDrEYn7_-Bi_2Mg&q=85&s=627f418c9fa4c2381fe9cc644fa8e0aa" alt="Greptile MCP enabled in Cursor" width="599" height="440" data-path="images/cursor-greptile-mcp-enabled.png" />
        </Frame>
      </Step>
    </Steps>
  </Tab>

  <Tab title="Claude Code (CLI)">
    <Steps>
      <Step title="Add Greptile MCP Server">
        Run the following command in your terminal:

        ```bash theme={}
        claude mcp add --transport http greptile https://api.greptile.com/mcp \
          --header "Authorization: Bearer YOUR_GREPTILE_API_KEY"
        ```

        Replace `YOUR_GREPTILE_API_KEY` with your actual API key.
      </Step>

      <Step title="Verify Installation">
        Check that the server was added:

        ```bash theme={}
        claude mcp list
        ```

        You should see:

        ```
        greptile: https://api.greptile.com/mcp (HTTP) - ✓ Connected
        ```
      </Step>

      <Step title="Start Using">
        Open Claude Code. The Greptile MCP tools are now available automatically.
      </Step>
    </Steps>

    ### Project-Level Configuration

    For team-shared configuration, create a `.mcp.json` file in your project root:

    ```json theme={}
    {
      "servers": {
        "greptile": {
          "transport": "http",
          "url": "https://api.greptile.com/mcp",
          "headers": {
            "Authorization": "Bearer ${GREPTILE_API_KEY}"
          }
        }
      }
    }
    ```

    Then set the environment variable:

    ```bash theme={}
    export GREPTILE_API_KEY=your-api-key-here
    ```
  </Tab>

  <Tab title="VS Code">
    <Steps>
      <Step title="Open Command Palette">
        Press `Ctrl + Shift + P` (Windows/Linux) or `Cmd + Shift + P` (macOS).
      </Step>

      <Step title="Add MCP Server">
        Type `MCP` and select **MCP: Add Server**.

        <Frame>
          <img src="https://mintcdn.com/greptile/sJeefWhR1h6iqsSa/images/vscode-mcp-add.png?fit=max&auto=format&n=sJeefWhR1h6iqsSa&q=85&s=d4dc25696fa020f32d381229e808a33b" alt="Add MCP Server in VS Code" width="600" height="281" data-path="images/vscode-mcp-add.png" />
        </Frame>
      </Step>

      <Step title="Select HTTP Type">
        Choose **HTTP (HTTP or Server-Sent-Events)**.

        <Frame>
          <img src="https://mintcdn.com/greptile/sJeefWhR1h6iqsSa/images/vscode-mcp-type.png?fit=max&auto=format&n=sJeefWhR1h6iqsSa&q=85&s=5384a6058f8c4e93f9dfc0996410d9e9" alt="Select HTTP type" width="600" height="112" data-path="images/vscode-mcp-type.png" />
        </Frame>
      </Step>

      <Step title="Enter URL">
        Enter: `https://api.greptile.com/mcp`
      </Step>

      <Step title="Select Scope">
        Choose **Global** or **Workspace**.

        <Frame>
          <img src="https://mintcdn.com/greptile/sJeefWhR1h6iqsSa/images/vscode-mcp-scope.png?fit=max&auto=format&n=sJeefWhR1h6iqsSa&q=85&s=4b0caed12d7183c975e3fb4a353fc0d8" alt="Select scope" width="600" height="112" data-path="images/vscode-mcp-scope.png" />
        </Frame>
      </Step>

      <Step title="Add Authorization Header">
        An `mcp.json` file will be created. Add the Authorization header:

        ```json theme={}
        {
          "servers": {
            "greptile": {
              "url": "https://api.greptile.com/mcp",
              "type": "http",
              "headers": {
                "Authorization": "Bearer YOUR_GREPTILE_API_KEY"
              }
            }
          }
        }
        ```

        Replace `YOUR_GREPTILE_API_KEY` with your actual API key.
      </Step>

      <Step title="Verify Installation">
        Run **MCP: List Servers** from Command Palette. You should see Greptile with status **Running**.

        <Frame>
          <img src="https://mintcdn.com/greptile/sJeefWhR1h6iqsSa/images/vscode-mcp-status.png?fit=max&auto=format&n=sJeefWhR1h6iqsSa&q=85&s=f307621c9cc4b023773547e48b9a6056" alt="MCP server status" width="600" height="112" data-path="images/vscode-mcp-status.png" />
        </Frame>
      </Step>
    </Steps>
  </Tab>

  <Tab title="Codex (CLI)">
    <Steps>
      <Step title="Add Greptile MCP Server">
        Run the following command in your terminal:

        ```bash theme={}
        codex mcp add greptile --url https://api.greptile.com/mcp \
          --bearer-token-env-var GREPTILE_API_KEY
        ```

        Then set your API key as an environment variable:

        ```bash theme={}
        export GREPTILE_API_KEY=your-api-key-here
        ```
      </Step>

      <Step title="Verify Installation">
        Check that the server was added:

        ```bash theme={}
        codex mcp list
        ```

        You should see:

        ```
        Name      Url                           Bearer Token Env Var  Status   Auth
        greptile  https://api.greptile.com/mcp  GREPTILE_API_KEY      enabled  Bearer token
        ```
      </Step>

      <Step title="Start Using">
        Open Codex. The Greptile MCP tools are available automatically.
      </Step>
    </Steps>

    ### Project-Level Configuration

    For team-shared configuration, create a `.codex/config.toml` file in your project root:

    ```toml theme={}
    [mcp_servers.greptile]
    url = "https://api.greptile.com/mcp"
    bearer_token_env_var = "GREPTILE_API_KEY"
    ```

    Then set the environment variable:

    ```bash theme={}
    export GREPTILE_API_KEY=your-api-key-here
    ```
  </Tab>
</Tabs>

## Verify Connection

Test your setup with curl:

```bash theme={}
curl -X POST https://api.greptile.com/mcp \
  -H "Authorization: Bearer YOUR_GREPTILE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"ping"}'
```

Expected response:

```json theme={}
{"jsonrpc":"2.0","id":1,"result":{}}
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="Server shows as disconnected">
    **Check:**

    * API key is correct and hasn't expired
    * URL is exactly `https://api.greptile.com/mcp`
    * Authorization header format: `Bearer YOUR_API_KEY` (with Bearer prefix)

    **Fix:** Restart your IDE after making configuration changes.
  </Accordion>

  <Accordion title="Authentication failed">
    **Verify:**

    * API key was copied without extra spaces
    * Your account has access to the repositories you're querying
    * API key hasn't been revoked

    **Test:** Use the curl command above to verify your API key works.
  </Accordion>

  <Accordion title="No tools available">
    **Solutions:**

    1. Restart your IDE completely
    2. Check server shows "Connected" or "Running" status
    3. Verify MCP is enabled in IDE settings
  </Accordion>

  <Accordion title="Tools return empty results">
    **Check:**

    * You have repositories indexed with Greptile
    * Your API key has access to those repositories
    * There are actual Greptile comments on your PRs
  </Accordion>
</AccordionGroup>

## Configuration File Locations

| IDE         | Config File                                                                                            |
| ----------- | ------------------------------------------------------------------------------------------------------ |
| Claude Code | `~/.mcp.json` or project `.mcp.json`                                                                   |
| Cursor      | `~/.cursor/mcp.json`                                                                                   |
| VS Code     | `~/.config/Code/User/mcp.json` (Linux)<br />`~/Library/Application Support/Code/User/mcp.json` (macOS) |
| Codex CLI   | `~/.codex/config.toml` or project `.codex/config.toml`                                                 |

## Next Steps

<CardGroup cols={2}>
  <Card title="Auto-Fix Workflow" icon="wand-magic-sparkles" href="/mcp-v2/auto-fix">
    Learn to resolve Greptile comments from your IDE
  </Card>

  <Card title="Tools Reference" icon="book" href="/mcp-v2/tools">
    Complete API documentation for all 11 tools
  </Card>
</CardGroup>
