AI Image Analysis MCP
Provides AI-powered image analysis using Google Gemini 2.0 Flash, including lifestyle and product analysis capabilities.
Allows uploading images to Supabase Storage with security validation and provides serverless deployment as a Supabase Edge Function.
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., "@AI Image Analysis MCPanalyze this image of a product"
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.
AI Image Analysis MCP v2.0
AI-Powered Image Analysis with Google Gemini 2.0
Model Context Protocol server with serverless deployment and multi-client access
🚀 Overview
The AI Image Analysis MCP v2.0 is a production-ready implementation that provides AI-powered image analysis using Google Gemini 2.0 Flash. This MCP features modular architecture, multiple client access methods, and comprehensive security with both local development and serverless production deployment options.
Key Features:
✅ Complete Implementation: Real Gemini 2.0 Flash integration (no mocks)
✅ Modular Architecture: Clean separation of concerns with reusable components
✅ Multiple Client Access: MCP, HTTP, Web UI, and cURL interfaces
✅ Serverless Ready: Full Supabase Edge Function deployment
✅ Enterprise Security: Comprehensive security validation and monitoring
✅ Image Integrity: Fixed corruption issues with proper MIME type handling
✅ Production Tested: Battle-tested with comprehensive error handling
Related MCP server: AI Vision MCP Server
🔒 Security Features
Multi-Layer Security Architecture
Input Validation: Comprehensive parameter validation and sanitization
Prompt Injection Detection: Advanced pattern matching to detect and block malicious prompts
File Path Validation: Prevention of directory traversal and unauthorized file access
URL Security: SSRF protection, domain blocking, private IP filtering, and protocol validation
Rate Limiting: Configurable request rate limiting to prevent abuse
PII Detection: Automatic detection and logging of potentially sensitive information
Audit Logging: Complete audit trail of all requests and responses
Security Configuration
const SECURITY_CONFIG = {
MAX_FILE_SIZE: 10 * 1024 * 1024, // 10MB
ALLOWED_MIME_TYPES: ['image/jpeg', 'image/jpg', 'image/png', 'image/webp'],
MAX_PROMPT_LENGTH: 10000,
RATE_LIMIT_WINDOW: 60000, // 1 minute
MAX_REQUESTS_PER_WINDOW: 30,
ENABLE_PII_DETECTION: true,
BLOCK_SUSPICIOUS_PATTERNS: true
}
// URL Security Features
const URL_SECURITY_CONFIG = {
TIMEOUT: 10000, // 10 seconds
MAX_REDIRECTS: 3,
BLOCKED_DOMAINS: ['localhost', '127.0.0.1', '169.254.169.254'],
ALLOWED_PROTOCOLS: ['https:', 'http:'],
PRIVATE_IP_BLOCKING: true, // Prevents SSRF attacks
BLOCKED_PORTS: [22, 23, 25, 53, 135, 139, 445, 3389, 5432, 6379]
}🛠️ Installation & Setup
Prerequisites
Node.js >= 18.0.0
Google AI API key (Gemini)
Optional: Supabase project for cloud storage
Local Installation
# Clone and install
git clone <repository-url>
cd ai-image-analysis-mcp
npm install
npm run build
# Set environment variables
export GEMINI_API_KEY="your_gemini_api_key_here"
export SUPABASE_URL="https://your-project.supabase.co" # Optional
export SUPABASE_ANON_KEY="your_anon_key_here" # For HTTP client
export SUPABASE_SERVICE_KEY="your_service_role_key_here" # OptionalClaude Desktop Configuration
Local MCP Server
{
"mcpServers": {
"ai-image-analysis": {
"command": "node",
"args": ["/path/to/ai-image-analysis-mcp/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key_here"
},
"description": "AI-powered image analysis using Google Gemini"
}
}
}Supabase Proxy (for Edge Functions)
{
"mcpServers": {
"ai-image-analysis-supabase": {
"command": "node",
"args": ["/path/to/ai-image-analysis-mcp/dist/mcp-supabase-proxy.js"],
"env": {
"SUPABASE_URL": "https://your-project.supabase.co",
"SUPABASE_ANON_KEY": "your_anon_key_here"
},
"description": "Supabase Edge Function MCP server proxy"
}
}
}Supabase Serverless Deployment ✅
# Initialize and deploy
supabase login
supabase link --project-ref YOUR_PROJECT_REF
supabase db reset
# Deploy Edge Function with real Gemini integration
supabase functions deploy ai-image-analysis-mcp
# Set production secrets
supabase secrets set GEMINI_API_KEY=your_key_here
supabase secrets set SUPABASE_URL=https://your-project.supabase.co
supabase secrets set SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Test deployment with MCP protocol
curl -X POST 'https://your-project.supabase.co/functions/v1/orbit-mcp-server' \
-H 'Authorization: Bearer YOUR_ANON_KEY' \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'See SUPABASE_DEPLOYMENT.md for complete deployment guide.
📊 Available Tools
1. analyze_image
Securely analyze an image using Google Gemini AI with automatic type detection.
// MCP format (Claude Desktop) - Local file
{
"tool": "analyze_image",
"parameters": {
"image_path": "/path/to/image.jpg",
"analysis_type": "lifestyle" // Optional: "lifestyle" or "product"
}
}
// MCP format (Claude Desktop) - URL
{
"tool": "analyze_image",
"parameters": {
"image_url": "https://example.com/image.jpg",
"analysis_type": "product"
}
}
// HTTP format (Direct API) - Base64 data
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "analyze_image",
"arguments": {
"image_data": "base64_encoded_image_data",
"analysis_type": "product"
}
}
}
// HTTP format (Direct API) - URL
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "analyze_image",
"arguments": {
"image_url": "https://example.com/image.jpg",
"analysis_type": "lifestyle"
}
}
}Response includes:
Comprehensive image analysis based on type (lifestyle or product)
Security scan results (including URL validation when applicable)
Processing metadata
Confidence scores
Image integrity validation
Source information (file, URL, or base64)
2. upload_to_supabase
Upload image data to Supabase Storage with security validation.
// MCP format
{
"tool": "upload_to_supabase",
"parameters": {
"image_data": "base64_encoded_image_data",
"bucket": "images",
"path": "uploads/image.jpg",
"metadata": { "analysis_version": "2.0" }
}
}
// HTTP format
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "upload_to_supabase",
"arguments": {
"image_data": "base64_encoded_image_data",
"bucket": "product-images",
"path": "uploads/product.jpg",
"metadata": { "source": "api-client" }
}
}
}3. get_security_status
Get current security configuration and audit information.
// Both MCP and HTTP formats
{
"tool": "get_security_status",
"parameters": {}
}🎯 Analysis Capabilities
Lifestyle Image Analysis
Scene Overview: Setting, time of day, season, occasion, primary activity
Human Elements: People count, demographics, interactions, emotional states, social dynamics
Environment: Location type, architectural/natural elements, spatial arrangement
Key Objects: Food, technology, furniture, personal items, defining props
Atmospheric Elements: Lighting, color palette, mood, sensory cues
Narrative Analysis: Story implications, lifestyle values, cultural significance
Photographic Elements: Composition, focal points, perspective, technical qualities
Marketing Potential: Target demographics, aspirational elements, brand opportunities
Product Image Analysis
Product Identification: Type, category, design style
Physical Characteristics: Color, material, texture, design elements
Structural Elements: Frame type, support systems, construction details
Design Attributes: Aesthetic category, visual weight, design influences
Commercial Analysis: Market positioning, target market, competitive advantages
Quality Assessment: Construction, materials, finish, durability indicators
🔧 Configuration Options
Environment Variables
# Required
GEMINI_API_KEY=your_gemini_api_key_here
# Optional - for cloud features and HTTP client
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_anon_key_here
SUPABASE_SERVICE_KEY=your_service_role_key_here
SUPABASE_FUNCTION_NAME=ai-image-analysis-mcp
# Optional - development
NODE_ENV=development
DEBUG=trueSecurity Settings
All security settings can be adjusted in the SECURITY_CONFIG object in src/index.ts:
MAX_FILE_SIZE: Maximum allowed file size (default: 10MB)ALLOWED_MIME_TYPES: Permitted image formatsRATE_LIMIT_WINDOW: Rate limiting time windowMAX_REQUESTS_PER_WINDOW: Maximum requests per windowENABLE_PII_DETECTION: Enable/disable PII scanning
🚨 Security Best Practices
For Production Deployment
API Key Security: Store API keys securely using environment variables
Rate Limiting: Configure appropriate rate limits for your use case
Input Validation: Always validate file paths and parameters
Audit Logging: Monitor the audit logs for suspicious activity
Network Security: Use HTTPS and proper CORS configuration
Access Control: Implement proper authentication for serverless deployments
Monitoring & Alerts
Monitor rate limit violations
Track failed authentication attempts
Alert on prompt injection detections
Monitor file access patterns
🛡️ Threat Model
Mitigated Threats
✅ Prompt injection attacks
✅ Directory traversal attacks
✅ Rate limiting bypass
✅ PII leakage
✅ Malicious file uploads
✅ Cross-site scripting (XSS)
Additional Considerations
Regular security audits
Dependency vulnerability scanning
API key rotation
Log monitoring and analysis
📈 Performance - Production Benchmarks
Gemini 2.0 Flash Response Times
Single Image Analysis: 3-5 seconds (real API calls)
Batch Processing: ~4 seconds per image with parallel processing
Supabase Upload: 1-2 seconds (size dependent)
Security Validation: <100ms (comprehensive checks)
Format Detection: <50ms (binary signature analysis)
Resource Usage - Optimized
Memory: ~150MB base + 30MB per concurrent analysis
CPU: Efficient during Gemini API calls
Network: Optimized with request batching and compression
Serverless: Cold start <2 seconds, warm requests <500ms
Scalability
Concurrent Users: 1000+ (Supabase Edge Functions)
Daily Processing: 10K+ images (with rate limiting)
Global Distribution: Multi-region deployment ready
🏗️ Project Structure
ai-image-analysis-mcp/
├── README.md # This file - user documentation
├── CLAUDE.md # Complete technical documentation
├── SUPABASE_DEPLOYMENT.md # Supabase deployment guide
├── HTTP_CLIENT_GUIDE.md # Complete HTTP client usage guide
├── package.json # Dependencies and scripts
├── src/
│ ├── index.ts # Local MCP server implementation
│ ├── supabase-mcp-client.ts # Direct HTTP client for Supabase
│ ├── api-client.ts # Simple REST API wrapper
│ ├── mcp-supabase-proxy.ts # MCP proxy for Claude Desktop
│ ├── modules/ # Modular architecture
│ │ ├── types.ts # TypeScript interfaces
│ │ ├── gemini-analysis.ts # AI analysis engine
│ │ ├── supabase-upload.ts # Storage operations
│ │ ├── security.ts # Security validation
│ │ ├── integrity.ts # Image integrity checks
│ │ └── audit.ts # Audit logging
│ └── utils/
│ └── mime-detection.ts # MIME type utilities
├── supabase/
│ ├── config.toml # Supabase project configuration
│ ├── seed.sql # Database schema
│ └── functions/
│ └── orbit-mcp-server/ # Serverless Edge Function
│ └── index.ts # MCP server over HTTP
├── examples/
│ ├── direct-http-examples.js # Node.js examples
│ ├── web-app-example.html # Web interface
│ └── curl-examples.md # Command-line examples
├── claude-desktop-config.json # Local MCP configuration
├── claude-desktop-config-supabase.json # Proxy configuration
└── dist/ # Compiled JavaScript files🔗 Integration Options
This MCP can be integrated with various systems:
Metadata Embedding: For XMP metadata embedding functionality
Storage Management: For advanced file operations and organization
Workflow Orchestration: Via Supabase Edge Functions for complex workflows
Custom Applications: For complete visual intelligence processing pipelines
📡 Deployment Options
Option 1: Local Claude Desktop
Direct MCP server running locally
Ideal for development and testing
Uses
src/index.tswith stdio transport
Option 2: Supabase Edge Function
Serverless deployment with global distribution
Enterprise-grade security and scaling
Uses
supabase/functions/orbit-gemini-analysis/index.tsREST API endpoints for integration
Option 3: Hybrid Approach
Local development with Claude Desktop
Production deployment via Supabase
Seamless transition between environments
🤝 Contributing
Development Setup
npm run dev # Watch mode development
npm run build # Production build
npm run security-check # Security auditTesting Security Features
# Test prompt injection detection
npm run test-security
# Manual testing with Claude Desktop
# Use the provided configuration and test each tool🆕 What's New in v2.0 - Production Ready
✅ Completed High-Priority Items
Real Gemini Integration - Complete implementation with Gemini 2.0 Flash (no more mocks)
Modular Architecture - Refactored from monolithic to clean modular design
Multiple Client Access - MCP, HTTP, Web UI, and cURL interfaces
Image Integrity Fixed - Resolved corruption issues with proper MIME type handling
Serverless Architecture - Full Supabase Edge Function deployment ready
Enterprise Security - Comprehensive validation, audit logging, and threat detection
Production Error Handling - Robust error recovery and detailed logging
✅ Core Improvements
Enhanced Security Features - Advanced prompt injection detection with base64 decoding
Multi-Source Support - Handle base64 data, Supabase Storage, and URLs seamlessly
URL Image Analysis - Secure URL fetching with SSRF protection and domain filtering
Rate Limiting & Monitoring - Production-grade request throttling and audit trails
Format Validation - Comprehensive image format detection and validation
Real-time Processing - Optimized for sub-5-second response times
Direct HTTP Client - Full-featured TypeScript client for programmatic access
Web Interface - Drag-and-drop browser interface for image analysis
✅ Deployment Ready
Complete Edge Function - Production-ready serverless deployment
Security Hardening - Input sanitization, integrity checks, and format validation
API Documentation - Complete REST API reference for integration
Monitoring & Alerts - Built-in health checks and performance metrics
Multiple Examples - Node.js, Web, and cURL usage examples
Comprehensive Guides - Complete documentation for all access methods
📚 Documentation
README.md (this file): Quick start and overview
CLAUDE.md: Complete technical documentation and API reference
SUPABASE_DEPLOYMENT.md: Detailed serverless deployment guide
claude-desktop-config.json: Ready-to-use Claude Desktop configuration
🌐 Multiple Client Access Methods
1. Claude Desktop (Local MCP)
Direct MCP integration via stdio transport
Uses
src/index.tswith modular architectureIdeal for development and testing
2. Claude Desktop (Supabase Proxy)
Bridge between Claude Desktop and Supabase Edge Function
Uses
src/mcp-supabase-proxy.tsEnables Claude Desktop to access serverless deployment
3. Direct HTTP Client
import { createSupabaseMCPClient } from './dist/supabase-mcp-client.js';
const client = createSupabaseMCPClient({
supabaseUrl: 'https://your-project.supabase.co',
anonKey: 'your_anon_key_here'
});
const result = await client.analyzeImageFromBase64(base64Data, 'product');4. Simple API Wrapper
import { initializeAPIFromEnv, analyzeImageFile } from './dist/api-client.js';
initializeAPIFromEnv();
const result = await analyzeImageFile('/path/to/image.jpg', {
analysisType: 'product',
uploadToStorage: true
});5. Web Interface
Complete HTML/JavaScript interface in
examples/web-app-example.htmlDrag-and-drop image upload
Real-time analysis results
Works in any modern browser
6. cURL/HTTP
# List available tools
curl -X POST "https://your-project.supabase.co/functions/v1/ai-image-analysis-mcp" \
-H "Authorization: Bearer YOUR_ANON_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# Analyze image from URL
curl -X POST "https://your-project.supabase.co/functions/v1/ai-image-analysis-mcp" \
-H "Authorization: Bearer YOUR_ANON_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "analyze_image",
"arguments": {
"image_url": "https://example.com/image.jpg",
"analysis_type": "product"
}
}
}'
# Analyze image from base64 data
curl -X POST "https://your-project.supabase.co/functions/v1/ai-image-analysis-mcp" \
-H "Authorization: Bearer YOUR_ANON_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "analyze_image",
"arguments": {
"image_data": "'$(base64 -i /path/to/image.jpg | tr -d '\n')'",
"analysis_type": "lifestyle"
}
}
}'📚 Complete Documentation
This project includes comprehensive documentation across multiple files:
README.md (this file): Quick start guide and overview
CLAUDE.md: Complete technical documentation with API reference and integration examples
HTTP_CLIENT_GUIDE.md: Complete guide for all HTTP client access methods
SUPABASE_DEPLOYMENT.md: Step-by-step serverless deployment guide
examples/curl-examples.md: Command-line usage examples
claude-desktop-config.json: Local MCP configuration
claude-desktop-config-supabase.json: Supabase proxy configuration
Quick References
Local Setup: See Installation & Setup section above
HTTP Client: Follow HTTP_CLIENT_GUIDE.md
Serverless Deploy: Follow SUPABASE_DEPLOYMENT.md
API Integration: Reference CLAUDE.md API section
Security Features: Details in CLAUDE.md Security section
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
Google AI Team: For Gemini multimodal AI capabilities
Anthropic: For the Model Context Protocol standard
Supabase Team: For serverless infrastructure platform
AI Image Analysis MCP v2.0 - Production-ready AI image analysis with Gemini 2.0
Production-Ready • Serverless • Multi-Client • Security-First • Open Source
🎯 Production Status: ✅ READY FOR DEPLOYMENT
Real Gemini 2.0 Integration: Complete implementation, no mocks
Modular Architecture: Clean, maintainable, and extensible codebase
Multiple Client Access: MCP, HTTP, Web UI, and cURL interfaces
Image Integrity Preserved: Fixed corruption issues with proper format handling
Serverless Architecture: Full Supabase Edge Function deployment
Enterprise Security: Comprehensive validation and monitoring
Performance Optimized: Sub-5-second response times at scale
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.
Latest Blog Posts
- 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/Desmond-Labs/ai-image-analysis-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server