
Gemini Code Context Mcp
Connects Claude to Gemini's 2M-token context cache, turning your codebase into persistent memory for repeat queries. Three patterns: `ask` eagerly uploads the whole workspace and caches it (measured 8× faster, 4× cheaper on subsequent calls), `ask_agentic` lets Gemini lazily explore via sandboxed file tools for arbitrarily large repos, and `code` delegates implementation tasks with native thinking budget and optional execution. First run takes 45 seconds to 2 minutes to build the cache; follow-ups hit in 13 to 16 seconds. Backed by a Polish tech company (qmediat.io) running this in production, so it ships updates every week or two instead of going stale. Beats the unmaintained `gemini-mcp-tool` with direct SDK integration and actual caching.
- tools
- 6
- auth
- Secret needed
- transport
- STDIO
- env vars
- 9
- last updated
- Oct 6, 2026
Tools
6 toolsPublic tool metadata for what this MCP can expose to an agent.
askQ&A and long-context analysis against your workspace. Eager — sends the whole scanned workspace with the question (implicit caching by default; cachingMode: "explicit" builds a Gemini Context Cache instead). Best for repeat queries on a repo ≤ ~900 k tokens.
Q&A and long-context analysis against your workspace. Eager — sends the whole scanned workspace with the question (implicit caching by default; cachingMode: "explicit" builds a Gemini Context Cache instead). Best for repeat queries on a repo ≤ ~900 k tokens.
No parameter schema in public metadata yet.
ask_agenticSame question shape as ask, but agentic — Gemini uses sandboxed list_directory / find_files / read_file / grep tools to read only what each question needs. Scales to arbitrarily large repos; no eager upload.
Same question shape as ask, but agentic — Gemini uses sandboxed list_directory / find_files / read_file / grep tools to read only what each question needs. Scales to arbitrarily large repos; no eager upload.
No parameter schema in public metadata yet.
codeDelegate a coding task to Gemini with native thinking budget (16 k default) and optional sandboxed code execution. Returns structured OLD/NEW diffs Claude Code can apply directly.
Delegate a coding task to Gemini with native thinking budget (16 k default) and optional sandboxed code execution. Returns structured OLD/NEW diffs Claude Code can apply directly.
No parameter schema in public metadata yet.
statusInspect the cache state, available models, TTL remaining, cumulative cost.
Inspect the cache state, available models, TTL remaining, cumulative cost.
No parameter schema in public metadata yet.
reindexForce a fresh cache rebuild for this workspace.
Force a fresh cache rebuild for this workspace.
No parameter schema in public metadata yet.
clearDelete the cache and manifest for this workspace.
Delete the cache and manifest for this workspace.
No parameter schema in public metadata yet.
Sponsors
Configuration
GEMINI_CREDENTIALS_PROFILEProfile name in ~/.config/qmediat/credentials (chmod 0600). Created by `npx @qmediat.io/gemini-code-context-mcp init`. Recommended; keeps your API key out of ~/.claude.json.
GEMINI_API_KEYsecretFallback Tier 3 auth. Your Gemini API key. Emits a warning at startup recommending you move it to the credentials profile via the init command.
GEMINI_USE_VERTEXSet to `true` to use Vertex AI backend via Application Default Credentials. Requires GOOGLE_CLOUD_PROJECT.
GOOGLE_CLOUD_PROJECTGCP project ID when using Vertex AI backend. Only read when GEMINI_USE_VERTEX=true.
GEMINI_DAILY_BUDGET_USDHard daily USD cap enforced locally. Server refuses calls after the cap until UTC midnight. Unlimited if unset. Honoured by `ask`, `code`, and per-iteration by `ask_agentic`.
GEMINI_CODE_CONTEXT_DEFAULT_MODELModel alias (`latest-pro-thinking`, `latest-pro`, `latest-flash`, `latest-lite`, `latest-vision`) or literal model ID, read by ask, ask_agentic and code. Default: `latest-pro-thinking` (the thinking tier). code replaces a configured default that resolves but cannot reason or thin
GEMINI_CODE_CONTEXT_CACHING_MODE`implicit` (default since v1.14.0: the workspace text is sent inline, Gemini's automatic prefix cache decides any discount) or `explicit` (Files API upload + Context Cache with Google's cached-input price). Per-call `cachingMode` wins.
GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDSContext Cache TTL in seconds in explicit caching mode. Default: 3600 (1 hour). Hot workspaces (<10 min since last use) auto-refresh via background watcher.
GEMINI_CODE_CONTEXT_LOG_LEVEL`debug` | `info` | `warn` | `error`. Default: `info`.
Readme
@qmediat.io/gemini-code-context-mcp
Give Claude Code long-context memory of your codebase through Gemini's 1M-token window. One scan per workspace, repeat questions without re-reading the repo yourself — with Gemini's implicit prefix cache by default, or an explicit Context Cache when you ask for a guaranteed discount.
Details
- Repository
- github.com/qmediat/gemini-code-context-mcp
- Category
- AI & LLM Tools
- Package
@qmediat.io/gemini-code-context-mcp- Transport
- STDIO
- Auth
- Required
- Registry
- MCP registry, active