Skip to main content

gemini-mcp

MCP gateway for massive-payload Gemini analysis on the AI Studio free tier. Runs on a small VPS; a local Freebuff Desktop agent sends huge bodies to it and gets back a compact consolidated result — the agent's own context stays clean.

  • Cascading Flash chain 3.8 → 3.7 → 3.6 → 3.5 → 3 via gemini-router (per key×model RPD/RPM/TPM ledger shared with tldr-digest).
  • Over-limit bodies: split into overlapping chunks, each marked [CHUNK N/M], analyzed separately, then consolidated (recursively if needed).
  • thinking_level default high, per-request override; opt-in overflow (flash-lite → gemma) when the daily quota is gone; hard stop otherwise; per-request wait policy for minute-limit resets (default: wait, countdown reported in progress).
  • Deep progress to the caller (MCP progress + logging notifications + embedded trace), rotating disk logs, gemini-mcp quota|logs|calls|doctor in the terminal.
  • Transports: SSH-stdio (primary) and streamable HTTP daemon (127.0.0.1, bearer).

Status

Stages 1–4 done; M0–M3 shipped → v0.2.0. Router core lives in gemini-router (v0.1.0, pinned git dep). This repo: MCP server (stdio + HTTP daemon), 4 tools, chunking pipeline with recursive consolidation, 3-level progress funnel, rotating logs + JSONL audit, terminal CLI. 34 tests green, no network needed. Next: M4 deployment to the VPS (needs the owner's machine — see plan).

Development

uv sync --extra dev    # gemini-router is a private git dep → GitHub auth required
                       # (GH_PAT_READ secret in CI; locally: git insteadOf with a PAT)
uv run pytest -q       # 34 tests: chunker, pipeline, tools/server, logging — all faked
uv run ruff check src tests
GEMINI_API_KEYS=... uv run gemini-mcp quota|calls|logs|prune|doctor
Stage Artifact
1 · Unpacking/reframing + Q&A docs/01-unpacking-reframing.md
2 · Functional/business requirements docs/02-requirements.md
3 · Architecture & stack docs/03-architecture.md
4 · Plan (M0–M6) docs/04-plan.md
Risks docs/blockers/

Planned usage (Freebuff, ~/.agents/mcp.json)

{ "mcpServers": {
    "gemini": {                       // A) SSH-stdio — primary, encrypted, no open ports
      "command": "ssh",
      "args": ["root@38.244.152.2", "/opt/apps/gemini-mcp/.venv/bin/gemini-mcp", "stdio"] },
    "gemini-http": {                  // B) HTTP via `ssh -L 8790:127.0.0.1:8790 root@38.244.152.2`
      "type": "http", "url": "http://127.0.0.1:8790/mcp",
      "headers": { "Authorization": "Bearer $GEMINI_MCP_TOKEN" } } } }

Tools: analyze_large (chunking pipeline), gemini_generate (single shot), quota_status, router_logs.

Deployment (M4)

From the workstation (sibling checkout of gemini-router required next to this repo):

bash scripts/run_remote.sh setup    # rsync both repos → venv, .env, systemd unit, doctor
bash scripts/run_remote.sh smoke    # first real-key run on the VPS (spends ≤1 RPD)
bash scripts/run_remote.sh status|logs

Freebuff Desktop wiring (SSH-stdio and HTTP-via-tunnel snippets, verification steps): docs/freebuff-wiring.md. The daemon never leaves 127.0.0.1:8790; no firewall changes are made (server-spec compliant).

Ops (after M4)

ssh root@38.244.152.2
sudo systemctl status gemini-mcp          # daemon (HTTP)
/opt/apps/gemini-mcp/.venv/bin/gemini-mcp quota    # what's left, per key×model
/opt/apps/gemini-mcp/.venv/bin/gemini-mcp logs -f  # live app log

Conventions: English in files, Conventional Commits, SemVer, docs updated with every functional change (see AGENTS.md).

Metadata

Release files for gemini-mcp-gateway 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gemini-mcp-gateway 0.7.1
File Size Uploaded
gemini_mcp_gateway-0.7.1.tar.gz 129.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gemini-mcp-gateway 0.7.1
File Interpreter ABI Platform
gemini_mcp_gateway-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 165.9 kB

Release files / gemini_mcp_gateway-0.7.1.tar.gz

Download URL gemini_mcp_gateway-0.7.1.tar.gz
Size 129.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8632ae40b4ee2aea98518360dd9a14cabb42e8e6e139d4f6d6216cc80413bac1
BLAKE2b-256 checksum
How to use checksums
38b4335e823385ea20d4b3b164b462fd186423547e3bae92dd83e53aa70d8705
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / gemini_mcp_gateway-0.7.1-py3-none-any.whl

Download URL gemini_mcp_gateway-0.7.1-py3-none-any.whl
Size 35.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3f385e94e0c43aee2ba4ff5b8b947a5f2a9b0c7d3aa94f0de07c376ab17aec5
BLAKE2b-256 checksum
How to use checksums
185947cecea0d1f859aaa74acdb99425d05852346f3414fb55194db84c83bc29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.12.0

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

This release

0.7.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page