FAOSTAT MCP — Claude Code MCP server: what it does, how to install
Connects AI coding agents to UN agricultural statistics for 245 countries. It lets you retrieve crop, trade, food security, and emissions metrics via chat.
claude mcp add faostat-mcp -e FAOSTAT_API_TOKEN=<FAOSTAT_API_TOKEN> -e FAOSTAT_USERNAME=<FAOSTAT_USERNAME> -e FAOSTAT_PASSWORD=<FAOSTAT_PASSWORD> -- uvx faostat-mcpWhat FAOSTAT MCP does
This server bridges the UN food and agriculture database with coding assistants using 23 purpose-built MCP endpoints. The model handles category selection, filters time series from 1961 onward, and resolves ambiguity via faostat_search_codes. A built-in throttle limits traffic to 2 requests per second.
Requests flow through a tiered cache: 20 minutes in memory, 24 hours in SQLite, and optional Redis persistence. Anonymous access is not supported. You need credentials from the FAOSTAT Developer Portal to query the API. You can store your login in the OS keychain with faostat_setup or pass it as runtime environment variables.
What it helps with
- query global crop yields and harvested acreage across historical dates
- inspect country-level agricultural trade and price metrics
- track greenhouse gas emissions originating from food systems
- evaluate national indicators on undernourishment and food access
Example prompts for the agent
- Compare wheat production volumes between France and Germany from 2015 to 2022 using FAOSTAT.
- Show the agricultural greenhouse gas emission numbers for Brazil over the last five years.
- Run faostat_setup with my credentials to store my login securely.
How to install FAOSTAT MCP
Platform CLI
claude mcp add faostat-mcp -e FAOSTAT_API_TOKEN=<FAOSTAT_API_TOKEN> -e FAOSTAT_USERNAME=<FAOSTAT_USERNAME> -e FAOSTAT_PASSWORD=<FAOSTAT_PASSWORD> -- uvx faostat-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from faostat-mcp <command>
Platform CLI
codex mcp add faostat-mcp --env FAOSTAT_API_TOKEN=<FAOSTAT_API_TOKEN> --env FAOSTAT_USERNAME=<FAOSTAT_USERNAME> --env FAOSTAT_PASSWORD=<FAOSTAT_PASSWORD> -- uvx faostat-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from faostat-mcp <command>
Config file
{
"mcpServers": {
"faostat-mcp": {
"command": "uvx",
"args": [
"faostat-mcp"
],
"env": {
"FAOSTAT_API_TOKEN": "<FAOSTAT_API_TOKEN>",
"FAOSTAT_USERNAME": "<FAOSTAT_USERNAME>",
"FAOSTAT_PASSWORD": "<FAOSTAT_PASSWORD>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from faostat-mcp <command>
Config file
{
"servers": {
"faostat-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"faostat-mcp"
],
"env": {
"FAOSTAT_API_TOKEN": "<FAOSTAT_API_TOKEN>",
"FAOSTAT_USERNAME": "<FAOSTAT_USERNAME>",
"FAOSTAT_PASSWORD": "<FAOSTAT_PASSWORD>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from faostat-mcp <command>
Platform CLI
gemini mcp add -e FAOSTAT_API_TOKEN=<FAOSTAT_API_TOKEN> -e FAOSTAT_USERNAME=<FAOSTAT_USERNAME> -e FAOSTAT_PASSWORD=<FAOSTAT_PASSWORD> faostat-mcp uvx faostat-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from faostat-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about FAOSTAT MCP
How to install FAOSTAT MCP in Claude Code?
Run `claude mcp add faostat-mcp -e FAOSTAT_API_TOKEN=<FAOSTAT_API_TOKEN> -e FAOSTAT_USERNAME=<FAOSTAT_USERNAME> -e FAOSTAT_PASSWORD=<FAOSTAT_PASSWORD> -- uvx faostat-mcp`.
What does FAOSTAT MCP do?
It exposes official United Nations food and farming databases to your AI agent, making statistical queries possible through conversational prompts.
What credentials are required to use this server?
You need an account on the FAOSTAT Developer Portal. Supplying your username and password allows automatic token refresh, whereas standalone API tokens expire after 1 hour.