/ Directory / Playground / gemini-mcp-tool
● Community jamubc ⚡ Instant

gemini-mcp-tool

by jamubc · jamubc/gemini-mcp-tool

Let Claude call Google Gemini CLI for large-context file analysis — use Gemini's million-token window as a subroutine.

jamubc/gemini-mcp-tool bridges Claude (or any MCP client) to the Gemini CLI. Three tools: ask-gemini (file analysis with @ syntax), sandbox-test (run code in Gemini's sandbox), Ping. Lets you offload large-file and large-codebase analysis to Gemini's 1M-token context.

Why use it

Key features

Live Demo

What it looks like in practice

gemini-mcp-tool.replay ▶ ready
0/0

Install

Pick your client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "gemini-mcp-tool": {
      "command": "npx",
      "args": [
        "-y",
        "gemini-mcp-tool"
      ],
      "_inferred": true
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "gemini-mcp-tool": {
      "command": "npx",
      "args": [
        "-y",
        "gemini-mcp-tool"
      ],
      "_inferred": true
    }
  }
}

Cursor uses the same mcpServers schema as Claude Desktop. Project config wins over global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "gemini-mcp-tool": {
      "command": "npx",
      "args": [
        "-y",
        "gemini-mcp-tool"
      ],
      "_inferred": true
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "gemini-mcp-tool": {
      "command": "npx",
      "args": [
        "-y",
        "gemini-mcp-tool"
      ],
      "_inferred": true
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "gemini-mcp-tool",
      "command": "npx",
      "args": [
        "-y",
        "gemini-mcp-tool"
      ]
    }
  ]
}

Continue uses an array of server objects rather than a map.

~/.config/zed/settings.json
{
  "context_servers": {
    "gemini-mcp-tool": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "gemini-mcp-tool"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

claude mcp add gemini-mcp-tool -- npx -y gemini-mcp-tool

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use gemini-mcp-tool

How to analyze a massive file that doesn't fit Claude's context

👤 Developers working with giant logs, codebases, or documents ⏱ ~15 min intermediate

When to use: Claude can't fit the file, but Gemini can.

Prerequisites
  • Gemini CLI + Google API key — npm i -g @google/gemini-cli; then gemini config set with your key from aistudio.google.com
  • Install MCP — claude mcp add gemini-cli -- npx -y gemini-mcp-tool
Flow
  1. Offload analysis
    ask-gemini: @/var/log/app-2026-04.log — find all 5xx errors clustered around deploys in the last 72h, produce a table.✓ Copied
    → Gemini analyzes, returns compact summary
  2. Drill in with Claude
    Based on Gemini's summary, focus on the cluster around 2026-04-12 14:30 UTC and propose a root cause.✓ Copied
    → Claude reasons over the summary

Outcome: Result that neither model alone could produce in one shot.

Pitfalls
  • Sending sensitive logs to Gemini — Strip PII before invoking ask-gemini or use a self-hosted model instead
  • Token cost on Gemini Pro for huge inputs — Use Gemini Flash for cost; Pro only when accuracy matters
Combine with: filesystem

How to review an entire small codebase in one shot

👤 Engineers auditing small services ⏱ ~20 min intermediate

When to use: You want a holistic review that considers every file at once.

Flow
  1. Hand the whole repo
    ask-gemini: @./src/ — review for structural issues, repeated patterns that should be abstracted, and dead code.✓ Copied
    → Repo-wide observations
  2. Triage suggestions
    Of those, which 3 are highest impact? Name the files.✓ Copied
    → Prioritized list

Outcome: A reviewer's first pass produced in one prompt.

Pitfalls
  • Gemini loses detail on huge repos — If your src/ exceeds 500k tokens, narrow to subdirectories
Combine with: github

How to execute unsafe code in Gemini's sandbox

👤 Devs testing untrusted code snippets ⏱ ~5 min beginner

When to use: You want to try running something without letting it touch your machine.

Flow
  1. Submit to sandbox
    sandbox-test: run this Python script [paste] — report stdout/stderr and exit code.✓ Copied
    → Output without side effects on your machine

Outcome: Safe execution result.

Pitfalls
  • Sandbox doesn't have internet by default for most snippets — Check Gemini CLI sandbox docs for connectivity options

Combinations

Pair with other MCPs for X10 leverage

gemini-mcp-tool + filesystem

Pick files locally, pass @-references to Gemini

List all *.log files modified today via filesystem, then ask-gemini @ each to find anomalies.✓ Copied
gemini-mcp-tool + github

Review a PR by handing the full diff to Gemini's wide context

Fetch PR #4421 diff via github MCP, then ask-gemini to critique the whole diff as one coherent change.✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
ask-gemini prompt: str (may include @path refs), model?: 'flash'|'pro' Large-context analysis Gemini API call — Flash ~$0.075/1M input, Pro higher
sandbox-test code: str, language? Run untrusted code Gemini sandbox billing
Ping Sanity-check connection free

Cost & Limits

What this costs to run

API quota
Gemini AI Studio has free tier; paid tier is pay-per-token
Tokens per call
Large — this is the whole point. Plan for 100k-500k tokens per call.
Monetary
Gemini 2.5 Flash ~$0.075 per 1M input; Pro is ~20x more
Tip
Default to Flash. Escalate to Pro only when Flash is clearly wrong.

Security

Permissions, secrets, blast radius

Minimum scopes: Gemini API key
Credential storage: Gemini CLI stores key in ~/.config/gemini/
Data egress: File content goes to Google Gemini; subject to Google's Gemini API data policy
Never grant: Don't pass secrets in @-referenced files — they go straight to Google

Troubleshooting

Common errors and fixes

gemini-cli not found

Install globally: npm i -g @google/gemini-cli; ensure npm global bin is on PATH.

Verify: which gemini
401 from Gemini

Run gemini config to set your API key from aistudio.google.com.

Verify: gemini 'hello'
Token limit exceeded

Even Gemini has caps; trim @-references or use search to narrow files first.

Sandbox timeout

Long-running code needs higher timeout; or run locally in a container instead.

Alternatives

gemini-mcp-tool vs others

AlternativeWhen to use it insteadTradeoff
deep-research MCPYou want autonomous research, not raw Gemini accessDifferent shape; includes web search
openrouter MCPYou want multi-model access via one keyNo @-file syntax; less convenient for big-context

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills