etudelab/agri-weather-mcp
If you are the rightful owner of agri-weather-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Agri-Weather MCP for Indonesia is a specialized server designed to provide real-time weather data and agricultural intelligence to support farming operations.
get_current_weather
Provides real-time weather conditions for a specific location.
get_weather_forecast
Delivers a 5-day weather forecast with daily and hourly data.
get_agricultural_alerts
Generates crop-specific warnings and recommendations.
get_soil_conditions
Returns detailed soil temperature and moisture forecasts.
get_evapotranspiration_data
Provides evapotranspiration data for irrigation planning.
get_historical_weather
Fetches historical weather data for a specified date range.
Agri-Weather MCP
This project provides a comprehensive Weather Model Context Protocol (MCP) server specifically designed for agricultural applications. It leverages the free Open-Meteo API to provide real-time weather data, forecasts, and agricultural intelligence to support farming operations, cultivation planning, and crop management decisions.
Key Features
- Current Weather: Get real-time, localized weather conditions, including temperature, humidity, precipitation, and soil data.
- Weather Forecast: Access detailed 5-day weather forecasts with hourly granularity to support agricultural planning.
- Agricultural Alerts: Receive crop-specific alerts and recommendations for various growth stages (e.g., planting, vegetative, flowering).
- Soil Conditions: Retrieve detailed soil temperature and moisture information at multiple depths.
- Evapotranspiration Data: Obtain evapotranspiration (ET) and reference ET₀ data for precise irrigation management.
- Historical Weather: Access historical weather data for trend analysis and seasonal planning.
Technology Stack
- Python 3.11+
- MCP Server SDK: Core framework for building the Model Context Protocol server.
- HTTPX: For making asynchronous HTTP requests to the Open-Meteo API.
- Pytest: For running the comprehensive test suite.
Setup and Installation
-
Clone the repository:
git clone <your-repository-url> cd agri-weather-mcp
-
Run the setup script (from repository root):
./scripts/setup.sh
Alternative Setup
-
Create and activate a Python virtual environment:
python3 -m venv .venv source .venv/bin/activate
On Windows, use
.venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
Usage
Running the Test Suite
The project includes a comprehensive test suite that verifies all functionality of the MCP server.
To run the tests, execute the following command from the project's root directory:
python -m pytest
This will run all tests using both the asyncio and trio backends to ensure compatibility with different async frameworks.
Test Features
- Comprehensive Coverage: Tests for all MCP tools and server components
- Multiple Region Support: Tests run against all supported regions (Indonesia, South East Asia, Australia, India)
- Mock API Responses: Uses realistic mock data that matches actual API response structures
- Async Testing: Compatible with both asyncio and trio backends
- Robust Error Handling: Tests for proper handling of API errors and invalid inputs
Test Structure
The test suite is organized as follows:
test_mcp.py
: Contains the main test classes and methodsconftest.py
: Contains pytest fixtures and mock datapytest.ini
: Contains pytest configuration
The tests serve as practical examples of how to interact with the server's capabilities.
MCP Tools Overview
The server exposes the following tools through the Model Context Protocol:
-
get_current_weather
: Provides real-time weather conditions for a specific location.- Parameters:
latitude
,longitude
- Parameters:
-
get_weather_forecast
: Delivers a 5-day weather forecast with daily and hourly data.- Parameters:
latitude
,longitude
- Parameters:
-
get_agricultural_alerts
: Generates crop-specific warnings and recommendations.- Parameters:
latitude
,longitude
,crop_type
,growth_stage
- Parameters:
-
get_soil_conditions
: Returns detailed soil temperature and moisture forecasts.- Parameters:
latitude
,longitude
- Parameters:
-
get_evapotranspiration_data
: Provides evapotranspiration data for irrigation planning.- Parameters:
latitude
,longitude
- Parameters:
-
get_historical_weather
: Fetches historical weather data for a specified date range.- Parameters:
latitude
,longitude
,start_date
,end_date
- Parameters:
License
This project is licensed under the MIT License. See the file for details.
Attribution
This project uses weather data from Open-Meteo, which is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Weather data by Open-Meteo.com
When using this project, you must maintain this attribution wherever Open-Meteo data is displayed.