# Gemini (CLI)

### CLI setup

Run the following command to add the MCP server configuration. If you want to only enable it for yourself, use `--scope user` instead.

```bash
gemini mcp add --transport http trunk https://mcp.trunk.io/mcp --scope project
```

Once completed, reopen Gemini.

### Alternative: Update MCP configuration

Add the following [configuration](https://github.com/google-gemini/gemini-cli/blob/v0.1.19/docs/tools/mcp-server.md#oauth-support-for-remote-mcp-servers) to your project's `.gemini/settings.json` file.

```json
{
  "mcpServers": {
    "trunk": {
      "httpUrl": "https://mcp.trunk.io/mcp"
    }
  }
}
```

### Authentication

After the MCP server was added to Gemini, users need to authorize to communicate with the server. Follow these steps to complete auth.

**Step 1: Start Gemini CLI**

In your terminal, run `gemini` .

**Step 2: Run the mcp auth command**

Run `/mcp auth trunk` to initiate the authentication and authorization flow.

**Step 3: Login & authorize**

A new webpage will be opened. Log in with your Trunk account and follow the instructions to authorize Gemini to communicate with the MCP server.

**Step 4: Confirm**

Follow instructions to get back to Gemini. A confirmation should be shown:

```
ℹ✅ Successfully authenticated with MCP server 'trunk'!
 

ℹRe-discovering tools from 'trunk'...
 

ℹSuccessfully authenticated and refreshed tools for 'trunk'.
```

**With auth completed, Gemini will be able to fetch the tools exposed by Trunk's MCP server.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trunk.io/flaky-tests/use-mcp-server/configuration/gemini-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
