# Connect Gemini CLI.

Source: https://adsuperpowers.ai/docs/setup/gemini

Connect Gemini CLI to Ad Superpowers and check your first advertising report.

Use this guide to work with your advertising data in the Gemini CLI terminal. Connect through a browser sign-in, then check an account and a small report.

## Before you begin

You need access to Gemini CLI and an Ad Superpowers account with an active trial or paid subscription. [Create an account](https://adsuperpowers.ai/signup) if needed; see [pricing](https://adsuperpowers.ai/pricing) for current access and limits.

In the [dashboard](https://adsuperpowers.ai/dashboard), select the intended workspace and connect your platform in [Integrations](https://adsuperpowers.ai/dashboard/integrations). Use that workspace when approving the connection.

## 1. Install Gemini CLI

The npm installation requires Node.js 20 or later. Follow Google's [installation requirements](https://geminicli.com/docs/get-started/installation/) for your system, then run:

```bash
npm install -g @google/gemini-cli
gemini
```

Complete Gemini CLI's own authentication when prompted.

## 2. Add Ad Superpowers

Add this entry to `~/.gemini/settings.json`, your user settings file. Create the file if needed. If it already contains `mcpServers`, merge the new entry into that object and preserve your other settings.

```json
{
  "mcpServers": {
    "ad-superpowers": {
      "httpUrl": "https://mcp.adsuperpowers.ai/v1"
    }
  }
}
```

Use `httpUrl` for Streamable HTTP. In Gemini CLI, `url` selects the older SSE transport. See [Google's MCP configuration](https://geminicli.com/docs/tools/mcp-server/).

## 3. Sign in to Ad Superpowers

Restart Gemini CLI after saving the file. Inside Gemini CLI, run:

```text
/mcp auth ad-superpowers
```

Complete the browser authorization with your Ad Superpowers account and check the workspace shown before approving. Return to the terminal and run `/mcp` to inspect the connection and available tools.

### API key alternative

If you use an API key, create it in the intended workspace's [API Keys](https://adsuperpowers.ai/dashboard/api-keys). Set `AD_SUPERPOWERS_KEY` in the environment that launches Gemini CLI, using your local secret-management method. Replace the server entry with:

```json
{
  "mcpServers": {
    "ad-superpowers": {
      "httpUrl": "https://mcp.adsuperpowers.ai/v1",
      "headers": {
        "Authorization": "Bearer ${AD_SUPERPOWERS_KEY}"
      }
    }
  }
}
```

Gemini CLI resolves environment references in settings when it loads them. Restart after setting the variable. Keep the actual key out of chat and shared configuration files. See the [settings reference](https://geminicli.com/docs/reference/configuration/).

## 4. Check the result

Ask Gemini CLI:

```text
List the advertising accounts I can access through Ad Superpowers.
Do not change anything.
```

Confirm that the expected account appears, then ask:

```text
For [account name and ID], show campaign spend and conversions
for the last 7 days. Include the date range and currency.
Do not change any campaigns.
```

Review any tool approval and check the account, dates and currency against the platform.

## If the connection fails

- **The server is missing:** check the JSON file and run `/mcp reload` to reload servers. A project `.gemini/settings.json` can override user settings.
- **Sign-in fails:** run `/mcp auth ad-superpowers` again and check your Ad Superpowers account and workspace. For the key alternative, check that the launching process has `AD_SUPERPOWERS_KEY` and the key is still active.
- **Tools appear, but the account is missing:** check [Integrations](https://adsuperpowers.ai/dashboard/integrations) in the workspace used for authorization. Reload the server after adding a platform, then follow [troubleshooting](https://adsuperpowers.ai/docs/troubleshooting).

## Official documentation

[Gemini CLI installation](https://geminicli.com/docs/get-started/installation/) · [MCP configuration](https://geminicli.com/docs/tools/mcp-server/) · [MCP commands](https://geminicli.com/docs/reference/commands/)

## Next steps

Try an [example question](https://adsuperpowers.ai/docs/examples) or browse the [tool reference](https://adsuperpowers.ai/docs/tools).
