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

# Using Linkly AI in Gemini CLI

> Integrate your Linkly AI local knowledge base with Google Gemini CLI, enabling the terminal AI agent to search and read your private documents

## Prerequisites

* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed
* Linkly AI Desktop running with the MCP service active

<CodeGroup>
  `bash Install via npm npm install -g @google/gemini-cli ` `bash Install
      via Homebrew (macOS) brew install google-gemini/gemini-cli/gemini-cli `
</CodeGroup>

## Configuration Steps

<Tabs>
  <Tab title="MCP HTTP (Recommended)" icon="globe">
    Edit `~/.gemini/settings.json` and add the following to `mcpServers`:

    ```json theme={null}
    {
      "mcpServers": {
        "linkly-ai": {
          "httpUrl": "http://127.0.0.1:60606/mcp"
        }
      }
    }
    ```
  </Tab>

  <Tab title="MCP Stdio" icon="terminal">
    First [install Linkly AI CLI](/docs/en/use-cli).

    Edit `~/.gemini/settings.json` and add the following to `mcpServers`:

    ```json theme={null}
    {
      "mcpServers": {
        "linkly-ai": {
          "command": "linkly",
          "args": ["mcp"]
        }
      }
    }
    ```
  </Tab>

  <Tab title="Remote Access" icon="globe">
    First complete [remote access configuration](/docs/en/use-in-remote), with the desktop tunnel showing{" "}

    <Badge stroke color="green">
      ● Connected
    </Badge>

    .

    Edit `~/.gemini/settings.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "linkly-ai": {
          "httpUrl": "https://mcp.linkly.ai/mcp",
          "headers": {
            "Authorization": "Bearer <your API Key>"
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

<Tip>
  The configuration file supports `${env:VAR_NAME}` syntax to read environment variables, avoiding writing the API Key in plaintext:

  ```json theme={null}
  "Authorization": "Bearer ${env:LINKLY_API_KEY}"
  ```
</Tip>

## Getting Started

Once configured, launch Gemini CLI and ask questions directly:

```bash theme={null}
gemini
> Search my documents for content about the project architecture
```

## FAQ

<AccordionGroup>
  <Accordion title="Configuration file does not exist">
    Running `gemini` for the first time will automatically create the
    `~/.gemini/` directory. You can also create it manually: `bash mkdir -p     ~/.gemini && touch ~/.gemini/settings.json `
  </Accordion>

  <Accordion title="Tools are not being called">
    Run the `/mcp` command in Gemini CLI to view the list of loaded MCP servers,
    and confirm that linkly-ai appears in the list.
  </Accordion>
</AccordionGroup>
