Skip to content

gemini Google Gemini CLI

Google Gemini CLI is used as an AI agent that can be used directly in a terminal.

I use the Gemini CLI to help generate bash script files and markdown documents for zensical. It is my preferred coding agent at the moment since I already pay for Google One.

🛠 Installation

Config path: ~/.gemini/

npm install -g @google/gemini-cli
npx https://github.com/google-gemini/gemini-cli
gemini

⚙ Config

  1. Generate a key from Google AI Studio.
  2. Set it as an environment variable in your terminal. Replace YOUR_API_KEY with your generated key.
export GEMINI_API_KEY="YOUR_API_KEY"
export GEMINI_API_KEY="YOUR_API_KEY"

✍ Syntax Files

Syntax files are used to customize the iutput from Gemini.

docs/GEMINI.md
--8<-- "AGENTS.md"

AGENTS.md files can also be used to enable the use of other AI agents.

Enable gemini-cli to use AGENTS.md files.

~/.gemini/settings.json

{ "contextFileName": "AGENTS.md" }

🤖 MCP Servers

MCP servers are used to extract information from my homelab.

GitHub MCP Server

The GitHub MCP Server can be used to allow Gemini to interact with GitHub repositories.

~/.gemini/settings.json

{
    "mcpServers": {
        "github": {
            "command": "github-mcp-server",
            "args": ["stdio"],
            "env": {
                "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
            }
        }
    }
}
  • GITHUB_PERSONAL_ACCESS_TOKEN: This environment variable must be set with your GitHub PAT for the github MCP server.

proxmox-mcp-plus

The proxmox-mcp-plus can be used to allow Gemini to interact with Proxmox VE.

~/tools/gemini/pve01.config.json

--8<-- "tools/gemini/pve01.config.json.enc"

~/.gemini/settings.json

{
    "mcpServers": {
        "pve01": {
            "command": "${HOME}/.local/share/uv/tools/proxmox-mcp/bin/python",
            "args": ["-m", "proxmox_mcp.server"],
            "env": {
                "PROXMOX_MCP_CONFIG": "${HOME}/git/nicholaswilde/homelab/tools/gemini/pve01.config.json"
            }
        },
        "pve04": {
            "command": "${HOME}/.local/share/uv/tools/proxmox-mcp/bin/python",
            "args": ["-m", "proxmox_mcp.server"],
            "env": {
                "PROXMOX_MCP_CONFIG": "${HOME}/git/nicholaswilde/homelab/tools/gemini/pve04.config.json"
            }
        }
    }
}

Build and Load

The Docker image for proxmox-mcp-plus needs to be built and loaded manually.

Code

cd tools/gemini/proxmox-mcp-plus
task load

UniFi Network MCP

The UniFi Network MCP allows Gemini to interact with UniFi Network controllers.

~/.gemini/settings.json

{
    "mcpServers": {
      "unifi": {
        "command": "unifi-network-mcp",
        "env": {
          "UNIFI_HOST": "192.168.1.148",
          "UNIFI_USERNAME": "admin",
          "UNIFI_PASSWORD": "password",
          "UNIFI_PORT": "443",
          "UNIFI_SITE": "154bj8wf",
          "UNIFI_VERIFY_SSL": "false",
          "UNIFI_CONTROLLER_TYPE": "auto"
        }
      }
    }
}

Tip

To find the UNIFI_SITE value, check the URL in the UniFi GUI. For example, in https://unifi.l.nicholaswilde.io/network/154bj8wf/dashboard, the site ID is 154bj8wf.

AdGuard Home MCP

The AdGuard Home MCP allows Gemini to interact with AdGuard Home for DNS management.

~/.gemini/settings.json

{
    "mcpServers": {
        "adguard": {
            "command": "npx",
            "args": [
                "-y",
                "@fcannizzaro/mcp-adguard-home"
            ],
            "env":{
                "ADGUARD_URL": "http://192.168.2.13",
                "ADGUARD_USERNAME": "admin",
                "ADGUARD_PASSWORD": "password"
            }
        }
    }
}

Home Assistant MCP

The Home Assistant MCP allows Gemini to interact with Home Assistant for IoT device control.

🛠 Activation

  1. Add Integration: Go to your Home Assistant instance, navigate to Settings -> Devices & Services, and click Add Integration. Search for "Model Context Protocol" and add it.
  2. Generate Token: Click on your user profile icon in the bottom left corner of the sidebar. Scroll down to the "Long-Lived Access Tokens" section and click Create Token. Give it a name (e.g., "Gemini MCP") and copy the generated token.

~/.gemini/settings.json

{
    "mcpServers": {
        "homeassistant": {
            "httpUrl": "http://ha.l.nicholaswilde.io:8123/api/mcp",
            "headers": {
                "Authorization": "Bearer YOUR_LONG_LIVED_ACCESS_TOKEN"
            }
        }
    }
}

Nanobanana MCP

The Nanobanana MCP is used to watch for repository commit updates.

~/.gemini/settings.json

{
    "mcpServers": {
        "nano-banana": {
            "command": "nanobanana-mcp-server",
            "env": {
                "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
            }
        }
    }
}

🎨 Theme

The Catppuccin theme can be used to customize the appearance of the Gemini CLI.

  1. Download the mocha flavor of the Catppuccin theme.
wget https://raw.githubusercontent.com/catppuccin/gemini-cli/main/themes/mocha.json -O ${HOME}/.gemini/catppuccin-mocha.json
  1. Add the theme property to your settings.json file.

~/.gemini/settings.json

{
  "ui": {
    "theme": "${HOME}/.gemini/catppuccin-mocha.json"
  }
}

📝 Usage

Once installed and authenticated, start interacting with Gemini from the shell.

Example

git clone https://github.com/google-gemini/gemini-cli
cd gemini-cli
gemini
> Give me a summary of all of the changes that went in yesterday

Start a chat

gemini

Pipe content to the CLI from stdin

echo "Explain the content of this file docs/README.md" | gemini -p

UniFi Network MCP

> List all connected clients on my network.
> Show me the status of my UniFi devices.
> What are my current firewall rules?

List Models

Note

Assuming that your Gemini key is stored in the GEMINI_API_KEY environmental variable and jq is installed.

Code

curl "https://generativelanguage.googleapis.com/v1beta/models?key=${GEMINI_API_KEY}" | jq -r '.models[].name'

🔗 References