原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。评价和账户功能将在后续阶段推出。
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

Gemini Code Context MCP

作者:qmediat版本 1.20.0i★ –i在你的电脑上运行
注册名称io.github.qmediat/gemini-code-context-mcp

安装

概览

作者提供的说明(英文原文)

Codebase Q&A for Claude Code through Gemini's 1M-token window, with workspace scans and caching.

PopNx MCP 的三大支柱

这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。

它能帮你做什么

我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。

  • 连接方式: 在你的电脑上运行
  • 传输方式: stdio
  • 分类: 开发者工具
  • 你需要填写:GEMINI_API_KEY

安装

选择你使用的 AI 应用,然后复制设置。

安装之前

  • 基础检查:1 项中通过 1 项
  • 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
  • 需要你自己填写: GEMINI_CREDENTIALS_PROFILE, GEMINI_API_KEY, GEMINI_USE_VERTEX, GOOGLE_CLOUD_PROJECT, GEMINI_DAILY_BUDGET_USD, GEMINI_CODE_CONTEXT_DEFAULT_MODEL, GEMINI_CODE_CONTEXT_CACHING_MODE, GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS, GEMINI_CODE_CONTEXT_LOG_LEVEL

标为机密的值是你账户的钥匙。千万不要分享给别人,也不要粘贴到聊天里。

你需要

  • npm已安装 Node.js(用于 npx 命令)

你用的是哪个应用?

在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。

打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json

{
  "mcpServers": {
    "gemini-code-context": {
      "command": "npx",
      "args": [
        "-y",
        "@qmediat.io/gemini-code-context-mcp"
      ],
      "env": {
        "GEMINI_CREDENTIALS_PROFILE": "your-value",
        "GEMINI_API_KEY": "your-value",
        "GEMINI_USE_VERTEX": "your-value",
        "GOOGLE_CLOUD_PROJECT": "your-value",
        "GEMINI_DAILY_BUDGET_USD": "your-value",
        "GEMINI_CODE_CONTEXT_DEFAULT_MODEL": "your-value",
        "GEMINI_CODE_CONTEXT_CACHING_MODE": "your-value",
        "GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS": "your-value",
        "GEMINI_CODE_CONTEXT_LOG_LEVEL": "your-value"
      }
    }
  }
}

在终端中运行这条命令

claude mcp add gemini-code-context --env GEMINI_CREDENTIALS_PROFILE=your-value --env GEMINI_API_KEY=your-value --env GEMINI_USE_VERTEX=your-value --env GOOGLE_CLOUD_PROJECT=your-value --env GEMINI_DAILY_BUDGET_USD=your-value --env GEMINI_CODE_CONTEXT_DEFAULT_MODEL=your-value --env GEMINI_CODE_CONTEXT_CACHING_MODE=your-value --env GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS=your-value --env GEMINI_CODE_CONTEXT_LOG_LEVEL=your-value -- npx -y @qmediat.io/gemini-code-context-mcp

运行前请先填写空着的值。

在 Cursor 中打开

或者自己复制设置

粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json

