# FAO Food & Agri: FAOSTAT Search & Monitor (MCP) (`amygraphics/fao-food-agri`) Actor

Official FAOSTAT bulk data for AI agents: search 14M rows of FAO crop/livestock production by country, product and year, and monitor releases for new yearly data alerts. No key. MCP-ready.

- **URL**: https://apify.com/amygraphics/fao-food-agri.md
- **Developed by:** [Zakaria el bouami](https://apify.com/amygraphics) (community)
- **Categories:** Lead generation, Automation, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## FAO Food & Agri: FAOSTAT Search & Monitor (MCP)

The **official FAO statistical service** — ~14 million rows of global crop & livestock data 1961–present, streamed from FAOSTAT bulk downloads. Search any **country × product × measure × year**, or monitor your products and get **`new-data-year` alerts** when FAO releases fresh data. No key. MCP-compatible, agent-ready.

### Why agents and analysts use this

FAOSTAT is *the* reference for world food and agriculture — policy, agribusiness market research, NGO work, climate/food-security analysis. The bulk files are unwieldy (hundreds of MB zipped); the API is flaky. This actor stitches the official source into **clean queryable rows** with yearly release alerts.

### What you get per row

Area (country) + M49 code, product item + CPC code, element (Area harvested / Production / Yield / Stocks…), **year, value, unit**, the official FAO data-quality flag and notes.

### Two modes

#### `search` — query now

```json
{ "mode": "search", "area": "Morocco", "item": "Wheat",
  "element": "Production", "yearFrom": 2020, "maxResults": 10 }
```

Substrings match fuzzy (case-insensitive). Returns the **newest-year matches** first.

#### `monitor` — catch FAO releases

```json
{ "mode": "monitor",
  "watchQueries": ["Morocco@Wheat@Production", "India@Rice@Yield"] }
```

- **Run 1 = free baseline** — snapshots the latest available year per query.
- **Run 2+** pushes `new-data-year` rows only when FAO publishes newer annual data.
- Schedule monthly; FAO refreshes most datasets a few times a year.

### Data honesty

Rows come from the official FAOSTAT normalized bulk file exactly as published — flags (`A` = official) and notes are preserved, blank values stay blank. Scope = **crops & livestock (Production group: QCL)**, the flagship FAOSTAT dataset 1961–present.

### Recipes

1. **Agrifood market briefs** — Wheat production Morocco 2020–2024 → straight to Sheets/Reports.
2. **Food-security agent (MCP)** — "date yield trend in Tunisia" with verified FAO figures — never hallucinated.
3. **Release radar** — monthly schedule for your commodity list; briefing lands the day new numbers drop.

### Pricing

| event | price |
|---|---|
| Actor start | $0.001 |
| FAO row | $0.001 / row |

Typical: 10-row search ≈ **$0.011** · monthly monitor ≈ **$0.001–0.003**.

### MCP / AI-agent usage

```
https://api.apify.com/v2/acts/YOUR_HANDLE~fao-food-agri/run-sync-get-dataset-items?token=YOUR_TOKEN
```

# Actor input Schema

## `mode` (type: `string`):

search = stream the FAOSTAT crops/livestock harvest (1961+) by country/product/subject and year window · monitor = yearly alerts when FAO releases new data for your area@item@element queries.

## `area` (type: `string`):

(search) e.g. "Morocco", "France", "India". Fuzzy substring.

## `item` (type: `string`):

(search) e.g. "Wheat", "Maize", "Rice", "Dates". Fuzzy substring.

## `element` (type: `string`):

(search) "Production" | "Yield" | "Area harvested" | "Stocks" ... (empty = all).

## `yearFrom` (type: `integer`):

(search) e.g. 2020. 0 = no lower bound.

## `yearTo` (type: `integer`):

(search) e.g. 2024. 0 = no upper bound.

## `watchQueries` (type: `array`):

(monitor) Specs "area@item@element" — e.g. \["Morocco@Wheat@Production"]. New yearly releases -> `new-data-year` alerts.

## `maxResults` (type: `integer`):

Cap rows per run (each billed row $0.001). Note: the whole 34MB CSV is streamed anyway; returns newest-year matches.

## `requestDelaySecs` (type: `number`):

Politeness pause before loading the official zip.

## Actor input object example

```json
{
  "mode": "search",
  "area": "",
  "item": "",
  "element": "",
  "yearFrom": 0,
  "yearTo": 0,
  "watchQueries": [],
  "maxResults": 10,
  "requestDelaySecs": 0.3
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("amygraphics/fao-food-agri").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("amygraphics/fao-food-agri").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call amygraphics/fao-food-agri --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,amygraphics/fao-food-agri"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/AqtWTBeXxYM5FrEXP/builds/26CQlYmESfZbgJoCY/openapi.json
