eagleisbatman/agrivision-mcp-server
If you are the rightful owner of agrivision-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
AgriVision is an AI-powered plant health diagnosis service using Model Context Protocol (MCP) to provide structured diagnostic data.
AgriVision MCP Server
AI-Powered Plant Disease & Health Diagnosis via Model Context Protocol
AgriVision is a region-agnostic plant health diagnosis service providing structured diagnostic data through MCP. Uses Google Gemini 2.5 Flash for accurate crop disease detection, pest identification, and nutrient deficiency analysis.
๐ Features
- AI Vision Analysis: Powered by Google Gemini 2.5 Flash (configurable)
- 23 Supported Crops: Cereals, legumes, vegetables, cash crops
- Disease Detection: Fungal, bacterial, viral with scientific names
- Pest Identification: Insects, mites, infestations
- Nutrient Analysis: Deficiency detection
- Growth Stage Assessment: Seedling to senescent
- Configurable Modes: Diagnosis-only or full advisory
- Structured Output: JSON or formatted text
- Region-Agnostic: Adaptable to any geography
๐ค AI Model: Google Gemini 2.5 Flash
Aspect | Details |
---|---|
Provider | Google AI |
Model | gemini-2.5-flash-image-preview |
Specialization | Vision + Language |
Strengths | Fast, accurate on plant images |
Output Tokens | Up to 2048 |
Alternative Models: gemini-2.0-flash-exp, gemini-1.5-pro, gemini-1.5-flash
Configure via GEMINI_IMAGE_MODEL
environment variable.
๐ Quick Start
git clone https://github.com/eagleisbatman/agrivision-mcp-server.git
cd agrivision-mcp-server
npm install
cp .env.example .env
# Add your GEMINI_API_KEY to .env
npm run dev
Get API Key: https://makersuite.google.com/app/apikey
โ๏ธ Configuration
Required
GEMINI_API_KEY=your_key_here
Advisory Mode (Important!)
ADVISORY_MODE=diagnosis_only # or "full_advisory"
- diagnosis_only (default): Returns diagnostic data only. Client agent generates region-specific treatment.
- full_advisory: Returns diagnosis + AI treatment recommendations.
Output Format
OUTPUT_FORMAT=structured # or "text"
- structured (default): JSON with typed fields
- text: Formatted text with emojis
Model Selection
GEMINI_IMAGE_MODEL=gemini-2.5-flash-image-preview
๐ API Endpoints
GET /health
{
"status": "healthy",
"model": "gemini-2.5-flash-image-preview",
"advisoryMode": "diagnosis_only",
"supportedCrops": 23
}
POST /mcp
MCP protocol endpoint for tool calls.
๐ ๏ธ MCP Tool: diagnose_plant_health
Parameters
image
(required): Base64-encoded image (data:image/jpeg;base64,...
)crop
(optional): Expected crop type (e.g.,maize
,tomato
)
Supported Crops (23)
Cereals: maize, wheat, rice, sorghum, millet Legumes: beans, cowpea, pigeon_pea, groundnut Roots: cassava, sweet_potato, potato Vegetables: tomato, cabbage, kale, onion Cash Crops: tea, coffee, sugarcane, banana, sunflower, cotton
Response (diagnosis_only + structured)
{
"crop": {"name": "Maize", "scientific_name": "Zea mays", "confidence": "High"},
"health_status": {"overall": "Moderate Issue", "confidence": "High"},
"issues": [{
"name": "Fall Armyworm",
"scientific_name": "Spodoptera frugiperda",
"category": "Pest",
"severity": "Moderate",
"symptoms": ["Irregular holes", "Frass visible"]
}],
"growth_stage": "Vegetative"
}
๐ Region-Agnostic Design
Diagnostic data uses scientific terminology. Client agents add regional context.
Architecture:
Image โ AgriVision (diagnosis_only) โ Agent Builder โ Region-specific advice
Example: Same diagnosis, different regions:
- Kenya: "Use Neem oil from local agro-dealer"
- India: "Apply Bt from Krishi Bhawan"
- USA: "Use recommended Bt from ag store"
๐ฆ Deploy to Railway
- Push to GitHub
- Create project on railway.app from GitHub repo
- Set environment variables:
- GEMINI_API_KEY
- ADVISORY_MODE=diagnosis_only
- OUTPUT_FORMAT=structured
- Deploy automatically
- Test:
curl https://your-app.up.railway.app/health
๐ OpenAI Agent Builder Integration
-
Add MCP connection:
- URL:
https://your-app.up.railway.app/mcp
- Type: StreamableHTTP
- URL:
-
System Prompt:
When users share images, use `diagnose_plant_disease` tool.
Tool returns diagnostic data only.
YOU must generate region-specific treatment advice.
๐งช Testing
node test-diagnosis.js /path/to/image.jpg
๐ License
MIT - Built with โค๏ธ by Digital Green Foundation
Support: GitHub Issues or support@digitalgreen.org