> ## 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 Claude Code

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

Add the hosted MCP server to Claude Code. 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 at user scope so that it's available in every project:

```bash theme={null}
claude mcp add --transport http --scope user semgrep https://semgrep.dev/api/mcp
```

If `semgrep` is already configured, update its existing entry instead of adding it again.

**Step 2**

Start Claude Code and run `/mcp`.

**Step 3**

Select `semgrep`.

**Step 4**

Sign in and select an organization in your browser.

**Step 5**

Run `/mcp` again and confirm that `semgrep` is connected.

## Connect with an API token

**Step 1**

Add the server with an `Authorization` header:

```bash theme={null}
claude mcp add --transport http --scope user semgrep https://semgrep.dev/api/mcp \
  --header "Authorization: Bearer YOUR_SEMGREP_APP_TOKEN"
```

Replace `YOUR_SEMGREP_APP_TOKEN` with a **Web API** or **Read-only** [API token](https://docs.semgrep.dev/mcp/authentication.md#token-scopes). If `semgrep` is already configured, update the `Authorization` header in its existing entry instead of adding it again.

**Step 2**

Start a new Claude Code session. Run `/mcp` and confirm that `semgrep` is connected.

For more information, see [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp).
