Back to Documentation
Gemini logo

Gemini CLI Integration

Use ContextFS with Google Gemini CLI via MCP

Prerequisites

  • Gemini CLI installed (npm install -g @anthropic-ai/gemini-cli)
  • Python 3.10+ with pip or uv

Quick Install

1. Install ContextFS

pip install contextfs

Or with uv: uv tool install contextfs

2. Start the MCP Server

contextfs server start mcp

This starts the MCP server on port 8003 (default).

3. Configure Gemini CLI

Add this to your ~/.gemini/settings.json:

{
  "mcpServers": {
    "contextfs": {
      "type": "sse",
      "url": "http://127.0.0.1:8003/sse"
    }
  }
}

4. Restart Gemini CLI

Restart Gemini CLI to load the new MCP configuration. ContextFS tools will now be available.

Install as Background Service (Recommended)

For automatic startup, install the MCP server as a system service:

contextfs install-service mcp

This installs a launchd service (macOS) or systemd service (Linux) that starts automatically.

Available MCP Tools

Once configured, these tools are available in Gemini CLI:

Memory Operations

  • contextfs_save - Save memories
  • contextfs_search - Search memories
  • contextfs_recall - Recall by ID
  • contextfs_list - List recent
  • contextfs_evolve - Update with history
  • contextfs_link - Link memories

Repository Indexing

  • contextfs_init - Initialize repo
  • contextfs_index - Index codebase
  • contextfs_index_status - Check progress
  • contextfs_sync - Cloud sync

Cross-Tool Memory Sync

Share memories between Gemini CLI, Claude Code, and other tools:

# Enable cloud sync
contextfs cloud login
contextfs cloud sync

# Memories saved in Claude Code are now available in Gemini CLI

Next Steps