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

# Gemini CLI Setup

> Connect Google's Gemini CLI to Civic

## Prerequisites

<CardGroup cols={2}>
  <Card title="Gemini CLI" icon="terminal" href="https://github.com/google-gemini/gemini-cli">
    Install the Gemini CLI (`npm install -g @google/gemini-cli`)
  </Card>

  <Card title="Civic Account" icon="user" href="https://app.civic.com">
    Create a free account and configure your tools at app.civic.com
  </Card>
</CardGroup>

If you haven't set up Civic yet:

<Steps>
  <Step title="Create a free Civic account">
    Go to [app.civic.com](https://app.civic.com) and sign in with Google, GitHub, or email.
  </Step>

  <Step title="Select your MCP servers">
    During onboarding, choose which services you want your AI to access — GitHub, Slack, Google Workspace, Dropbox, and more. This creates your default toolkit.
  </Step>

  <Step title="Get your MCP URL">
    Your connection URL is the same for every Civic account:

    ```
    https://app.civic.com/hub/mcp
    ```

    The URL is not personalized — what makes it *yours* is authentication. When you connect your client and complete the OAuth flow, Civic links that session to your account and toolkit.
  </Step>
</Steps>

<Note>
  **Authentication**: Gemini CLI uses OAuth. The first time you run a tool call, you'll be redirected to app.civic.com in your browser to sign in and authorize. After that, credentials are cached and subsequent sessions don't require a browser.
</Note>

## Setup

Gemini CLI supports remote MCP servers via `httpUrl` — no local bridge required.

<Tabs>
  <Tab title="Global config (~/.gemini)">
    Add Civic to your user-level Gemini settings at `~/.gemini/settings.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "civic": {
          "httpUrl": "https://app.civic.com/hub/mcp"
        }
      }
    }
    ```

    This makes Civic available in all your Gemini CLI sessions.
  </Tab>

  <Tab title="Project config (.gemini)">
    Add a project-scoped config at `.gemini/settings.json` in your project root:

    ```json theme={null}
    {
      "mcpServers": {
        "civic": {
          "httpUrl": "https://app.civic.com/hub/mcp"
        }
      }
    }
    ```

    Project config takes precedence over global config when both exist.
  </Tab>
</Tabs>

## Test Your Connection

Start a Gemini CLI session and try:

```
"What MCP tools do I have available?"
"List my GitHub repositories"
"Check my Google Calendar for today"
```

On first use, Gemini CLI will redirect you to complete the Civic OAuth flow in your browser. After authenticating once, the session is cached — you won't need to re-authenticate on subsequent runs.

## Troubleshooting

<AccordionGroup>
  <Accordion title="MCP server not found">
    Confirm the `settings.json` is valid JSON and saved at the correct path. Run `gemini` from the project directory if using project-scoped config.
  </Accordion>

  <Accordion title="Authentication error">
    Delete the cached credentials and re-authenticate:

    ```bash theme={null}
    rm -rf ~/.gemini/auth_cache
    ```

    Then start a new session — the OAuth flow will run again on the next request.
  </Accordion>

  <Accordion title="Tools not available after connecting">
    Visit [app.civic.com](https://app.civic.com) to confirm your toolkit has MCP servers configured. An empty toolkit will result in no tools being available.
  </Accordion>
</AccordionGroup>

## Need Help?

<CardGroup cols={2}>
  <Card title="Troubleshooting" icon="wrench" href="/civic/troubleshooting">
    Common connection issues and solutions
  </Card>

  <Card title="Get Help" icon="slack" href="https://join.slack.com/t/civic-developers/shared_invite/zt-37tv9fyo7-aDT43mUjOFQwdQFmfZLTRw">
    Ask in our developer Slack
  </Card>
</CardGroup>
