MCP Image Server
Uses Google's Gemini 2.0 Flash AI to analyze a composite of searched images and select the best match for the user's query.
Searches for images from Pexels based on a query, with optional fallback to Lorem Picsum.
Searches for images from Unsplash based on a query, with optional fallback to Lorem Picsum.
Click on "Install 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., "@MCP Image ServerFind the best image of a sunset over mountains"
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.
MCP Image Server
An intelligent MCP (Model Context Protocol) server that searches for images, labels them, combines them into a composite image, and uses Google's Gemini 2.0 Flash AI to select the best match for your query.
Features
š Image Search: Searches multiple sources (Unsplash, Pexels, with fallback to Lorem Picsum)
š·ļø Smart Labeling: Labels each image (1-20) with black borders for easy identification
š¼ļø Image Composition: Combines all images into a single grid view
š¤ AI Selection: Uses Google's Gemini 2.0 Flash to intelligently select the best matching image
š¦ Base64 Output: Returns images as base64 for easy integration
Related MCP server: Nano-Banana MCP Server
Installation
Clone or download this repository
Install dependencies:
npm installCopy the environment template:
copy .env.example .envEdit
.envand add your API keys:GOOGLE_AI_API_KEY=your_google_ai_api_key_here UNSPLASH_ACCESS_KEY=your_unsplash_access_key_here PEXELS_API_KEY=your_pexels_api_key_here
Getting API Keys
Google AI API Key (Required for AI selection)
Go to Google AI Studio
Create a new API key
Add it to your
.envfile asGOOGLE_AI_API_KEY
Unsplash API Key (Optional but recommended)
Go to Unsplash Developers
Create a new application
Get your Access Key
Add it to your
.envfile asUNSPLASH_ACCESS_KEY
Pexels API Key (Optional but recommended)
Go to Pexels API
Create a free account and get your API key
Add it to your
.envfile asPEXELS_API_KEY
Usage
Development Mode
npm run devBuild and Run
npm run build
npm startUsing with Claude Desktop
Add this server to your Claude Desktop configuration:
{
"mcpServers": {
"mcp-image-server": {
"command": "node",
"args": ["C:/path/to/your/project/build/index.js"]
}
}
}Available Tools
search_and_select_best_image
Searches for images matching your query and returns the AI-selected best match.
Parameters:
query(string, required): The search query for imagesmaxImages(number, optional): Maximum number of images to search (1-20, default: 20)
Example usage in Claude:
"Search for the best image of a sunset over mountains"How It Works
Search: Queries multiple image APIs (Unsplash, Pexels) for relevant images
Download: Downloads up to 20 images and resizes them to thumbnails
Label: Adds numbered labels (1-20) with black borders to each image
Compose: Combines all labeled images into a single grid
AI Analysis: Sends the composite to Google's Gemini 2.0 Flash with your original query
Select: AI analyzes each numbered image and selects the best match
Return: Downloads and returns the selected image as base64
Error Handling
If no API keys are provided, the server uses placeholder images from Lorem Picsum
If Google AI API is not available, it uses a fallback selection algorithm
Failed image downloads are replaced with placeholder images
All errors are logged to stderr for debugging
Project Structure
src/
āāā index.ts # Main MCP server entry point
āāā services/
āāā ImageSearchService.ts # Handles image search from various APIs
āāā ImageProcessingService.ts # Processes and combines images
āāā AISelectionService.ts # Uses Google AI for selectionDevelopment
npm run dev- Run in development mode with auto-restartnpm run build- Build TypeScript to JavaScriptnpm run clean- Clean build directory
License
MIT License
Contributing
Feel free to submit issues and enhancement requests!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityAmaintenanceA MCP server that provides AI-powered image generation capabilities through Google's Gemini 2.5 Flash Image model.Last updated4387MIT
- AlicenseAqualityDmaintenanceAn MCP server that provides AI image generation and editing capabilities using Google's Gemini 2.5 Flash Image API. It allows users to create new images from text, modify existing files, and perform iterative edits through natural language prompts.Last updated61,110MIT
- Alicense-qualityDmaintenanceAn 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.Last updatedMIT
- Alicense-qualityDmaintenanceAn MCP server that provides image generation capabilities using Google's Gemini 2.5 Flash Image Preview model.Last updated20MIT
Related MCP Connectors
MCP server for Wan AI video generation
MCP server for NanoBanana AI image generation and editing
MCP server for Google Veo AI video generation
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dev-tahir/get-best-image'
If you have feedback or need assistance with the MCP directory API, please join our Discord server