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

# Connect Gemini CLI

> Add the Copyfy MCP server to Gemini CLI with OAuth or an API key.

<Info>
  Steps checked against the Gemini CLI documentation and source on September 24, 2026.
</Info>

## Add Copyfy

<Tabs>
  <Tab title="OAuth (recommended)">
    <Steps>
      <Step title="Add the server">
        ```bash Terminal theme={null}
        gemini mcp add --scope user --transport http copyfy https://app.copyfy.io/mcp
        ```

        `--scope user` writes to `~/.gemini/settings.json` so Copyfy works in every folder. Without it, Copyfy is added to the current project's `.gemini/settings.json`.
      </Step>

      <Step title="Sign in">
        Start `gemini`. Gemini CLI detects that Copyfy needs sign-in and opens your browser. If it does not, run:

        ```text Gemini CLI theme={null}
        /mcp auth copyfy
        ```

        Sign in to Copyfy and click **Allow access**. The browser sign-in needs a local desktop session; on a remote server, use an API key.
      </Step>

      <Step title="Try it">
        Ask: *"Use Copyfy to find 10 winning products in the Pets niche for the US."*
      </Step>
    </Steps>
  </Tab>

  <Tab title="API key">
    Create an [API key](/authentication#create-a-key), store it in the `COPYFY_API_KEY` environment variable, and add this entry to `~/.gemini/settings.json`:

    ```json ~/.gemini/settings.json theme={null}
    {
      "mcpServers": {
        "copyfy": {
          "url": "https://app.copyfy.io/mcp",
          "type": "http",
          "headers": {
            "Authorization": "Bearer $COPYFY_API_KEY"
          }
        }
      }
    }
    ```

    Gemini CLI replaces `$COPYFY_API_KEY` with the value of the environment variable when it starts.
  </Tab>
</Tabs>

Run `/mcp` in Gemini CLI to see Copyfy's status and tools.

<Note>
  Older Gemini CLI guides use `httpUrl` for HTTP servers. Current versions prefer `url` with `"type": "http"`, as shown above.
</Note>

## Fallback

Copy the URL `https://app.copyfy.io/mcp` and add it under `mcpServers` in `~/.gemini/settings.json` with `"type": "http"`.

## Disconnect

Run `gemini mcp remove --scope user copyfy` (use the scope you added it with), or delete the entry from `settings.json`. To revoke access from the Copyfy side, click **Revoke** under **Connected apps** or revoke the key on the [Integrations page](https://app.copyfy.io/dashboard/api).

Having trouble? See [Troubleshooting](/troubleshooting).
