CropProphEU

Created By
DasClowna month ago
Overview

๐ŸŒพ CropProphEU โ€” EU Crop Intelligence MCP Server

CI Python โ‰ฅ3.11 License: MIT GitHub stars Discussions Tests Latest Release

13 MCP Tools, 5 Crops, 26 EU Countries, 123 NUTS2 Regions โ€” Yield forecasts, market values (โ‚ฌ/ha), risk analysis, environmental risk scoring & portfolio optimization for European agriculture. Built for AI agents, by AI agents.

"How will wheat perform in Sachsen-Anhalt this year? What's my best โ‚ฌ/ha allocation across 100 ha?"

pip install git+https://github.com/DasClown/CropProphEU.git

Features (13 MCP Tools)

#ToolWhat it doesV
1yield_and_valueYield + market value (โ‚ฌ/ha) + plain-language summary (DE/EN)V4.6
2europe_yield_forecastPan-European RF forecast with Yield-at-Risk (P10/P50/P90) + NDVI correctionV4.3
3crop_forecastCurrent season: GDD, rain, soil moisture, drought index, frost warningsV4.0
4compare_regionsBatch-compare 20 regions ร— 5 crops with live market pricesV5.1
5portfolio_optimizerAI investment engine: budget โ†’ optimal allocation across regions ร— cropsV5.1e
6season_comparisonCompare this season to historical yearsV4.0
7region_healthAll crops for one region, single callV4.5
8weather_outlook16-day weather forecastV4.0
9climate_scenarioWhat-if: +2ยฐC, -20% rain, etc.V4.4
10yield_forecastAnalog-year yield matching (DE-focused)V3.0
11list_regions123 NUTS2 regions across 26 countriesV4.2
12list_cropsCrop parameters (GDD base, season, frost sensitivity)V4.5
13environmental_riskNEW V5.4 โ€” ERS (forest, erosion, storm, hail) + wild boar damage risk for DEV5.4

Quick Start

1. Install

pip install git+https://github.com/DasClown/CropProphEU.git

2. Use as MCP Server

CLI (stdio):

crop-mcp

Python API:

from crop_mcp import predict_europe_yield

result = predict_europe_yield("DE11", "DE", crop="wheat", gdd=3050, precip_mm=650)
print(f"Yield: {result['predicted_yield_t_ha']} t/ha")
print(f"Revenue: ~{result['predicted_yield_t_ha'] * 239:.0f} โ‚ฌ/ha")

3. Claude Desktop / Cursor

{
  "mcpServers": {
    "crop": {
      "command": "python3",
      "args": ["-m", "crop_mcp.server"]
    }
  }
}

4. HTTP Server (Remote / Smithery)

pip install crop-mcp[http]
crop-mcp --http --port 8080

Connect via SSE: http://your-server:8080/sse

5. Docker

docker build -t crop-mcp .
docker run -p 8080:8080 crop-mcp crop-mcp --http --port 8080

Verified Crops โ€” Data Integrity โœ…

Every prediction traces to a verified Eurostat crop code. No hallucinations, no silent wrong-crop training.

CropEurostat CodeSamplesCountriesMAE (LOYO)Rยฒ
๐ŸŒพ WheatC11001,60326 (๐Ÿ‡ช๐Ÿ‡บ+๐Ÿ‡บ๐Ÿ‡ฆ)11.5%0.87
๐ŸŒฝ Corn (Maize)C15001,79721 (๐Ÿ‡ช๐Ÿ‡บ+๐Ÿ‡ฌ๐Ÿ‡ง)11.6%0.72
๐ŸŒฟ BarleyC13001,88526 (๐Ÿ‡ช๐Ÿ‡บ+๐Ÿ‡ฌ๐Ÿ‡ง)11.2%0.85
๐ŸŒป RapeseedI11101,8252510.8%0.83
๐ŸŒป SunflowerI11201,2291716.1%0.74

โš ๏ธ V5.1d Data Fix: Rapeseed + Sunflower were previously trained on RICE data (wrong Eurostat codes C2000/C2200). Now corrected to Industrial crop codes I1110/I1120. DE rapeseed prediction fell from 7.21t to 2.63t โ€” real, not extrapolated.


Why CropProphEU?

CapabilityCropProphEUOpen-Meteo MCPGro Intelligence
Yield forecastsโœ… 5 cropsโŒโœ… $10K+/yr
Soil featuresโœ… 11 propertiesโŒโœ…
Yield-at-Risk (P10/P90)โœ…โŒโœ…
Live market prices (โ‚ฌ/ha)โœ… CBOT + MATIFโŒโœ…
Climate what-ifโœ…โŒโœ…
Frost warningsโœ…โœ…โŒ
NDVI satellite correctionโœ…โŒโŒ
Portfolio optimizerโœ…โŒโŒ
Multi-language (DE/EN)โœ…โŒโŒ
Environmental Riskโœ… V5.4โŒโŒ
PriceFreeFree$10K+/yr

Unique: Only free MCP server covering EU agriculture with soil โ†’ yield โ†’ market value โ†’ environmental risk โ†’ portfolio optimization in one pipeline.


