CropProphEU

by DasClown

135 downloads
Not rated
GitHub

Description

# 🌾 CropProphEU β€” EU Crop Intelligence MCP Server [![CI](https://github.com/DasClown/CropProphEU/actions/workflows/ci.yml/badge.svg)](https://github.com/DasClown/CropProphEU/actions/workflows/ci.yml) [![Python…

About

# 🌾 CropProphEU β€” EU Crop Intelligence MCP Server [![CI](https://github.com/DasClown/CropProphEU/actions/workflows/ci.yml/badge.svg)](https://github.com/DasClown/CropProphEU/actions/workflows/ci.yml) [![Python β‰₯3.11](https://img.shields.io/badge/python-%3E%3D3.11-blue.svg)](https://www.python.org/downloads/)…

Details

Author
DasClown
Downloads
135
Categories
Other

- 13 MCP tools for yield, value, risk, and optimization
- Yield-at-Risk (P10/P50/P90) with NDVI satellite correction
- Live market prices from CBOT/MATIF via Yahoo Finance
- Portfolio optimizer for budget allocation across regions and crops
- Environmental Risk Score (ERS) and wild boar damage risk (DE)
- Zero API keys required – all data sources are free and public

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name CropProphEU
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install via pip install git+https://github.com/DasClown/CropProphEU.git, then run as an MCP server using the crop-mcp CLI command (stdio) or crop-mcp --http --port 8080 for HTTP/SSE. Integrate with Claude Desktop or Cursor by adding a JSON configuration with the command python3 -m crop_mcp.server. Alternatively, use the Python API directly for yield predictions.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "croppropheu": {
            "CropProphEU": {
                "command": "docker",
                "args": [
                    "build",
                    "-t",
                    "crop-mcp",
                    "."
                ]
            }
        }
    }
}

McpServers

{
    "CropProphEU": {
        "command": "docker",
        "args": [
            "build",
            "-t",
            "crop-mcp",
            "."
        ]
    }
}

🌾 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)

| # | Tool | What it does | V |
|---|------|-------------|---|
| 1 | yield_and_value | Yield + market value (€/ha) + plain-language summary (DE/EN) | V4.6 |
| 2 | europe_yield_forecast | Pan-European RF forecast with Yield-at-Risk (P10/P50/P90) + NDVI correction | V4.3 |
| 3 | crop_forecast | Current season: GDD, rain, soil moisture, drought index, frost warnings | V4.0 |
| 4 | compare_regions | Batch-compare 20 regions Γ— 5 crops with live market prices | V5.1 |
| 5 | portfolio_optimizer | AI investment engine: budget β†’ optimal allocation across regions Γ— crops | V5.1e |
| 6 | season_comparison | Compare this season to historical years | V4.0 |
| 7 | region_health | All crops for one region, single call | V4.5 |
| 8 | weather_outlook | 16-day weather forecast | V4.0 |
| 9 | climate_scenario | What-if: +2Β°C, -20% rain, etc. | V4.4 |
| 10 | yield_forecast | Analog-year yield matching (DE-focused) | V3.0 |
| 11 | list_regions | 123 NUTS2 regions across 26 countries | V4.2 |
| 12 | list_crops | Crop parameters (GDD base, season, frost sensitivity) | V4.5 |
| 13 | environmental_risk | NEW V5.4 β€” ERS (forest, erosion, storm, hail) + wild boar damage risk for DE | V5.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.

| Crop | Eurostat Code | Samples | Countries | MAE (LOYO) | RΒ² |
|------|:-------------:|:-------:|:---------:|:----------:|:--:|
| 🌾 Wheat | C1100 | 1,603 | 26 (πŸ‡ͺπŸ‡Ί+πŸ‡ΊπŸ‡¦) | 11.5% | 0.87 |
| 🌽 Corn (Maize) | C1500 | 1,797 | 21 (πŸ‡ͺπŸ‡Ί+πŸ‡¬πŸ‡§) | 11.6% | 0.72 |
| 🌿 Barley | C1300 | 1,885 | 26 (πŸ‡ͺπŸ‡Ί+πŸ‡¬πŸ‡§) | 11.2% | 0.85 |
| 🌻 Rapeseed | I1110 | 1,825 | 25 | 10.8% | 0.83 |
| 🌻 Sunflower | I1120 | 1,229 | 17 | 16.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?

