Gemini CLI — Configuration Reference (Enterprise)
Enterprise Gemini CLI configuration reference. Covers settings.json, MCP integration, .gemini/ directory conventions, sandbox providers, extension management, and environment variables for Vertex AI deployments.
Deprecated for public use:
Gemini CLI is no longer available for individual consumers. It has been replaced by Google Antigravity. Enterprise customers can continue using Gemini CLI through Vertex AI.
Gemini CLI — Configuration Reference (Enterprise)
Gemini CLI uses settings.json for configuration, .gemini/ for project files, and environment variables for auth and runtime overrides. Here's the complete reference.
settings.json
Located at ~/.gemini/settings.json (user) or .gemini/settings.json (workspace). Workspace values override user values. System administrators can also point to a system settings file with GEMINI_CLI_SYSTEM_SETTINGS_PATH.
{
"general": {
"vimMode": false,
"defaultApprovalMode": "default",
"checkpointing": {
"enabled": true
}
},
"ui": {
"theme": "GitHub",
"showLineNumbers": true
},
"model": {
"name": "gemini-3.1-pro-preview",
"maxSessionTurns": -1,
"compressionThreshold": 0.6
},
"tools": {
"sandbox": "sandbox-exec",
"shell": {
"enableInteractiveShell": true,
"showColor": false
},
"useRipgrep": true
},
"context": {
"fileName": ["GEMINI.md"],
"includeDirectories": []
},
"security": {
"toolSandboxing": false
}
}
Model Settings
The example above uses configured values; the table lists the schema defaults.
| Key | Description | Default |
|---|---|---|
model.name | Model ID | undefined (unset) |
model.maxSessionTurns | Max turns per session; -1 for unlimited | -1 |
model.compressionThreshold | Context fraction that triggers compression | 0.5 |
Sandbox Configuration
{
"tools": {
"sandbox": "docker"
}
}
tools.sandbox is unset by default, which leaves sandboxing disabled. Set it to true to enable sandboxing, or to a provider name such as "sandbox-exec", "docker", "podman", "runsc", "lxc", or "windows-native" to select a provider explicitly. You can also enable sandboxing per run with -s / --sandbox or GEMINI_SANDBOX; the command-line flag takes precedence over the environment variable, which takes precedence over the settings file.
.gemini/ Directory
.gemini/
├── settings.json # Workspace configuration
└── GEMINI.md # Optional project instructions
GEMINI.md can also live at the project root. Gemini CLI loads it as project memory; context.fileName changes the filename and context.includeDirectories adds directories to scan.
MCP Server Configuration
Add MCP servers under the top-level mcpServers key in settings.json:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/absolute/path/to/project"
]
}
}
}
The Filesystem server requires at least one allowed directory argument. The official GitHub and Postgres reference servers are archived, and their npm packages are deprecated; browse the MCP Registry for maintained alternatives.
Use /mcp in a session to inspect server status and tools.
Extensions
Extensions package prompts, MCP servers, and commands. They are installed and managed with the gemini extensions command rather than listed in settings.json:
gemini extensions install <source>
gemini extensions list
gemini extensions update <name>
gemini extensions disable <name>
gemini extensions enable <name>
gemini extensions uninstall <name>
Hooks
Hooks are configured in settings.json under the top-level hooks key. Each event takes an array of matcher entries with command hooks:
{
"hooks": {
"AfterTool": [
{
"matcher": "write_file|replace",
"hooks": [
{
"type": "command",
"command": "npm run lint"
}
]
}
]
}
}
Hook events include BeforeTool, AfterTool, BeforeAgent, AfterAgent, BeforeModel, AfterModel, Notification, SessionStart, SessionEnd, and PreCompress. Hooks are not shell scripts stored in .gemini/hooks/.
Environment Variables
| Variable | Purpose |
|---|---|
GEMINI_API_KEY | Gemini API key authentication |
GOOGLE_GENAI_USE_VERTEXAI | Set to true to use Vertex AI |
GOOGLE_CLOUD_PROJECT | Google Cloud project for Vertex AI |
GOOGLE_CLOUD_LOCATION | Vertex AI location |
GOOGLE_APPLICATION_CREDENTIALS | Service account JSON path |
GEMINI_MODEL | Override the default model |
GEMINI_SANDBOX | Enable sandboxing or select a provider |
GEMINI_CLI_SYSTEM_SETTINGS_PATH | Path to administrator-managed settings |
Related Pages
- MCP Setup in Gemini CLI — step-by-step MCP configuration
- Gemini CLI Getting Started — Installation and setup
- Prompt Engineering in Gemini CLI — prompting and context strategy
- MCP Section — Browse MCP servers
Sources
Related Articles & Guides
Codex CLI Configuration: config.toml Keys and Precedence
Configure Codex CLI: config.toml precedence, sandbox modes, approval policies, profiles, MCP servers, environment variables, and diagnostics.
Antigravity CLI — Configuration Reference
Complete configuration reference for Antigravity CLI. Settings.json, environment variables, MCP servers, plugins, trusted folders, and project context files.
Claude Code — Configuration Reference
Complete Claude Code configuration reference. Covers settings.json files, MCP server setup, hook configuration, .claude/ directory conventions, and environment variable overrides.