MCP Gemini

io.github.crunchtools由 GitHub 帳號 crunchtools 發布v0.3.0更新於 Oct 24, 2026

MCP server for Google Gemini AI - text, image, video, research, and more

概覽

AI 產生的概覽

本機 MCP 伺服器,為助理提供 Google Gemini 工具,可進行文字問答、圖片與影片生成、文件與網址分析、研究、語音合成與程式碼執行。

可以做什麼
  • 用 Gemini 進行問答、腦力激盪、摘要,以及文字與程式碼分析,可選擇啟用 Google 搜尋接地
  • 生成與編輯圖片、用 Veo 生成影片,並進行多輪圖片編輯工作階段
  • 分析本機圖片、PDF 與 DOCX 等文件、網址和 YouTube 影片,包含表格擷取
  • 執行多步驟深度網路研究、追問後續問題並查看任務狀態
  • 文字轉語音、產生多角色對話音訊並列出可用聲音
  • 建立、查詢、列出與刪除內容快取,取得結構化 JSON 輸出、計算 token 數並透過 Gemini 執行 Python 程式碼
適用情境
適合需要讓助理呼叫 Google Gemini 模型進行多模態工作的情境,例如摘要 PDF 或 YouTube 影片、生成或編輯圖片與影片、進行帶搜尋接地的網路研究、產生語音,而不必自行撰寫 API 整合。
執行需求
以 PyPI 套件 mcp-gemini-crunchtools 透過 stdio 在本機執行(uvx 或 pip),也可使用容器映像。需要 Google Gemini API 金鑰,透過環境變數 GEMINI_API_KEY 提供,可在 Google AI Studio 建立。可選設定 GEMINI_OUTPUT_DIR 存放生成的媒體檔案;容器方式需掛載輸出目錄。需要連線至 Google API 的網路。
安裝前請注意
需要 Google Gemini API 金鑰,README 建議妥善保管並僅透過環境變數傳入。送往 Gemini 的請求(包含檔案內容、網址與提示詞)會傳送到 Google 的 API。生成的媒體會寫入設定的輸出目錄。程式碼執行工具會透過 Gemini 執行 Python,快取工具可刪除快取。使用可能產生 Google API 費用。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 MCP Gemini,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

MCP Gemini CrunchTools

A secure MCP (Model Context Protocol) server for Google Gemini AI - text, image, video, research, and more.

Overview

This MCP server is designed to be:

  • Secure by default - STRIDE threat model (see SECURITY.md), Pydantic input validation, and the API key held as a SecretStr to prevent accidental logging
  • No third-party services - Runs locally via stdio, your API key never leaves your machine
  • Cross-platform - Works on Linux, macOS, and Windows
  • Automatically updated - GitHub Actions monitor for CVEs and update dependencies
  • Containerized - Available at quay.io/crunchtools/mcp-gemini built on Hummingbird Python base image

Naming Convention

ComponentName
GitHub repocrunchtools/mcp-gemini
Containerquay.io/crunchtools/mcp-gemini
Python package (PyPI)mcp-gemini-crunchtools
CLI commandmcp-gemini-crunchtools
Module importmcp_gemini_crunchtools

Why Hummingbird?

The container image is built on the Hummingbird Python base image from Project Hummingbird, which provides:

  • Minimal CVE exposure - Hummingbird images are built with a minimal package set, dramatically reducing the attack surface compared to general-purpose images
  • Regular updates - Security patches are applied promptly, keeping CVE counts low
  • Optimized for Python - Pre-configured Python environment with uv package manager for fast, reproducible builds
  • Production-ready - Designed for production workloads with proper signal handling and non-root user defaults

This means your MCP server runs in a hardened environment with fewer vulnerabilities than typical Python container images.

Features

Query Tools (5 tools)

  • gemini_query - Query Gemini with optional Google Search grounding
  • gemini_brainstorm - Generate creative ideas on a topic
  • gemini_analyze_code - Analyze code for security, performance, bugs
  • gemini_analyze_text - Analyze text for sentiment, tone, content
  • gemini_summarize - Summarize content in various formats

Image Generation (4 tools)

  • gemini_generate_image - Generate images from text prompts (native Gemini)
  • gemini_generate_image_with_input - Edit/modify existing images
  • gemini_image_prompt - Craft effective image generation prompts
  • gemini_imagen_generate - Generate images using Google Imagen 4 models

Image Editing (4 tools)

  • gemini_start_image_edit - Start a multi-turn image editing session
  • gemini_continue_image_edit - Continue editing in an active session
  • gemini_end_image_edit - End an image editing session
  • gemini_list_image_sessions - List all active editing sessions

Image Analysis (1 tool)

  • gemini_analyze_image - Analyze and describe local image files

Search Tools (1 tool)

  • gemini_search - Web search using Gemini with Google Search grounding

Document Tools (3 tools)

  • gemini_analyze_document - Analyze PDFs, DOCX, TXT, etc.
  • gemini_summarize_pdf - Summarize PDF documents
  • gemini_extract_tables - Extract tables from documents

URL Tools (3 tools)

  • gemini_analyze_url - Analyze one or more URLs
  • gemini_compare_urls - Compare two URLs
  • gemini_extract_from_url - Extract specific data from a URL

Video Tools (2 tools)

  • gemini_generate_video - Generate videos using Veo
  • gemini_check_video - Check video generation status

YouTube Tools (2 tools)

  • gemini_youtube - Analyze YouTube videos
  • gemini_youtube_summary - Summarize YouTube videos