| Capability | CropProphEU | Open-Meteo MCP | Gro 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 | ❌ | ❌ |
| Price | Free | Free | $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 πŸŒπŸ—

| Feature | Beschreibung |
|:--------|:------------|
| Environmental Risk Score | Komposit aus Waldanteil, MaisflΓ€che, Bodenerosion, Sturm- + Hagelrisiko β†’ πŸŸ’πŸŸ‘πŸ”΄ |
| Wildschaden DE | DJV-Jagdstreckendaten + Waldrandindex + MaisflΓ€chenanteil β†’ €/ha-VerlustschΓ€tzung |
| Ampel-System | 🟒 low (<35), 🟑 moderate (35-65), πŸ”΄ high (β‰₯65) |
| MCP Tool | environmental_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ßnahme | Status |
|:---------|:------:|
| pytest | 16 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

| Metric | Value |
|--------|:-----:|
| 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)

| Crop | Algorithm | Top Feature | Key Insight |
|------|:---------:|:-----------:|-------------|
| 🌾 Wheat | RF 200 trees | solar_kwh (35%) | Nord/Süd gradient dominates |
| 🌽 Corn | RF 200 trees | clay_pct (42%) | Maize is extremely soil-sensitive |
| 🌿 Barley | Ridge | clay_pct (27%) | Best coverage of all crops |
| 🌻 Rapeseed | RF 200 trees | coarse_pct (28%) | Corrected β€” now 1,825 real samples |
| 🌻 Sunflower | Ridge | silt_pct (24%) | 17 countries (post-fix) |

---

Live Market Prices

| Crop | Source | €/t (Mai 2026) | Market |
|------|:------:|:---------------:|--------|
| Wheat | βœ… CBOT ZW=F + MATIF premium | 239 | Euronext MATIF |
| Corn | βœ… CBOT ZC=F + MATIF premium | 189 | Euronext MATIF |
| Barley | βœ… Reference (AMI regional) | 190 | AMI regional exchanges |
| Rapeseed | βœ… Reference | 470 | Euronext MATIF (ECO) |
| Sunflower | βœ… Reference | 420 | ICE / 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:

| Country | Wheat | Corn | Barley | Rapeseed | Sunflower |
|:--------|:-----:|:----:|:------:|:--------:|:---------:|
| πŸ‡©πŸ‡ͺ DE | 650 | 700 | 600 | 780 | 650 |
| πŸ‡«πŸ‡· FR | 700 | 650 | 600 | 750 | 600 |
| πŸ‡΅πŸ‡± PL | 550 | 600 | 500 | 650 | 550 |
| πŸ‡·πŸ‡΄ RO | 450 | 500 | 400 | 550 | 450 |
| πŸ‡ͺπŸ‡Έ ES | 600 | 650 | 550 | 700 | β€” |

> ℹ️ Full table: COUNTRY_PRODUCTION_COSTS dict in crop_mcp/market_prices.py

---

Data Sources

| Source | Data | Access |
|--------|------|--------|
| Eurostat | Crop yields (apro_cpshr) β€” 25+ years, verified codes | Free, no key |
| NASA POWER | GDD, precip, solar, soil moisture | Free, no rate limits |
| Open-Meteo | 16-day forecast, GDD | Free, no key |
| SoilGrids v2 (ISRIC) | 11 properties: SOC, pH, N, CEC, clay, sand, silt, bdod (bulk density), cfvo (coarse fragments), AWC, coarse | Free REST API |
| LUCAS Soil (ESDAC) | Texture ~20K field points + coarse fragments | Free download |
| Sentinel-2 NDVI | Vegetation index (Copernicus STAC + Planetary Computer fallback) | Free, no auth |
| Yahoo Finance | Live CBOT wheat/corn futures, EUR/USD | Free, 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

```bash

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.