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

# Gemini CLI

> Connect Gemini CLI to PostQueen over MCP

Gemini CLI supports MCP servers over streamable HTTP through its `settings.json` configuration, so her 11 tools land in the terminal you already have open.

<Info>
  You need your PostQueen API key first. In [app.postqueen.ai](https://app.postqueen.ai), open **Settings > Developers > Public API** and click **Reveal**.
</Info>

## Add via CLI

```bash theme={"system"}
gemini mcp add --transport http postqueen https://api.postqueen.ai/mcp/YOUR_API_KEY
```

Replace `YOUR_API_KEY` with your actual key.

| Scope          | File it writes                                 | Applies to        |
| -------------- | ---------------------------------------------- | ----------------- |
| none (default) | `.gemini/settings.json` in the current project | That project only |
| `--scope user` | `~/.gemini/settings.json`                      | Every project     |

## Manual configuration

You can also edit `~/.gemini/settings.json` directly. Gemini CLI uses the `httpUrl` key for streamable HTTP servers, and the key can sit in the URL or in a header.

<Tabs>
  <Tab title="Key in the URL">
    ```json ~/.gemini/settings.json theme={"system"}
    {
      "mcpServers": {
        "postqueen": {
          "httpUrl": "https://api.postqueen.ai/mcp/YOUR_API_KEY"
        }
      }
    }
    ```
  </Tab>

  <Tab title="Bearer token">
    Point `httpUrl` at the bare `/mcp` endpoint and pass the key in a `headers` object:

    ```json ~/.gemini/settings.json theme={"system"}
    {
      "mcpServers": {
        "postqueen": {
          "httpUrl": "https://api.postqueen.ai/mcp",
          "headers": {
            "Authorization": "Bearer YOUR_API_KEY"
          }
        }
      }
    }
    ```

    The equivalent one-liner:

    ```bash theme={"system"}
    gemini mcp add --transport http postqueen https://api.postqueen.ai/mcp --header "Authorization: Bearer YOUR_API_KEY"
    ```
  </Tab>
</Tabs>

<Note>
  Keys per the official [Gemini CLI MCP documentation](https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md): `httpUrl` is the streamable HTTP endpoint (`url` is reserved for SSE servers, and PostQueen does not use SSE). A project-level `.gemini/settings.json` uses the same format.
</Note>

<Warning>
  Your API key grants full access to your PostQueen workspace: treat it like a password. Since the bare `gemini mcp add` writes into the project's `.gemini/settings.json`, keep that file out of version control, and keep the user-level file private too. If the key leaks, regenerate it in **Settings > Developers > Public API** and update every client that uses it.
</Warning>

## Self-hosted

On a self-hosted instance, replace `https://api.postqueen.ai` with your `NEXT_PUBLIC_BACKEND_URL` in either form, for example `https://postqueen.example.com/api/mcp/YOUR_API_KEY`. Most self-hosted setups serve the backend under `/api`, so the MCP path sits at `/api/mcp`.

<Info>
  Your reverse proxy has to forward the `/mcp` paths and stream the response rather than buffering it. The configuration, and the Nginx setting that silently breaks this, are on [MCP on a self-hosted install](/mcp/self-hosting).
</Info>

## Verify

Start Gemini CLI and run the built-in slash command:

```
/mcp
```

It lists configured servers with their connection status and discovered tools. `postqueen` should show as connected with 11 tools. Then ask:

> "List my connected social media accounts"

<Check>
  Your channel names come back, because Gemini reached for her `integrationList` tool. She is connected.
</Check>

## Next steps

<CardGroup cols={2}>
  <Card title="Tools reference" icon="screwdriver-wrench" href="/mcp/tools">
    Every parameter of the 11 tools Gemini just discovered
  </Card>

  <Card title="Examples" icon="lightbulb" href="/mcp/examples">
    The flows where she has to look something up before she can post
  </Card>

  <Card title="Limits and troubleshooting" icon="gauge" href="/mcp/limits-and-troubleshooting">
    What MCP cannot reach, and what a bad key looks like
  </Card>

  <Card title="Gemini CLI as an agent" icon="terminal" href="/agents/gemini-cli">
    A worked example: two posts about the release you just cut
  </Card>
</CardGroup>
