DEV Community

Divya Munnuru
Divya Munnuru

Posted on

Building AgriMind: My Journey into Agentic AI – Part 2

Designing MCP Servers for an Agriculture AI Assistant

In my previous blog, I shared why I chose Agriculture as the domain for learning Agentic AI and how I started building Kisan Mitra AI (AgriMind) as a practical project instead of just experimenting with isolated AI examples.

As I continued building the application, I came across another topic that is gaining a lot of attention in the AI ecosystem—Model Context Protocol (MCP).

Everywhere I looked, developers were discussing MCP as the standard way for AI Agents to interact with external tools.

Naturally, I wanted to understand it beyond the theory.

So instead of reading documentation alone, I decided to integrate MCP directly into my Agriculture AI Assistant.

Why MCP?

When we think about an AI-powered farming assistant, it quickly becomes clear that a single Large Language Model isn't enough.

A farmer may ask questions like:

  • Which crop should I grow this season?
  • Can you identify the disease from this leaf image?
  • What are today's mandi prices?
  • Which government schemes am I eligible for?

Some of these require reasoning.

Others require external data.

Some need image analysis.

Others need business logic.

Instead of embedding everything inside one application, MCP allows us to expose each capability as a reusable tool that an AI Agent can discover and invoke whenever needed.

That modular approach immediately made sense to me.

My MCP Architecture

For Kisan Mitra AI, I built a dedicated MCP Server using FastMCP.

Instead of exposing REST endpoints directly to the AI Agent, I exposed agricultural capabilities as MCP tools.

The architecture looks like this:

This separation made the application much cleaner and easier to extend.

Instead of teaching the AI how to perform every task, the AI simply decides which tool should solve the problem.

The Four MCP Tools I Implemented

To begin with, I kept the design intentionally simple.

🌾 Crop Recommendation Tool

The first tool helps farmers decide which crop is best suited for their land.

The AI collects:

  • State
  • District
  • Soil type
  • Cropping season
  • Irrigation level
  • Water source

The MCP server then generates crop recommendations, expected yield, fertilizer guidance, and even creates a professional PDF report.

If the farmer provides an email address, the report is automatically sent through Gmail.

This was one of my favourite features because it demonstrates that an AI Agent can not only answer questions but also complete useful business tasks.


🔬 Disease Detection Tool

One of the most exciting parts of the project was integrating Vision AI.

The farmer uploads an image of a crop leaf.

The AI Agent invokes the Disease Detection MCP tool.

The tool analyses the image and returns:

  • Crop name
  • Disease
  • Confidence score
  • Symptoms
  • Organic treatment
  • Prevention tips

Instead of receiving a generic response, the farmer gets structured and actionable recommendations.


📈 Mandi Price Tool

Farmers often want to know whether it is the right time to sell their crops.

For this, I created a Mandi Price MCP tool.

The tool provides:

  • Current market prices
  • Minimum price
  • Maximum price
  • Modal price
  • Daily price trend

Although I currently use simulated market data for learning purposes, the same architecture can easily integrate with real government market APIs in the future.


💬 Agricultural Chat Tool

This became the central intelligence of the application.

Rather than simply forwarding every question to an LLM, I implemented a routing workflow.

Depending on the farmer's question, the AI decides whether it should:

  • Detect crop disease
  • Retrieve mandi prices
  • Search government schemes
  • Answer general farming questions

This was my first experience building an AI Agent that reasons before taking action, and it helped me understand why everyone is excited about Agentic AI.

One Feature I Really Enjoyed Building

One feature that made the project feel much more complete was automatic report generation.

After generating crop recommendations, the system creates a professional PDF report and sends it directly to the farmer's Gmail account.

From the farmer's perspective, the experience is seamless:

  • Ask a question
  • Receive recommendations
  • Get a detailed report in your inbox

This small addition made the AI feel less like a chatbot and more like a digital farming assistant.

Designing for Reliability

While working on this project, I also wanted to ensure the application remained useful even if an AI service became unavailable.

So I implemented graceful fallbacks.

If the LLM isn't available:

  • Crop recommendations fall back to rule-based logic.
  • Disease detection falls back to a local disease database.
  • Chat responses use predefined agricultural knowledge.

This taught me an important architectural lesson:

Good AI systems should degrade gracefully instead of simply failing.

What I Learned

Implementing MCP completely changed the way I think about AI applications.

Initially, I thought AI Agents were just LLMs with better prompts.

After building this project, I realised that the real strength lies in orchestration.

The AI isn't expected to know everything.

Instead, it reasons about the user's request, decides which tools are needed, gathers information, and then generates a meaningful response.

That shift from "answer generation" to "problem solving" is what makes Agentic AI so powerful.

What's Next?

One thing still bothered me while testing the application.

Every time the farmer started a new conversation, the AI forgot everything.

It asked the same questions again.

That led me to explore another fascinating topic—Memory.

In the next part of this series, I'll share how I implemented Memory and Context so that the Agriculture AI Assistant can remember previous conversations, disease history, crop details, and provide much more personalized recommendations.

Stay tuned for Part 3 – Implementing Memory in AI Agents, where I'll explore how memory transforms an AI chatbot into a true digital farming companion.

If you've been experimenting with MCP or Agentic AI, I'd love to hear about your experiences. Let's continue learning together.

Top comments (0)