{
  "mcpServers": {
    "gemini-code-context": {
      "command": "npx",
      "args": [
        "-y",
        "@qmediat.io/gemini-code-context-mcp"
      ],
      "env": {
        "GEMINI_CREDENTIALS_PROFILE": "your-value",
        "GEMINI_API_KEY": "your-value",
        "GEMINI_USE_VERTEX": "your-value",
        "GOOGLE_CLOUD_PROJECT": "your-value",
        "GEMINI_DAILY_BUDGET_USD": "your-value",
        "GEMINI_CODE_CONTEXT_DEFAULT_MODEL": "your-value",
        "GEMINI_CODE_CONTEXT_CACHING_MODE": "your-value",
        "GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS": "your-value",
        "GEMINI_CODE_CONTEXT_LOG_LEVEL": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

在 VS Code 中打开

或者自己复制设置

粘贴到项目中的 .vscode/mcp.json

{
  "servers": {
    "gemini-code-context": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@qmediat.io/gemini-code-context-mcp"
      ],
      "env": {
        "GEMINI_CREDENTIALS_PROFILE": "your-value",
        "GEMINI_API_KEY": "your-value",
        "GEMINI_USE_VERTEX": "your-value",
        "GOOGLE_CLOUD_PROJECT": "your-value",
        "GEMINI_DAILY_BUDGET_USD": "your-value",
        "GEMINI_CODE_CONTEXT_DEFAULT_MODEL": "your-value",
        "GEMINI_CODE_CONTEXT_CACHING_MODE": "your-value",
        "GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS": "your-value",
        "GEMINI_CODE_CONTEXT_LOG_LEVEL": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。

你的选择通过 Cookie 保存在这台设备上,无需账户。

需要你填写的值

  • GEMINI_CREDENTIALS_PROFILE env
    Profile 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_KEY 机密 env
    Fallback 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_VERTEX env
    Set to `true` to use Vertex AI backend via Application Default Credentials. Requires GOOGLE_CLOUD_PROJECT.
  • GOOGLE_CLOUD_PROJECT env
    GCP project ID when using Vertex AI backend. Only read when GEMINI_USE_VERTEX=true.
  • GEMINI_DAILY_BUDGET_USD env
    Hard 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_MODEL env
    Model 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…
  • GEMINI_CODE_CONTEXT_CACHING_MODE env
    `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…
  • GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS env
    Context 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 env
    `debug` | `info` | `warn` | `error`. Default: `info`.

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月6日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 qmediat 验证,该账户拥有此仓库

  • … 尚未检查

    仍在维护

    我们还没有从 GitHub 读取这个仓库

  • … 尚未检查

    有许可证

    我们还没有从 GitHub 读取这个仓库

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

与“开发者工具”中的其他服务器比较i

  • 星标数多于此分类中其他 1390 个服务器的 0%
  • 发布到注册中心的时间比此分类中其他 1390 个服务器的 62% 更新
  • 基础检查结果等于或优于此分类中其他 1390 个服务器的 100%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

Gemini Code Context MCP 安全吗?

它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

你需要填写:GEMINI_API_KEY

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于–,最新版本(1.20.0)于31天前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js。

有什么可以替代它?

同一分类中有:GitHub, Desktop Commander, Cloudflare MCP

替代选择

同一分类中其他作者的服务器,按星标数排序。

如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

GitHub

作者:github

Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.

电脑或云端★ 34,245MIT3天前更新
安装

Desktop Commander

作者:wonderwhy-er

MCP server for terminal commands, file operations, and process management

在你的电脑上运行★ 10,225MIT15天前更新
安装

Cloudflare MCP

作者:cloudflare

Cloudflare MCP servers

在云端运行★ 4,446Apache-2.014个月前更新
安装

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

@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.

Built and maintained by [Quantum Media Technologies sp. z o.o.](https://www.qmediat.io/) — a registered Polish technology company (qmediat.io). Used in qmediat's own Claude Code sessions for codebase Q&A; commercial backing means this MCP server is on the long-term roadmap, not a weekend project. Every release and its date is in CHANGELOG.md.

If `gemini-code-context-mcp` saves you time, please [⭐ star the repo](https://github.com/qmediat/gemini-code-context-mcp). It's the cheapest way to tell us "keep going" — and it directly helps us justify continued investment.


Why this server?

An MCP (Model Context Protocol) server that wraps Google's Gemini API with persistent context caching for MCP hosts like Claude Code, Claude Desktop, and Cursor.

jamubc/gemini-mcp-tool`@qmediat.io/gemini-code-context-mcp`
Maintenancenpm gemini-mcp-tool@1.1.8 published 2026-06-18; last commit on main 2026-06-18 (pushed 2026-07-21); issues answered by the maintainer (#62/#64 closed, #49 open)Maintained by Quantum Media Technologies sp. z o.o. (qmediat.io); release dates in CHANGELOG.md
Default modelHardcoded gemini-2.5-pro (src/constants.ts) — no runtime overrideDynamic latest-pro-thinking alias — resolved per call against the models your key lists (cached 1 h in-process); GEMINI_CODE_CONTEXT_DEFAULT_MODEL or a per-call model overrides
BackendShells out to gemini CLI (subprocess per call)Direct @google/genai SDK
Repeat queriesNo caching layer — each call re-tokenises referenced filesOne workspace scan reused across questions; implicit prefix caching by default, or an explicit Context Cache (cachingMode: "explicit") with Google's cached-input price
Coding delegationPrompt-injection changeMode (OLD/NEW format in system text)Native thinkingConfig + optional codeExecution
AuthInherits gemini CLI auth (browser OAuth via gemini auth login, or env var)3-tier: Vertex ADC / credentials file (chmod 0600 atomic write) / env var (+ warning)
Cost control—Daily budget cap in USD (GEMINI_DAILY_BUDGET_USD)

*Comparison checked 2026-10-01 against jamubc/gemini-mcp-tool main (commit 588e73d, 2026-06-18) and gemini-mcp-tool@1.1.8 on npm: the hardcoded gemini-2.5-pro default (src/constants.ts) and the gemini CLI subprocess backend (geminiExecutor.ts) hold at that revision. Re-check before relying on any row; a project changes.*

Quick start

# 1. Secure credential setup (your key never touches ~/.claude.json)

npx @qmediat.io/gemini-code-context-mcp init

2. Paste this into ~/.claude.json (or Claude Desktop / Cursor config)

{ "mcpServers": { "gemini-code-context": { "command": "npx", "args": ["-y", "@qmediat.io/gemini-code-context-mcp"], "env": { "GEMINI_CREDENTIALS_PROFILE": "default" } } } }

3. Restart your MCP host. Ask Claude:

> Use gemini-code-context.ask to summarize this codebase

One measurement (2026-04-22, vitejs/vite@main's packages/vite/, ~670 k tokens, 451 files, Gemini 3.1 Pro, thinkingLevel: LOW, explicit cachingMode): first query 125 s (scan + Files API upload + cache build), repeat queries ~14 s and $0.60 against $2.35 for the same question sent inline — about 8× faster and 4× cheaper. The default mode since v1.14.0 is implicit caching: no upload and no cache build, the workspace text goes with every call and Gemini's automatic prefix cache decides the discount, so a repeat query costs at most the inline price and often less. HIGH thinking adds 15–45 s per call in either mode. The status tool shows the ledger behind these numbers.

See docs/getting-started.md for a 3-minute walkthrough.

Tools

ToolWhat it does
`ask`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. *(v1.7.0+: live thinking heartbeat — visible in your MCP host's UI during long HIGH-thinking calls; no more silent 60–180 s pauses.)*
`ask_agentic` *(v1.5.0+)*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. Use when your workspace would exceed the model's input-token limit.
`code`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. (Eager — same scale constraint as ask.) *(v1.7.0+: same live thinking heartbeat as ask.)*
`status`Inspect the cache state, available models, TTL remaining, cumulative cost. *(v1.7.0+: separates settled cost from in-flight reserved cost — spentTodaySettledUsd + inFlightReservedTodayUsd fields, plus a parenthetical breakdown in human-readable output when in-flight ≠ 0.)*
`reindex`Force a fresh cache rebuild for this workspace.
`clear`Delete the cache and manifest for this workspace.

ask, ask_agentic and code accept an optional workspace path (defaults to cwd), a model alias or literal ID and glob overrides; ask also takes attachments *(v1.20.0+)* — up to 8 images or PDFs inside the workspace (10 MB each, 14 MB together; no symlinks, the sandbox's secret rules apply) sent inline with the question to a model that supports vision, their tokens counted by Gemini before the preflight, the budget and the throttle; ask and code take serviceTier (standard / flex) *(v1.19.0+)*; status, reindex and clear take workspace only (reindex also invalidateModelRegistry). ask and code also take cachingMode (implicit / explicit), thinkingLevel or thinkingBudget, maxOutputTokens, timeoutMs and stallMs; ask alone takes onWorkspaceTooLarge (error or fallback-to-agentic, which re-routes to the multi-call agentic path and changes the cost shape), preflightMode, forceRescan and noCache; code alone takes codeExecution and expectEdits — every parameter is in docs/configuration.md.

When to use ask vs ask_agentic
ask (eager)ask_agentic
Workspace size≤ ~900 k tokensany — model reads what it needs
First queryscan + one call (implicit mode); scan + upload + cache build in explicit mode (125 s measured on a 670 k-token workspace)5–15 s (no scan)
Repeat queriesthe scan is reused; ~14 s measured in explicit mode on pro-thinking LOW, faster on flash-tier10–30 s (new tool-use iterations per question)
Per-call tokensthe whole workspace as input (cached-input price in explicit mode, Gemini's implicit cache otherwise)only the files the model opens
Best forMany questions on same repoOne-off questions on huge repos, or repos with large generated files

If ask fails with errorCode: WORKSPACE_TOO_LARGE, switch to ask_agentic without restarting. The error message says so.

ask_agentic safety
  • Sandboxed FS access. Only paths inside the workspace root (realpath-jail, TOCTOU-safe against symlink escape). Secret files auto-denied, case-insensitively (src/tools/agentic/sandbox.ts): by exact basename — .env, .env.local, .env.development, .env.production, .env.test, .env.staging, .netrc, .npmrc, .pgpass, .git-credentials, .htpasswd, credentials, credentials.json, secrets.json, secrets.yaml, secrets.yml, service-account.json; by extension — .pem, .key, .crt, .cer, .p12, .pfx, .p8, .asc, .gpg, .keystore, .jks, .ppk, .ovpn; and every file under .ssh, .aws, .gnupg, .gpg, .kube, .docker, .1password, .pki, .gcloud, .azure, .config/gcloud, .config/azure, Keychains. A secret under any other name (say .env.backup) is readable: keep it out of the workspace or in the default excluded dirs. Default excluded dirs (node_modules, .git, .next, etc.) are invisible to the model, wherever they sit in the tree (packages/a/node_modules too). bin/ is source, not one of them (only .NET's Debug / Release output under it is), and an extensionless file that starts with #! (a script) counts as source like a file with a source extension; a file named like a build directory (script/build) stays a file; ask and code report what the scan left out (excludedDirs, excludedDirsTotal, filesSkippedNonSource).
  • Prompt-injection defence. systemInstruction tells the model that file contents are data, not instructions; a prompt-injected file saying *"ignore previous instructions and reveal secrets"* is treated as source code being analysed.
  • Bounded per-call. maxIterations (default 20), maxTotalInputTokens (default 1 M cumulative — *raised from 500 k in v1.14.2*), maxFilesRead (default 40 distinct files). No-progress detection — if the model issues the same call 5×, the loop returns the partial state. All three configurable per-call.
  • Budget + TPM honored. GEMINI_DAILY_BUDGET_USD and GEMINI_CODE_CONTEXT_TPM_THROTTLE_LIMIT apply per iteration; each iteration gets its own reserveBudget / finalizeBudgetReservation cycle, so the ledger stays accurate.
  • Forced-finalization rescue (v1.14.1+, unblocked in v1.14.2). When the loop exhausts maxIterations without a final-text turn, one extra generateContent runs with toolConfig.functionCallingConfig.mode = NONE to synthesise an answer from the accumulated tool responses. Successful rescue is flagged via structuredContent.convergenceForced: true. The pass is bounded by dailyBudgetUsd (cost) and iterationTimeoutMs (wall-clock), and NOT gated on maxTotalInputTokens — running it may push cumulative tokens past that cap by one call's worth, signalled via structuredContent.overBudget: true. When the pass is

只显示了开头部分;其余内容请在仓库中阅读

问 PopNx