V5.4 โ€” Environmental Risk Score + Wildschaden ๐ŸŒ๐Ÿ—

FeatureBeschreibung
Environmental Risk ScoreKomposit aus Waldanteil, Maisflรคche, Bodenerosion, Sturm- + Hagelrisiko โ†’ ๐ŸŸข๐ŸŸก๐Ÿ”ด
Wildschaden DEDJV-Jagdstreckendaten + Waldrandindex + Maisflรคchenanteil โ†’ โ‚ฌ/ha-Verlustschรคtzung
Ampel-System๐ŸŸข low (<35), ๐ŸŸก moderate (35-65), ๐Ÿ”ด high (โ‰ฅ65)
MCP Toolenvironmental_risk(region='DE26') โ†’ sofortige Analyse inkl. Wildschaden

Beispiel MaรŸbach (DE26 Unterfranken):

{
  "overall_risk": "๐Ÿ”ด high",
  "ers_level": "๐ŸŸก moderate",
  "wild_boar_risk": {"level": "๐Ÿ”ด high", "loss_eur_ha": 158},
  "management": ["Waldrandstreifen 3-6m", "Drรผckjagd Nov-Dez", "8-Tage-Anzeigefrist ยง36 BayJG"]
}

V5.4 โ€” Testing & CI ๐Ÿงช

MaรŸnahmeStatus
pytest16 Tests, alle passing (tests/test_crop_mcp.py)
CI (GitHub Actions)โœ… Aktiv bei jedem Push โ€” Badge im Header grรผn
Git LFS*.pkl + groรŸe .json via LFS (aus Git-Tree entfernt)

Run tests:

pip install -e ".[test]"
pytest tests/ -v

Model Accuracy

MetricValue
LOYO MAE (Wheat)0.599 t/ha (11.5%)
Forward Validation (Train โ‰ค2022, Test 2023-24)0.794 t/ha (15.0%)
Rยฒ (LOYO)0.871
Rยฒ (Forward)0.628

Most accurate for core EU (DE, FR, BE, NL, AT, CZ) where training data is dense.

Per-Crop Performance (V5.2)

CropAlgorithmTop FeatureKey Insight
๐ŸŒพ WheatRF 200 treessolar_kwh (35%)Nord/Sรผd gradient dominates
๐ŸŒฝ CornRF 200 treesclay_pct (42%)Maize is extremely soil-sensitive
๐ŸŒฟ BarleyRidgeclay_pct (27%)Best coverage of all crops
๐ŸŒป RapeseedRF 200 treescoarse_pct (28%)Corrected โ€” now 1,825 real samples
๐ŸŒป SunflowerRidgesilt_pct (24%)17 countries (post-fix)

Live Market Prices

CropSourceโ‚ฌ/t (Mai 2026)Market
Wheatโœ… CBOT ZW=F + MATIF premium239Euronext MATIF
Cornโœ… CBOT ZC=F + MATIF premium189Euronext MATIF
Barleyโœ… Reference (AMI regional)190AMI regional exchanges
Rapeseedโœ… Reference470Euronext MATIF (ECO)
Sunflowerโœ… Reference420ICE / Black Sea

Production costs are country- and crop-specific (V5.3+). See market_prices.py โ†’ COUNTRY_PRODUCTION_COSTS (28 EU countries ร— 5 crops). Sources: FADN, KTBL, ARVALIS. Examples:

CountryWheatCornBarleyRapeseedSunflower
๐Ÿ‡ฉ๐Ÿ‡ช DE650700600780650
๐Ÿ‡ซ๐Ÿ‡ท FR700650600750600
๐Ÿ‡ต๐Ÿ‡ฑ PL550600500650550
๐Ÿ‡ท๐Ÿ‡ด RO450500400550450
๐Ÿ‡ช๐Ÿ‡ธ ES600650550700โ€”

โ„น๏ธ Full table: COUNTRY_PRODUCTION_COSTS dict in crop_mcp/market_prices.py


Data Sources

SourceDataAccess
EurostatCrop yields (apro_cpshr) โ€” 25+ years, verified codesFree, no key
NASA POWERGDD, precip, solar, soil moistureFree, no rate limits
Open-Meteo16-day forecast, GDDFree, no key
SoilGrids v2 (ISRIC)11 properties: SOC, pH, N, CEC, clay, sand, silt, bdod (bulk density), cfvo (coarse fragments), AWC, coarseFree REST API
LUCAS Soil (ESDAC)Texture ~20K field points + coarse fragmentsFree download
Sentinel-2 NDVIVegetation index (Copernicus STAC + Planetary Computer fallback)Free, no auth
Yahoo FinanceLive CBOT wheat/corn futures, EUR/USDFree, no key

Zero API keys required โ€” all sources are free and public.


Example Output

German (default):