Voice Tools (3 tools)

  • gemini_speak - Convert text to speech
  • gemini_dialogue - Generate multi-voice dialogue audio
  • gemini_list_voices - List available voices

Research Tools (3 tools)

  • gemini_deep_research - Perform multi-step web research
  • gemini_check_research - Check research operation status
  • gemini_research_followup - Ask follow-up questions

Cache Tools (4 tools)

  • gemini_create_cache - Create content cache for repeated queries
  • gemini_query_cache - Query cached content
  • gemini_list_caches - List all active caches
  • gemini_delete_cache - Delete a cache

Structured Output Tools (2 tools)

  • gemini_structured - Get structured JSON output
  • gemini_extract - Extract structured data from text

Token Tools (1 tool)

  • gemini_count_tokens - Count tokens in content

Code Execution Tools (1 tool)

  • gemini_run_code - Execute Python code via Gemini

Total: 39 tools

Installation

With uvx (Recommended)

bash
uvx mcp-gemini-crunchtools

With pip

bash
pip install mcp-gemini-crunchtools

With Container

bash
# Create a shared output directory (required before first run)mkdir -p ~/.local/share/mcp-uploads-downloads
podman run -v ~/.local/share/mcp-uploads-downloads:/output:z \    -e GEMINI_API_KEY=your_key \    -e GEMINI_OUTPUT_DIR=/output \    quay.io/crunchtools/mcp-gemini

SELinux note: Use :z (lowercase, shared) instead of :Z (uppercase, private). MCP servers run as long-lived stdio processes. With :Z, files copied into the directory after container start won't have the container's private MCS label and will be invisible inside the container. The :z flag sets a shared container_file_t context that all containers and the host can read/write.

Tip: Use the same shared directory (~/.local/share/mcp-uploads-downloads/) across multiple MCP container servers (e.g., mcp-gemini and mcp-wordpress) so generated images are immediately available for WordPress upload without copying.

Configuration

Creating a Google Gemini API Key

  1. Navigate to Google AI Studio

  2. Create API Key

    • Click "Get API key" or "Create API key"
    • Select a Google Cloud project or create a new one
    • Click "Create API key in new project" (or select existing project)
  3. Copy Your API Key

    • IMPORTANT: Copy the API key immediately - store it securely!
    • The key starts with AI... (e.g., AIzaSy...)

Add to Claude Code

bash
claude mcp add mcp-gemini-crunchtools \    --env GEMINI_API_KEY=your_api_key_here \    -- uvx mcp-gemini-crunchtools

Or for the container version:

bash
# Create a shared output directory (required before first run)mkdir -p ~/.local/share/mcp-uploads-downloads
claude mcp add mcp-gemini-crunchtools \    --env GEMINI_API_KEY=your_api_key_here \    --env GEMINI_OUTPUT_DIR=/output \    -- podman run -i --rm \        -v ~/.local/share/mcp-uploads-downloads:/output:z \        -e GEMINI_API_KEY \        -e GEMINI_OUTPUT_DIR=/output \        quay.io/crunchtools/mcp-gemini

Optional: Set Output Directory (non-container)

For generated images, audio, and videos when running without a container:

bash
claude mcp add mcp-gemini-crunchtools \    --env GEMINI_API_KEY=your_api_key_here \    --env GEMINI_OUTPUT_DIR=$HOME/.local/share/mcp-uploads-downloads \    -- uvx mcp-gemini-crunchtools

Usage Examples

Query with Google Search

User: What are the latest developments in quantum computing?Assistant: [calls gemini_query with use_google_search=true]

Generate an Image

User: Generate a photorealistic image of a sunset over mountainsAssistant: [calls gemini_generate_image with prompt and style]

Analyze a PDF Document

User: Analyze this research paper at /path/to/paper.pdfAssistant: [calls gemini_analyze_document with file_path]

Summarize a YouTube Video

User: Summarize this YouTube video: https://youtube.com/watch?v=...Assistant: [calls gemini_youtube_summary with url]

Deep Research

User: Research the environmental impact of electric vehiclesAssistant: [calls gemini_deep_research then gemini_check_research]

Code Analysis

User: Analyze this Python code for security issuesAssistant: [calls gemini_analyze_code with focus="security"]

Security

This server was designed with security as a primary concern. See SECURITY.md for:

  • Threat model and attack vectors
  • Defense in depth architecture
  • API key handling best practices
  • Input validation rules
  • Audit logging

Key Security Features

  1. API Key Protection

    • Stored as SecretStr (never accidentally logged)
    • Environment variable only (never in files or args)
    • Sanitized from all error messages
  2. Input Validation

    • Pydantic models for all inputs
    • File path validation
    • URL validation
    • Strict format validation
  3. API Hardening

    • Hardcoded API base URL (prevents SSRF)
    • TLS certificate validation
    • Request timeouts
    • Response size limits
  4. Automated CVE Scanning

    • GitHub Actions scan dependencies weekly
    • Automatic PRs for security updates
    • Dependabot alerts enabled

Development

Setup

bash
git clone https://github.com/crunchtools/mcp-gemini.gitcd mcp-geminiuv sync

Run Tests

bash
uv run pytest

Lint and Type Check

bash
uv run ruff check src testsuv run mypy src

Build Container

bash
podman build -t mcp-gemini .

License

AGPL-3.0-or-later

Contributing

Contributions welcome! Please read SECURITY.md before submitting security-related changes.

Links

來源:README.md,提交 d75d79a

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分