# faostat-mcp-server

A local SQLite mirror of UN FAOSTAT: production, trade, food security, land use, fertilizer, emissions for 245+ countries since 1961. Agents resolve codes, query cubes, and run SQL over big result sets.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · 2410 installs · ★ 3 repo stars
- Author: cyanheads
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/cyanheads/faostat-mcp-server
- Updated: 2026-10-18
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/faostat-mcp-server

## What it does

This server brings UN food and agriculture statistics into your coding agent. The bulk corpus lands in a local SQLite mirror, and a DataCanvas layer adds a read-only SQL surface on top. Seven tools, one skill resource.

The flow starts with `faostat_list_domains`, which lists the ~69-domain catalog and marks what is indexed locally. `faostat_resolve_codes` maps names like maize or milk to the integer codes queries need, flagging countries versus aggregate regions. `faostat_query_observations` pulls the cube by areas, items, elements, and a year range. Small results come back inline; anything above the limit spills to a DataCanvas table, capped at 50,000 staged rows.

\`faostat_commodity_profile` assembles a commodity snapshot in one call: top producers, production trend, trade flows. Ambiguous names should be resolved through `faostat_resolve_codes` with domain `QCL` first. Staged tables expire after a 2-hour TTL, and the opt-in `faostat_dataframe_drop` tool requires `FAOSTAT_DATAFRAME_DROP_ENABLED=true`. Data-quality flags travel with every row and are never stripped.

## Requirements
- Remote server: `https://faostat-mcp-server--cyanheads.run.tools`

## Install

### Claude Code (native platform)

**Platform CLI: remote server**
```bash
claude mcp add --transport http faostat-mcp-server https://faostat-mcp-server--cyanheads.run.tools
```

### Codex

**Platform CLI: remote server**
```bash
codex mcp add faostat-mcp-server --url https://faostat-mcp-server--cyanheads.run.tools
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "faostat-mcp-server": {
            "url": "https://faostat-mcp-server--cyanheads.run.tools"
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "faostat-mcp-server": {
            "type": "http",
            "url": "https://faostat-mcp-server--cyanheads.run.tools"
        }
    }
}
```

### Gemini CLI

**Platform CLI: remote server**
```bash
gemini mcp add -t http faostat-mcp-server https://faostat-mcp-server--cyanheads.run.tools
```

## When to use it
- find the right FAOSTAT domain by code or topic
- turn a commodity name into the integer code a query needs
- fetch observations by country, item, and year range
- build a single-commodity profile with producers, trend, and trade
- run SQL over large result sets without leaving the agent

## Example prompts
- List FAOSTAT domains that are indexed and ready to query
- Resolve the item code for maize in the QCL domain
- Pull a commodity profile for wheat: top producers, trend, exports

## Similar
- [FAOSTAT MCP](https://affpapa.org/en/nevibecode/mcp/faostat-mcp.md) — MCP server · ★ 20 repo stars
- [data-scientist](https://affpapa.org/en/nevibecode/skills/data-scientist.md) — skill · 385 installs
- [data-specialist](https://affpapa.org/en/nevibecode/agents/data-specialist.md) — subagent · ★ 328 repo stars
- [data-analyst](https://affpapa.org/en/nevibecode/skills/borghei-data-analyst.md) — skill · 629 installs
- [Statistics Canada MCP Server](https://affpapa.org/en/nevibecode/mcp/statistics-canada-mcp-server.md) — MCP server · ★ 8 repo stars
- [eurostat-mcp-server](https://affpapa.org/en/nevibecode/mcp/eurostat-mcp-server.md) — MCP server · ★ 10 repo stars

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
