# Claude Code (CLI)

### CLI setup

Run the following command to add the MCP server configuration. If you want to only enable it for yourself, use `--scope user` instead.

```bash
claude mcp add --transport http trunk https://mcp.trunk.io/mcp --scope project
```

Once completed, reopen Claude Code.

### Alternative: Update MCP configuration

Add the following [configuration](https://docs.anthropic.com/en/docs/claude-code/mcp) to your project's `.mcp.json` file.

```json
{
  "mcpServers": {
    "trunk": {
      "url": "https://mcp.trunk.io/mcp",
      "type": "http"
    }
  }
}
```

### Authentication

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

**Step 1: Start Claude Code CLI**

In your terminal, run `claude` .

**Step 2: Run the mcp command**

Claude Code should recognize that auth is required. Run `/mcp` to authenticate, select trunk, and hit Enter:

<figure><img src="https://577236045-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F61Ep9MrYBkJa0Yq3zS1s%2Fuploads%2Fgit-blob-129b0476214a61be441094e94e4c9dc8d4ba3fca%2FScreenshot%202025-09-10%20at%2012.02.48%E2%80%AFPM.png?alt=media" alt="" width="370"><figcaption></figcaption></figure>

**Step 3: Login & authorize**

A new webpage will be opened. Log in with your Trunk account and follow the instructions to authorize Claude Code to communicate with the MCP server.

**Step 4: Confirm**

Follow instructions to get back to Claude Code. A confirmation should be shown:

```
Authentication successful. Connected to trunk.
```

**With auth completed, Claude Code will be able to fetch the tools exposed by Trunk's MCP server.**
