gemini-vision-mcp-safe
Allows sending images to Google Gemini for analysis, including description, text extraction, and comparison.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gemini-vision-mcp-safe Analyze image at https://example.com/photo.jpg"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gemini-vision-mcp-safe
English|简体中文
A minimal, privacy-conscious MCP server that lets an MCP client (Claude Code, Claude Desktop, etc.) ask Google Gemini to look at an image — local file or URL — and return a description, text extraction, comparison, and so on.
The "safe" in the name is a design goal:
Two-step handshake before any image leaves the machine. The first call returns a Chinese confirmation prompt; the second call (with
confirm_send_to_gemini=true) is the only one that actually talks to Gemini. This stops a model from silently uploading user files to Google.SSRF defenses for URL inputs: protocol allowlist, manual redirect handling, per-hop DNS check against private/loopback ranges, HTTPS→HTTP downgrade refused.
Magic-byte sniffing instead of trusting file extensions or
Content-Type.Configurable size cap with both
Content-Lengthpre-check and a hard streaming limit; remote bodies stream to a temp file that is removed infinally.Proxy aware via
HTTPS_PROXY/HTTP_PROXY. Useful where Google APIs are not directly reachable (e.g. mainland China through clash/mihomo). The proxy URL is redacted in logs.API key in
.env, not in the MCP config. The repo's.gitignoreexcludes.envso the key never ends up in git.
Result text and error messages are in Chinese.
Tools
analyze_image_with_gemini
Send one local image or one HTTP/HTTPS image URL to Gemini.
Parameter | Required | Description |
| yes | Local path ( |
| no | What to ask Gemini. Defaults to a Chinese "describe this image" prompt. |
| no | Override the model for this call (e.g. |
| no | Must be |
analyze_images_batch
Send 2–5 images in a single Gemini call (good for "compare these screenshots" or multi-page documents).
Parameter | Required | Description |
| yes | Array of 2–5 paths or URLs. Mixed is fine. |
| no | What to ask Gemini across all images. |
| no | Same as above. |
| no | Same handshake. |
If one image fails to load, the error message tells you which one
(第 N 张: …).
Related MCP server: nanobanana-mcp
Install
git clone https://github.com/nianshou555qiansui/gemini-vision-mcp-safe.git
cd gemini-vision-mcp-safe
npm install
npm run build
cp .env.example .env # then edit .env, paste your Gemini API keyGet a key at https://aistudio.google.com/apikey.
Wire it up
Claude Code
~/.claude.json (or claude_desktop_config.json for Claude Desktop):
{
"mcpServers": {
"gemini-vision-safe": {
"type": "stdio",
"command": "node",
"args": [
"--env-file=/absolute/path/to/gemini-vision-mcp-safe/.env",
"/absolute/path/to/gemini-vision-mcp-safe/dist/index.js"
],
"env": {
"HTTPS_PROXY": "http://127.0.0.1:7890",
"HTTP_PROXY": "http://127.0.0.1:7890"
}
}
}
}--env-file requires Node ≥ 20.6. The env block in MCP config is for
non-secret settings (proxy address); the API key lives in .env so it
never ends up in version control or shared configs.
On Windows where the launcher needs a shell, use cmd /c node … instead of
node ….
Configuration
.env keys (see .env.example):
Key | Default | Notes |
| (required) | Your key from Google AI Studio. |
|
| Default model. Per-call |
|
| Hard cap. Remote images that exceed this via |
|
| Per-hop URL fetch timeout. |
|
| SDK-level timeout for the Gemini call. |
|
| Set |
|
| Set |
|
| Set |
| unset | Used by both |
Privacy notes
A local file path stays local; only the bytes of the file you confirm travel to Gemini.
A URL is fetched from your machine first, then forwarded to Gemini — the original host sees your IP (or your proxy's), but never sees Google. Conversely Google never sees the original host.
The repo never contains an API key. Verify before committing:
git ls-files | grep -F .envshould print nothing.
Caveats
DNS rebinding / TOCTOU is not mitigated: the SSRF check uses the OS resolver, but the actual TCP connect resolves again. Acceptable for local use; not safe to expose this MCP as a public service.
The OS resolver does not go through
HTTPS_PROXY. If your local DNS is unreliable, prefer URLs whose hostnames you've already pre-resolved or run a trusted DNS upstream.Per-region Gemini availability is Google's decision. The error mapper will tell you when it sees 403 / 429 / 503.
License
MIT — see LICENSE.
Available Tools
2 toolsanalyze_images_batchARead-only
Batch analyze multiple images (2-5) using Google Gemini Vision.
Same privacy rules as analyze_image_with_gemini apply. Useful for comparing screenshots, before/after views, or multi-page documents.
Supported inputs: local file paths or HTTP/HTTPS image URLs (can mix).
Inputs: image_sources (required), prompt, model, confirm_send_to_gemini.
analyze_image_with_geminiARead-only
Analyze a local image file or image URL using Google Gemini Vision.
PRIVACY RULES:
Use this tool ONLY when the current main model cannot natively understand images.
If the current main model has native vision capability, do NOT use this tool unless the user explicitly asks to use Gemini.
Before calling this tool with confirm_send_to_gemini=true, you MUST ask the user for consent.
The image bytes and prompt will be sent to Google Gemini API.
If image_source is a URL, this MCP downloads the image from your machine first, then sends bytes to Gemini.
If the user has not explicitly agreed, omit confirm_send_to_gemini or set it to false to show a confirmation notice only.
Supported inputs:
Local file path, e.g. C:/Users/me/Desktop/image.png
HTTP/HTTPS image URL, e.g. https://example.com/image.png
Inputs: image_source (required), prompt, model, confirm_send_to_gemini.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one for single image analysis and one for batch analysis (2-5 images). There is no overlap, and the descriptions make the difference explicit.
Both tools start with 'analyze' but differ in structure: 'analyze_images_batch' uses plural and 'batch' suffix, while 'analyze_image_with_gemini' uses singular and includes 'with_gemini', which is redundant given the server name. This inconsistency in naming conventions reduces clarity.
With only 2 tools, the set feels thin for a vision analysis server. While these cover basic single and batch analysis, more tools (e.g., different analysis types or output formats) would be expected for a well-scoped server.
The tools provide basic functionality for image analysis (single and batch), but lack features like returning different output formats, handling streaming, or supporting varied prompts. The surface is minimal and may leave agents needing additional capabilities.
Maintenance
Related MCP Connectors
MCP server for Qwen Image 3 AI image generation
MCP server for Google Veo AI video generation
MCP server for Flux AI image generation
MCP server for Grok Imagine AI video generation
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server for image generation using the Gemini API.1160 npm2MIT
- AlicenseAqualityCmaintenanceA security-hardened MCP server for generating and editing images using Google Gemini models. It provides tools for text-to-image creation and iterative image editing with strict input validation and secure file handling.31MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that analyzes images using OpenRouter's Gemini Flash model, supporting local file paths and URLs.-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides AI-powered image generation through Google Gemini models with intelligent selection between Flash (speed) and Pro (quality) modes, supporting up to 4K resolution and advanced features like Google Search grounding.MIT