Tools

Getting Started with Google Gemini CLI for Terminal-Based AI Assistance

Google's open-source Gemini CLI brings AI-powered terminal assistance to your local dev workflow, with file editing, subagent delegation, and full MCP support.

Robson PereiraMay 31, 202610 min read
Google Gemini CLI running as an open-source AI agent in a terminal window.

Getting Started with Google Gemini CLI for Terminal-Based AI Assistance

Google surprised the open-source community this year by releasing **Gemini CLI** — an open-source AI agent that brings the power of Gemini directly into your terminal. With over **105,000 GitHub stars** and growing rapidly, it represents a significant shift: Google's frontier AI model, packaged as a local-first agent you can run on your own machine.

The tool is written in TypeScript, licensed under Apache 2.0, and available at github.com/google-gemini/gemini-cli. It supports file editing, command execution, web search, subagent delegation, and the Model Context Protocol for extensible tool integration.

What Gemini CLI does differently

Unlike a simple chat interface wrapped around an API, Gemini CLI is designed as an autonomous agent. It can read and edit files, run shell commands, search the web for context, spawn subagents for parallel work, and connect to MCP servers for domain-specific tools.

Key capabilities that matter for self-hosted AI workflows:

  • **File-aware operations** — read, write, patch, and search across your project files
  • **Shell execution** — run commands, capture output, and react to results
  • **Subagent delegation** — spawn parallel agents for independent research or coding tasks
  • **MCP client support** — connect to any Model Context Protocol server for data sources, APIs, or custom tools
  • **Session persistence** — name and resume sessions across terminal sessions

If you are comparing AI coding agents, our Open WebUI vs AnythingLLM guide explains the difference between chat interfaces and agentic tools — Gemini CLI sits firmly in the agent camp.

Where it fits in your stack

Gemini CLI is a terminal-first tool. It complements rather than replaces tools like Open WebUI and Ollama. Use Open WebUI for document chat and team knowledge retrieval. Use Gemini CLI for coding assistant work, infrastructure management, and one-shot research tasks where terminal access gives you the fastest path to a result.

For automation workflows, consider pairing Gemini CLI with n8n — see Build Your Own AI Assistant with n8n.

Installation and setup

Install via npm or the standalone installer:

```bash

npm install -g @google-gemini/cli

gemini login

```

Once authenticated, start an interactive session or run one-shot queries:

```bash

Interactive mode

gemini

One-shot query

gemini -q "Summarise the key changes in the last 10 git commits"

With a specific model

gemini -m gemini-2.5-pro -q "Explain this codebase structure"

```

Using MCP servers with Gemini CLI

One of the most powerful features is MCP support. Connect Gemini CLI to any MCP server for databases, APIs, or custom tools. The MCP server ecosystem is growing rapidly — the modelcontextprotocol/servers repository has amassed over 86,000 stars.

Practical workflows for self-hosted AI

Code review and refactoring

Point Gemini CLI at a codebase and ask for architecture analysis, security review, or refactoring suggestions. It reads files directly in your working directory so it understands the full project structure.

Infrastructure management

Use it to inspect logs, check system health, and suggest configuration changes — all from within your terminal. This makes it a practical assistant for day-to-day server management.

Parallel research tasks

Subagent delegation lets you run multiple research streams in parallel, making Gemini CLI useful for exploring multiple approaches to a problem simultaneously.

Security considerations

Because Gemini CLI executes shell commands and modifies files, review commands before approving and keep your API key secure. For broader security guidance, read How to Secure a Self-Hosted AI Server.

What it means for the ecosystem

Google releasing Gemini CLI as open-source under Apache 2.0 is meaningful for the self-hosted AI space. It signals that frontier AI companies see value in open, local-first agent tools. The 105K+ GitHub stars and active community contributions suggest strong momentum.

FAQ

Is Gemini CLI free to use?

The tool itself is open-source and free. You need a Gemini API key, which has a free tier with usage limits.

Can I use it with a local model?

Currently Gemini CLI works with Google's Gemini API. For local model support, Ollama and Open WebUI remain the better option.

How does it compare to Claude Code or Codex?

Gemini CLI is Google's entry in the same category as Anthropic's Claude Code and OpenAI's Codex — terminal-based AI coding agents. Each has different pricing, model strengths, and ecosystem integrations.

Related articles