agroagent

agroagent

An AI agent that orchestrates four specialized MCP servers to provide actionable agricultural recommendations for Chilean farmers, integrating weather, market prices, crop history, and regulatory documents.

Category
Visit Server

README

AgroAgent

Agente de IA orientado al nicho agrícola chileno, construido con arquitectura de agentes vía Model Context Protocol (MCP). En vez de un backend monolítico, cuatro MCP servers independientes exponen tools especializadas que un orquestador coordina mediante un agent loop con el Anthropic SDK.

Arquitectura

apps/
  web/            Next.js 16 + TypeScript + Tailwind v4 + Recharts
  orchestrator/   FastAPI -- MCP host + agent loop (Anthropic SDK) + rutas REST de dashboard
mcp-servers/
  mcp-weather/    tool: get_weather_forecast (Open-Meteo)
  mcp-prices/     tool: get_commodity_price (datos abiertos ODEPA)
  mcp-db/         tools: get_farmer_history, register_planting (PostgreSQL/SQLAlchemy async)
  mcp-rag/        tool: search_sag_documents (RAG sobre normativa SAG -- Pinecone + Voyage AI)
packages/
  shared-types/   Modelos Pydantic compartidos entre orchestrator y mcp-servers

El orquestador se conecta como cliente MCP a los 4 servers, agrega su catálogo de tools en uno solo, y expone:

  • POST /chat -- endpoint conversacional (Claude decide qué tools usar según el contexto)
  • GET /weather, GET /farmers/{id}/history, GET /prices/trend -- rutas REST deterministas para el dashboard, que llaman las tools directo sin pasar por el LLM

El valor del proyecto no es exponer cada fuente por separado, sino que el agente las cruce: por ejemplo, relacionar el historial de cultivos de un agricultor con el pronóstico de su zona y el precio actual de su producto para sugerir decisiones concretas, citando la resolución SAG exacta cuando corresponde.

Stack

  • Backend: Python 3.12+, FastAPI, mcp SDK (v2), SQLAlchemy async + asyncpg, Pinecone, Voyage AI, Anthropic SDK, uv (workspace de monorepo)
  • Frontend: Next.js (App Router), TypeScript, Tailwind CSS v4, Recharts, pnpm
  • Datos: PostgreSQL (Docker), Open-Meteo API, ODEPA (CKAN datastore API), documentos normativos del SAG

Requisitos

  • Python 3.12+ y uv
  • Node 20+ y pnpm
  • Docker (para PostgreSQL)
  • API keys: Anthropic, Pinecone, Voyage AI

Setup

# Backend (Python workspace completo)
uv sync --all-packages

# Frontend
cd apps/web && pnpm install && cd ../..

# Base de datos
docker compose up -d postgres

Crea apps/web/.env.local:

NEXT_PUBLIC_ORCHESTRATOR_URL=http://localhost:3001

Levantar el proyecto (6 procesos)

# Terminal 1
uv run --package mcp-weather uvicorn mcp_weather.app:app --reload --port 4001

# Terminal 2
uv run --package mcp-prices uvicorn mcp_prices.app:app --reload --port 4002

# Terminal 3 (ajusta el puerto de Postgres si no usas el 5432 por defecto)
DATABASE_URL="postgresql+asyncpg://agroagent:agroagent@localhost:5432/agroagent" \
  uv run --package mcp-db uvicorn mcp_db.app:app --reload --port 4004

# Terminal 4
PINECONE_API_KEY="..." VOYAGE_API_KEY="..." \
  uv run --package mcp-rag uvicorn mcp_rag.app:app --reload --port 4005

# Terminal 5
ANTHROPIC_API_KEY="..." \
  uv run --package orchestrator uvicorn orchestrator.app:app --reload --port 3001

# Terminal 6
cd apps/web && pnpm dev

Frontend en http://localhost:3000.

Decisiones de arquitectura

  • Transporte MCP: streamable-HTTP, no stdio -- cada MCP server es un servicio independiente con su propio puerto/contenedor, más fiel a un despliegue real de microservicios.
  • Backend en Python/FastAPI en vez de NestJS/TypeScript: decisión deliberada por demanda de mercado y para demostrar versatilidad políglota (frontend se mantuvo en TS/React).
  • RAG: chunking respeta la estructura numerada de las resoluciones legales chilenas (2.1, 3.1.1, etc.) en vez de cortar por cantidad fija de caracteres; metadata de cada chunk incluye número de resolución para que el agente pueda citar la fuente.
  • Rutas REST separadas del agente: el dashboard no pasa por el LLM para datos deterministas (clima, historial, precios) -- evita costo y latencia innecesarios; ambas capas reutilizan las mismas tools MCP subyacentes.

Limitaciones conocidas / pendientes

  • Sin autenticación: farmer_id se pasa explícito, no hay sesión de usuario.
  • No existe ruta para crear agricultores nuevos (POST /farmers) -- los registros de prueba se insertaron manualmente.
  • mcp-rag no soporta PDFs escaneados sin capa de texto (requeriría OCR).
  • No hay Dockerfile individual por servicio -- docker-compose.yml cubre solo PostgreSQL.
  • Los nombres de cultivo en mcp-db no están normalizados contra los nombres de producto de ODEPA en mcp-prices.

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