Smart Irrigation MCP Server

Smart Irrigation MCP Server

Exposes real-time soil sensor metrics as MCP Resources and irrigation valve controls as MCP Tools, enabling AI-driven agronomic decisions with built-in safety guardrails.

Category
Visit Server

README

The-Automated-Smart-Irrigation-and-Soil-Health-Pipeline

An MCP-Driven Agronomic Intelligence System with Built-In Hardware Safety Guardrails An intelligent, closed-loop environmental agent architecture designed to optimize agricultural water consumption and audit crop soil conditions. Built for the Agents for Good track of the Kaggle AI Agents: Intensive Vibe Coding Capstone Project.


๐Ÿš€ Project Overview & Problem Statement

Traditional agricultural automation systems rely on rigid, static threshold rules (e.g., if moisture < 30%, turn on water). These configurations break down when confronting complex real-world variables, such as ignoring predictive weather APIs or blindly trusting inaccurate rain forecasts while crops actively suffer from dehydration stress.

This project implements an adaptive multi-agent reasoning framework powered by Gemini 2.5 Flash and structured using the Model Context Protocol (MCP). The pipeline evaluates live sensor data, detects logical conflicts between atmospheric forecasts and ground truth metrics, automatically accounts for rain-induced nutrient leaching, and actuates irrigation hardware safely through integrated operational guardrails.


๐Ÿ› ๏ธ Key Concepts Applied

This project demonstrates three core course concepts to satisfy the capstone technical evaluation matrix:

  1. Agent / Multi-agent System (ADK): Powered by the google-genai SDK, our agent processes complex telemetry and makes contextual agronomic decisions (balancing temperature, moisture, and weather trends) instead of relying on brittle, hardcoded if/else logic loops.
  2. MCP Server Integration: Built a local FastAPI server acting as an MCP host. It standardizes data access by exposing real-time sensor metrics as an MCP Resource stream and standardizes farm hardware control by exposing valve actuators as an executable MCP Tool.
  3. Security Features (Deterministic Guardrails): Implemented an operational physical safety gate directly into the pipeline code. If soil moisture exceeds 50% (soggy/wet conditions), the script instantly trips a safety gate, bypassing the LLM entirely to defend against root rot and unnecessary resource spend.
  4. Antigravity 2.0 [ MCP Server Resource ] ----> [ Validated Data Schema ] ----> [ Hardware Guardrail ] (Simulated Telemetry) (Moisture, Temp, Forecast, pH) (Max 50% Moisture Check) [ Executable MCP Tool ] <==== [ AI Agent Decision Loop ] <========

๐Ÿงช Advanced Agronomic Reasoning: The Leaching Feedback Loop

A standout feature of this agent is its ability to handle multi-variable environmental relationships:

  • The Problem: Heavy rainfall washes basic, alkaline nutrients (Calcium, Magnesium) deep into the subsoil, causing permanent chemical changes that lower soil pH (acidification).
  • The Agent Solution: If the incoming weather feed signals heavy rain while the physical soil pH drops below 6.0, the agent dynamically calculates a High Leaching Risk. Rather than just managing water, it halts irrigation and triggers a Critical ACUP (Acidic Concentration Update) diagnostic alert, instructing the farmer on soil chemical remediation steps.

๐Ÿ“‚ Project Structure

smart-irrigation-pipeline/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ schema.py          # Pydantic data schemas verifying telemetry integrity
โ”‚   โ”œโ”€โ”€ mcp_server.py      # FastAPI application exposing MCP resources and tools
โ”‚   โ””โ”€โ”€ agent.py           # Core ADK agent containing logic and guardrails
โ”œโ”€โ”€ requirements.txt       # Project dependencies
โ””โ”€โ”€ README.md              # Project report and setup instructions


โšก Getting Started & Setup Instructions
1. Install Dependencies
Ensure you are running within an isolated Python virtual environment, then install the required packages:
pip install -r requirements.txt

2. Configure Your Environment Workspace
Set up your Gemini authorization key within your local environment terminal:
export GEMINI_API_KEY="your_actual_gemini_api_key_here"

3. Launch the MCP Server
Start up the FastAPI server to begin exposing live telemetry resource feeds on port 8000:
python -m uvicorn src.mcp_server:app --reload --port 8000

4. Execute the Pipeline Agent
In a separate terminal window, execute the smart agent to run a diagnostics loop and actuate hardware tasks:
python src/agent.py
=====+ (Passed if safe)
(Actuate Irrigation)          (Gemini 2.5 Flash Reasoning)
   

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured