FarmMate is a Python-based multi-agent system designed to assist farmers by combining expert crop disease diagnosis with real-time local weather observations.
This repository serves as an educational demo of the Model Context Protocol (MCP) and Agentic Design Patterns (ADK).
- The Problem & The Solution
- Architecture Diagram
- Dashboard Preview & Workflows
- How it Works: Key Concepts
- File Structure
- Setup & Installation
- Running the Application
- Camera Presentation Guide
When a farmer identifies symptoms of a crop disease (e.g. brown leaf spots), they need two critical pieces of information to act effectively:
- Diagnosis: What disease is this, and how is it treated?
- Context (Weather): Is it about to rain? Is it extremely windy? Is it scorching hot?
Applying treatment without checking the weather is wasteful and potentially harmful. For instance, spraying a liquid fungicide right before a heavy rain will wash the chemical away. Spraying botanical oils (like neem oil) during peak sun can burn plant foliage.
FarmMate solves this with an orchestrator-agent framework:
- The DiagnosisAgent identifies the disease and suggests remedies based on local crop knowledge.
- The WeatherAgent dynamically retrieves real-time weather details.
- The Orchestrator combines both outputs to create weather-aware action plans (e.g., advising the farmer to delay spraying until a storm passes, or adjusting irrigation).
Here is how data flows through the system:
[ Farmer / Streamlit UI ]
│
▼ (Submits crop problem & city)
[ Orchestrator ]
/ \
/ (Concurrent) \
▼ ▼
[DiagnosisAgent] [WeatherAgent]
│ │
├─► Reads Local └─► Spawns MCP client stdio transport
│ Knowledge File │
│ (farming_knowledge.md) └──► Connects to [Weather MCP Server]
│ │
└─► Calls Gemini API └─► Fetches Open-Meteo REST API
(diagnose symptoms) (lat/lon & forecast)
│ │
▼ ▼
(Diagnosis Report) (Weather Report)
\ /
\ /
└──► [ Orchestrator ] ◄────┘
│
├─► Synthesizes results using Gemini API
│
▼
[ Farmer / Streamlit UI ]
(Displays Unified Action Plan)
Below is a visual walk-through of the FarmMate Pro dashboard in action:
You can load symptom presets and cities with a single click to test different scenarios:

The system queries coordinates and fetches weather forecasts from Open-Meteo, displaying them in modern metric cards:

The orchestrator combines pathology with live weather constraints, providing direct spray timelines and a download report button:

MCP is an open standard that enables developers to build secure, modular integrations ("servers") that expose data and tools to AI models ("clients").
- In FarmMate,
weather_mcp.pyis the MCP Server. It exposes a tool calledget_weather. agents.pycontains the MCP Client code inside theWeatherAgent. It runs the server script as a subprocess, initializes the protocol, and calls theget_weathertool.
- Specialized Agents: Instead of asking a single prompt to do everything, we split roles.
DiagnosisAgentspecializes in crop disease, andWeatherAgentspecializes in data gathering. - Orchestration: The
Orchestratormanages the lifecycle of the agents, executing tasks concurrently, and merging their outputs into a final synthesized recommendation.
skills/farming_knowledge.md- Grounding reference data for crop symptoms and standard cures.weather_mcp.py- Custom weather MCP server usingFastMCPwrapping Open-Meteo.agents.py- Core classes:DiagnosisAgent,WeatherAgent, andOrchestrator.app.py- Beautiful, easy-to-use Streamlit web interface..env.template- Example configurations for environment variables.requirements.txt- Project python package dependencies.