Weizen โ€“ Region DEE0 (DE)
Ertrag: 7.35 t/ha (Spanne 6.50โ€“8.20)
Temperatur: warm (2950ยฐC Wรคrmesumme)
Niederschlag: ausreichend (480 mm)
Bodenfeuchte: feucht (48%)
Modellabweichung: ยฑ11.5% (1603 Samples, 26 Lรคnder)
Vergleich zu 2024: +0.15 t/ha (im Rahmen des Vorjahres)
Marktwert: 1.757 โ‚ฌ/ha @ 239 โ‚ฌ/t
Kosten: 650 โ‚ฌ/ha โ†’ Deckungsbeitrag: 1.107 โ‚ฌ/ha

English (with language="en"):

Wheat โ€“ Region DEE0 (DE)
Yield: 7.35 t/ha (range 6.50โ€“8.20)
Temperature: warm (2950ยฐC GDD)
...

Architecture

crop-mcp/
โ”œโ”€โ”€ crop_mcp/
|โ”œโ”€โ”€ server.py                 # 857 Zeilen โ€” Pydantic-Modelle + Tool-Registry + MCP-Init
โ”‚   โ”œโ”€โ”€ tools/                  # **V5.4e** โ€” Handler in logische Module aufgeteilt
โ”‚   โ”‚   โ”œโ”€โ”€ weather.py          # weather_outlook, crop_forecast, season_comparison, region_health
โ”‚   โ”‚   โ”œโ”€โ”€ yield_tools.py      # yield_forecast, europe_yield_forecast, yield_and_value, climate_scenario
โ”‚   โ”‚   โ”œโ”€โ”€ market.py           # compare_regions, portfolio_optimizer
โ”‚   โ”‚   โ”œโ”€โ”€ info.py             # list_regions, list_crops
โ”‚   โ”‚   โ”œโ”€โ”€ environmental.py    # environmental_risk (V5.4)
โ”‚   โ”‚   โ””โ”€โ”€ helpers.py          # Shared utilities (NDVI correction, frost, language)
โ”‚   โ”œโ”€โ”€ europe_model_api.py       # RF (200 trees) + Yield-at-Risk + NDVI correction
โ”‚   โ”œโ”€โ”€ environmental_risk.py     # V5.4 โ€” ERS + Wildschaden DE
โ”‚   โ”œโ”€โ”€ ndvi_correction.py        # Sentinel-2 NDVI correction factor (ยฑ30%)
โ”‚   โ”œโ”€โ”€ market_prices.py          # Live CBOT/MATIF via Yahoo Finance
โ”‚   โ”œโ”€โ”€ feature_cache.py          # Sub-second historical queries
โ”‚   โ”œโ”€โ”€ simulate_yield.py         # Analog-year matching
โ”‚   โ”œโ”€โ”€ auto_update.py            # Monthly retrain cron
โ”‚   โ”œโ”€โ”€ core/regions.py           # 123 NUTS2 regions
โ”‚   โ””โ”€โ”€ sources/                  # Weather, soil, NDVI, Eurostat, FAOSTAT fetchers
โ”œโ”€โ”€ models/                       # .pkl files โžœ download from Releases
โ”œโ”€โ”€ data/                         # Training data โžœ download from Releases (or generated by build)
โ”œโ”€โ”€ tests/                        # V5.4 โ€” 16 pytest tests
โ”œโ”€โ”€ .github/workflows/ci.yml      # V5.4 โ€” CI workflow (lokal, benรถtigt PAT mit workflow-Scope fรผr Push)
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Key design principles:

  • No hallucination โ€” every yield prediction traces to verified Eurostat data
  • Live prices โ€” CBOT wheat/corn via Yahoo Finance, updated hourly
  • Self-updating โ€” monthly cron rebuilds models with latest Eurostat data
  • Zero API keys โ€” all data sources are free and public
  • AI-for-AI โ€” built for agents, no dashboards

Building & Training

# Build training data (25 min per crop)
python3 build_europe.py --crop corn

# Train model (2 min)
python3 train_europe_fast.py --crop corn

# Auto-update monthly (cron: 1st of month at 06:00)

Commercial Use Cases

  • Agri-trading desks: "What's wheat worth in Picardie at current MATIF prices?"
  • Farm advisory: "How does this season compare to the last 5 years?"
  • Insurance / Risk: Yield-at-Risk (P10/P50/P90) per region + crop
  • EU policy analysis: Climate scenario impact on national yields
  • Investment: Portfolio optimizer for 100+ ha allocation decisions

๐Ÿค Getting Help & Contributing

ChannelPurpose
๐Ÿ’ฌ GitHub DiscussionsQuestions before coding, feature ideas, community chat
๐Ÿ› GitHub IssuesBug reports, confirmed feature requests
๐Ÿ“– CONTRIBUTING.mdDevelopment setup, branch naming, commit conventions, code style

New contributors welcome! See CONTRIBUTING.md to get started.


License

MIT โ€” free to use, modify, and distribute.

Built with โค๏ธ for AI agents that need real, verifiable crop intelligence.

Project Info
Created At
a month ago
Updated At
a day ago
Author Name
DasClown
Star
-
Language
-
License
-
Category
Tags

Recommend Servers

View All
Voyei

33 minutes ago