Open-source AI agent providing terminal access to Gemini models with extensible tool support and developer-focused features
npx @tessl/cli install tessl/npm-google--gemini-cli@0.5.0Gemini CLI is an open-source AI agent that brings the power of Gemini directly into your terminal. It provides lightweight access to Gemini models with a comprehensive set of developer-focused features including built-in tools for Google Search grounding, file operations, shell commands, web fetching, and extensible architecture through Model Context Protocol (MCP) support.
npm install -g @google/gemini-cligeminiThe Gemini CLI is primarily designed as a command-line binary tool and does not expose a public programmatic API for import. It is intended to be used via the gemini command-line interface.
# Install and use as CLI tool
npm install -g @google/gemini-cli
gemini --help# Start interactive conversation
gemini
# Start with initial prompt
gemini "Explain TypeScript generics"
# Use with specific model
gemini --model gemini-2.0-flash-exp "Review this code"
# Enable sandbox mode
gemini --sandbox "Create a Node.js server"# Process input from stdin
echo "What is recursion?" | gemini --prompt "Explain this concept"
# One-shot prompt execution
gemini --prompt "Generate a README for my project" --yoloGemini CLI is built around several key architectural components:
Core CLI functionality with comprehensive option support for model selection, execution modes, context configuration, and tool management.
// Global CLI options interface
interface CliArgs {
// Model and generation
model?: string;
prompt?: string;
promptInteractive?: string;
// Execution environment
sandbox?: boolean | string;
sandboxImage?: string;
debug?: boolean;
yolo?: boolean;
approvalMode?: 'default' | 'auto_edit' | 'yolo';
// Context and files
allFiles?: boolean;
includeDirectories?: string[];
checkpointing?: boolean;
// Tool configuration
allowedTools?: string[];
allowedMcpServerNames?: string[];
extensions?: string[];
listExtensions?: boolean;
// Telemetry and monitoring
telemetry?: boolean;
telemetryTarget?: 'local' | 'gcp';
telemetryOtlpEndpoint?: string;
telemetryOtlpProtocol?: 'grpc' | 'http';
telemetryLogPrompts?: boolean;
telemetryOutfile?: string;
showMemoryUsage?: boolean;
// UI and accessibility
screenReader?: boolean;
sessionSummary?: string;
proxy?: string;
experimentalAcp?: boolean;
// Positional arguments
promptWords?: string[];
}Slash commands and interactive features for managing conversations, settings, tools, and extensions within the terminal interface.
// Interactive slash commands (invoked via /command syntax)
type SlashCommand =
| 'help' | 'quit' | 'exit' | 'clear' | 'stats'
| 'settings' | 'theme' | 'auth' | 'memory'
| 'tools' | 'extensions' | 'mcp'
| 'chat' | 'vim' | 'editor';Hierarchical settings system supporting system-wide, user-specific, and workspace-specific configuration with extensive customization options.
interface Settings {
general?: GeneralSettings;
ui?: UISettings;
model?: ModelSettings;
context?: ContextSettings;
tools?: ToolsSettings;
security?: SecuritySettings;
mcp?: MCPSettings;
mcpServers?: Record<string, MCPServerConfig>;
}
enum SettingScope {
SystemDefaults = 'systemDefaults',
System = 'system',
User = 'user',
Workspace = 'workspace'
}Plugin architecture enabling custom functionality through extensions and MCP (Model Context Protocol) server integration.
interface Extension {
path: string;
config: ExtensionConfig;
contextFiles: string[];
installMetadata?: ExtensionInstallMetadata;
}
interface ExtensionConfig {
name: string;
version: string;
mcpServers?: Record<string, MCPServerConfig>;
contextFileName?: string | string[];
excludeTools?: string[];
}Model Context Protocol integration for connecting external tools and services with support for multiple transport types and server management.
interface MCPServerConfig {
// Stdio transport
command?: string;
args?: string[];
env?: Record<string, string>;
// HTTP/SSE transport
url?: string;
httpUrl?: string;
headers?: Record<string, string>;
// Configuration
timeout?: number;
trust?: boolean;
description?: string;
includeTools?: string[];
excludeTools?: string[];
}Comprehensive theming system with built-in themes, custom theme support, and accessibility features for terminal interface customization.
interface Theme {
name: string;
type: 'light' | 'dark' | 'ansi' | 'custom';
primary?: string;
secondary?: string;
background?: string;
foreground?: string;
}
interface ThemeManager {
getAvailableThemes(): string[];
setActiveTheme(name: string): void;
getActiveTheme(): Theme;
loadCustomThemes(themes: Record<string, Theme>): void;
}