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

# Connect Claude Code

> Add AdLoop to Claude Code, Cloud or self-hosted.

## AdLoop Cloud

Use your API key from **Settings → API keys** in the [dashboard](https://getadloop.com):

```bash theme={null}
claude mcp add --transport http adloop https://mcp.getadloop.com/mcp \
  --header "Authorization: Bearer alc_YOUR_KEY"
```

## Self-hosted

After running `adloop init`:

```bash theme={null}
claude mcp add --transport stdio adloop -- python -m adloop
```

To expose only some [toolsets](/concepts/toolsets) (smaller tool list, less context per conversation):

```bash theme={null}
claude mcp add --transport stdio adloop --env ADLOOP_TOOLSETS=ads,ga4 -- python -m adloop
```

Or in your project's `.mcp.json`:

```json theme={null}
{
  "mcpServers": {
    "adloop": {
      "command": "python",
      "args": ["-m", "adloop"],
      "env": { "ADLOOP_TOOLSETS": "ads,ga4" }
    }
  }
}
```

## Orchestration rules

For self-hosted setups, `adloop install-rules` installs orchestration rules and slash commands into `~/.claude/` so Claude knows the safety patterns, GAQL reference, and workflows. Cloud users get the essential rules delivered through the server itself.

## Verify

```
> Run the AdLoop health check.
```

You should see OAuth, GA4, and Ads status. If something fails, see [Troubleshooting](/troubleshooting).

<Tip>
  **Your AI can read these docs too.** Add `https://docs.getadloop.com/mcp` as an additional MCP server and your assistant can search this documentation while it works: setup answers, troubleshooting, and tool guidance on demand.
</Tip>
